National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference Lab_ISCAN_Check
NI-DAQ FRM for PC Compatibles 2-264
©
National Instruments Corporation
However, if pretrigger mode is enabled, retrieved returns the offset of the position in your
buffer where NI-DAQ places the next data point when the function acquires. After the value
of retrieved reaches count - 1 and rolls over to 0, the acquisition begins to overwrite old
data with new data. When you apply a signal to the stop trigger input, the acquisition
collects an additional number of samples specified by ptsAfterStoptrig in the call to
DAQ_StopTrigger_Config and then terminates. When Lab_ISCAN_Check returns a
status of 1, retrieved contains the offset of the oldest data point in the array (assuming that
the acquisition has written to the entire buffer at least once). In pretrigger mode,
Lab_ISCAN_Check automatically rearranges the array upon completion of the acquisition so
that the oldest data point is at the beginning of the array. Thus, retrieved always equals 0 upon
completion of a pretrigger mode acquisition. Because the stop trigger can occur in the middle
of a scan sequence, the acquisition can end in the middle of a scan sequence. So, when the
function rearranges the data in the buffer, the first sample might not belong to the first channel
in the scan sequence. You can examine the finalScanOrder array to find out the way the data
is arranged in the buffer.
finalScanOrder is an array that indicates the scan channel order of the data in the buffer
passed to
Lab_ISCAN_Start. The size of finalScanOrder must be at least equal to the
number of channels scanned. This parameter is valid only when NI-DAQ returns daqStopped
as 1 and is useful only when you enable pretrigger mode (Lab and 1200 Series devices only).
If you do not use pretrigger mode, the values contained in finalScanOrder are, in
single-ended mode, n–1, n-2, ...1, 0 to 0, in that order, and in differential mode, 2*(n–1),
2*(n–2), ..., 2, 0, in that order, where n is the number of channels scanned. For example, if
you scanned three channels in single-ended mode, the finalScanOrder returns:
finalScanOrder[0] = 2.
finalScanOrder[1] = 1.
finalScanOrder[2] = 0.
So the first sample in the buffer belongs to channel 2, the second sample belongs to channel 1,
the third sample belong to channel 0, the fourth sample belongs to channel 2, and so on. This
is the scan order expected from the Lab-PC+ and finalScanOrder is not useful in this case.
If you use pretrigger mode, the order of the channel numbers in finalScanOrder depends on
where in the scan sequence the acquisition ended. This can vary because the stop trigger can
occur in the middle of a scan sequence, which would cause the acquisition to
end in the middle of a scan sequence so that the oldest data point in the buffer can belong to
any channel in the scan sequence.
Lab_ISCAN_Check rearranges the buffer so that the oldest
data point is at index 0 in the buffer. This rearrangement causes the scanning order to change.
This new scanning order is returned by finalScanOrder. For example, if you scanned three
channels, the original scan order is channel 2, channel 1, channel 0, channel 2, channel 1,
channel 0, and so on. However, after the stop trigger, if the acquisition ends after taking a