Data Acquisition Toolbox    

Example: Generating Timer Events

This example illustrates how to generate timer events for a DIO object. The callback function daqcallback displays the event type and device object name. Note that you must issue a stop command to stop the execution of the object.

You can run this example by typing daqdoc7_2 at the MATLAB command line.

  1. Create a device object -- Create the digital I/O object dio for a National Instruments board. The installed adaptors and hardware IDs are found with daqhwinfo.
  2. Add lines -- Add eight input lines from port 0 (line-configurable).
  3. Configure property values -- Configure the timer event to call daqcallback every five seconds.
  1. Start the digital I/O object. You must issue a stop command when you no longer want to generate timer events.

    The pause command ensures that two timer events are generated when you run daqdoc7_2 from the command line.

  1. Clean up -- When you no longer need dio, you should remove it from memory and from the MATLAB workspace.

  Starting and Stopping a Digital I/O Object Evaluating the Digital I/O Object Status