Data Acquisition Toolbox    

Example: Performing a Linear Conversion

This example illustrates how to configure the engineering units properties for an analog output object connected to a National Instruments PCI-6024E board.

The queued data consists of a 4 volt peak-to-peak sine wave. The UnitsRange property is configured so that queued data is scaled to the OutputRange property value, which is fixed at ±10 volts. This scaling utilizes the maximum dynamic range of the analog output hardware.

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

  1. Create a device object -- Create the analog output object AO for a National Instruments board. The installed adaptors and hardware IDs are found with daqhwinfo.
  2. Add channels -- Add one hardware channel to AO.
  3. Configure property values -- Create the data to be queued.
  1. Configure the sampling rate to 5 kHz, configure the trigger to repeat two times, and scale the data to cover the full output range of the D/A converter. Because the peak-to-peak amplitude of the queued data is 4, UnitsRange is set to [-2 2], which scales the output data to 20 volts peak-to-peak.

    Queue the data with one call to putdata.

  1. Output data -- Start AO and wait until all the data is output.
  2. Clean up -- When you no longer need AO, you should remove it from memory and from the MATLAB workspace.

  Linearly Scaling the Data: Engineering Units Starting Multiple Device Objects