National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference SCAN_Sequence_Demux
©
National Instruments Corporation 2-301 NI-DAQ FRM for PC Compatibles
chanVector contains the channels sampled in the acquisition that produced the data
contained in buffer. It might be identical to the channel vector you used in the call to
SCAN_Sequence_Setup
,
or it might contain the channels in a different order.
SCAN_Sequence_Demux will reorder the data in buffer such that the data for chanVector[0]
occurs first, the data for chanVector[1] occurs second, and so on.
bufferSize is the number of samples in the buffer.
buffer is the array containing the data produced by the multi-rate acquisition. When
SCAN_Sequence_Demux returns, the data in buffer will be rearranged.
samplesPerSequence is the number of samples in a scan sequence (obtained from a previous
call to
SCAN_Sequence_Setup
)
and the size of the scanSequenceVector array.
scanSequenceVector contains the scan sequence created by NI-DAQ as a result of a previous
call to
SCAN_Sequence_Setup. You obtain a copy of scanSequenceVector by calling
SCAN_Sequence_Retrieve.
samplesPerChannelVector contains the number of samples for each channel. The channel
listed in entry i of chanVector will have a number of samples equal to the value of
samplesPerChannelVector[i].
Using This Function
SCAN_Sequence_Demux rearranges multirate data so that retrieving the data of a channel is
more straightforward. The following example illustrates how to use this function:
The input parameters are as follows:
numChans = 3
chanVector = {2, 5, 7}
bufferSize = 14
buffer = {2, 5, 7, 2, 2, 5, 2, 2, 5, 7, 2, 2, 5, 2} where a 2 represents a sample from
channel 2, and so on.
samplesPerSequence = 7
scanSequenceVector = {2, 5, 7, 2, 2, 5, 2}
The output parameters are as follows:
buffer = {2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 7, 7} where a 2 represents a sample from
channel 2, and so on.
samplesPerChannelVector =
{8, 4, 2}
The data from a channel can be located in the buffer by calculating the index of the first
sample and the index of the last sample. The data from a channel listed in chanVect[0]
(channel 2) begins at index 0 and ends at index samplesPerChannelVector [0] - 1 (index 7).
The first sample for the channel listed in chanVector[1] (channel5) begins at
samplesPerChannelVector [0] (index 8) and ends at (samplesPerChannelVector [0] +