Initiates analog outputs scanning session
This function is part of analog scan functionality and has to be called in the following sequence:
Initialize scanning session - mdaqAOScanInit()
Start scanning session - mdaqAOScan()
Queue new data - mdaqAOScanData()
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.
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.
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 mdaqAOScanStop() function.
The isStreamMode argument determines scanning session behavior. Two modes are available - periodic and stream. The periodic mode (isStreamMode=false) 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=true) 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.
channels: Single channel or array of channels to use
range: Range matrix - single row matrix e.g. [-10,10] sets -10 to 10V input range which will be used for all channels. If multi-range used, row number must match selected channels e.g. range matrix for 3 channels [-10,10; -5,5; -2,2]
isStreamMode: Scanning mode (true=stream, false=periodic)
rate: Analog output per second update rate
duration: Analog output scan duration [sec], (-1) - continuous
Generate sine and triangle waveform in periodic mode. Sample update frequency 1000Hz, duration 5 seconds.