Initiates analog input scanning session
mdaqAIScanInit(channels, range, isDifferential, rate, duration) mdaqAIScanInit(linkID, channels, range, isDifferential, rate, duration)
This function initiates analog input scanning session. The function must be called before acquisition 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 isDifferential argument specifies measurement mode - differential or single-ended. This argument can be scalar or vector (if applicable for MicroDAQ hardware configuration). If scalar provided, its value will be used for all used 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 input 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.
Limitation: ADC1-DAC01 MicroDAQ configuration doesn't support running simultaneously AI and AO scanning sessions.
linkID: Valid connection link id (optional)
channels: Scalar or vector with channels to be read
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]
isDifferential: Scalar or vector with measurement mode settings: %T - differential, %F - single-ended mode
rate: Analog input scans per second rate
duration: Analog input scan duration [sec], (-1) - continuous operation
Perform blocking data acquisition from 8 single-ended analog input channels, one analog input range, scan frequency of 10kHz and 1 second duration.
mdaqAIScanInit(1:8, [-10,10], %F, 10000, 1) plot(mdaqAIScan(10000, %T));
Data acquisition from 8 single-ended analog input channels, one analog input range, scan frequency of 10kHz and 1 second duration.
Data acquisition from 2 single-ended and 1 differential analog input channels, different input ranges, scan frequency of 10kHz and 1 second duration.
NOTE: Example will work if applicable for MicroDAQ analog input configuration
aiData = ; dataCount = 0; mdaqAIScanInit([1 3 4], [-10,10; -5,5; -5,5], [%T %F %F], 10000, 1) for i=1:10 [data result] = mdaqAIScan(1000, %T); aiData = [aiData; data]; dataCount = dataCount + result; mprintf('Acquired %d scans (total: %d scans)\n', result, dataCount); end mdaqAIScanStop(); plot(aiData);
Continuous data acquisition from 8 single-ended analog input channels, one analog input range, scan frequency of 1kHz. Stop when MicroDAQ F1 button pressed.
NOTE: For long acquisition Scilab stack can be exceeded!