<< mdaqAOScanData Data acquisition mdaqAOScanStop >>

MicroDAQ toolbox >> MicroDAQ toolbox > Data acquisition > mdaqAOScanInit


Initiates analog outputs scanning session

Calling Sequence

mdaqAOScanInit(channels, initialData, range, isStreamMode, rate, duration)
mdaqAOScanInit(linkID, channels, initialData, range, isStreamMode, rate, duration)


This function is part of analog scan functionality and has to be called in the following sequence:

  1. Initialize scanning session - mdaqAOScanInit()

  2. Start scanning session - mdaqAOScan()

  3. Queue new data - mdaqAOScanData()

  4. Stop scanning session - mdaqAOScanStop()

This function initiates analog output scanning session. The function must be called before acquisition is started. The channels argument can be a scalar or vector and it should contain channels numbers according to MicroDAQ hardware configuration. The range argument specifies channel measurement input range. Matrix n-by-2 where n is number of used channels shall be provided. If 1x2 matrix is provided, the range setting will be used for all channels. In order to obtain supported ranges use mdaqHWInfo().

The initialData argument contains data to be output and is specified as an m-by-n matrix, where m is the number of scans to generate, and n is the number of used output channels.

Important: The initialData argument determines size of data which can be queued with mdaqAOScanData(). Queued data size must be the same size as data argument in mdaqAOScanInit()

The rate argument determines scans per second rate for selected analog input channels. Minimum value is 1 scan per second, maximum depends on MicroDAQ analog output type.

The duration argument specifies a duration of acquisition in seconds. When set to -1, the session will run continuously, acquiring data until stopped with mdaqAIScanStop() function.

The isStreamMode argument determines scanning session behavior. Two modes are available - periodic and stream. The periodic mode (isStreamMode=%F) uses a single buffer which data is output from. When the end of the buffer is reached, data index is switched to the beginning of the buffer. This mode is suitable for generating periodic signals e.g sine waveform. The buffer can be changed during signal generation with mdaqAOScanData() function.

The stream mode (isStreamMode=%T) uses two buffers architecture to ensure uninterrupted analog signal generation. This mode of operation is suitable for stream data type e.g. generating audio stream, this mode requires from user to queue data with certain time constraints. If new data isn't queued on time, last value remains on analog output until new data has been queued. See mdaqAOScanData() documentation for more details.

Maximum data size for stream and periodic mode:

Limitations: On MicroDAQ ADC01-DAC01 hardware configuration running AI and AO scanning simultaneously is not supported.

Input arguments


Generate sine and triangle waveform in periodic mode. Sample update frequency 1000Hz, duration 5 seconds.

sineData = sin(linspace(0, 2*%pi, 1000)) + 1.0;
triangleData = linspace(0, 5, 1000);
mdaqAOScanInit(1:2, [sineData' triangleData'], [0,5], %F, 1000, 5);


See Also

Report an issue
<< mdaqAOScanData Data acquisition mdaqAOScanStop >>