AI_ContReadMultiChannels | ![]() ![]() ![]() ![]() |
AI_ContReadMultiChannels
@ Description
This function performs continuous A/D conversions on the specified analog input channels at a rate as close to the rate you specified. This function takes advantage of the PCI-9118 auto-scan and channel-gain queue functionality to perform multi-channel analog input.
@ Cards Support
9118
@ Syntax
I16 AI_ContReadMultiChannels (U16 CardNumber, U16 numChans, U16 *Chans, U16 *AdRanges, U16 *Buffer, U32 ReadCount, F32 SampleRate, U16 SyncMode)
@ Parameter
CardNumber : The
card ID of the card that want to perform this operation.
numChans : The number
of analog input channels in the array Chans. The valid value:
PCI-9118: 1 through 255
Chans : Array
of analog input channel numbers. The channel order for acquiring data is
the same as the order you set in Chans.
PCI-9118: numbers in Chans must be within 0 and 15. Since there
is no restriction of channel order setting, you can set the
channel order as you wish.
AdRanges :
An integer array of length numChans that contains the analog input
range for every channel in array Chans.
PCI-9118: Please refer to the Appendix B for the valid range values. Since
PCI-9118 supports different ranges, the
range values in AdRanges can be any of the valid range values of
PCI-9118.
Buffer : An integer
array to contain the acquired data. The length of Buffer must be
equal to or greater than the value of parameter
ReadCount. The
acquired data is stored in interleaved sequence. For example, if the value
of numChans is 3, and the
numbers in Chans are 3, 8, and 0. Then this function input data
from channel 3, then channel 8, then channel 0, then
channel 3, then channel 8, ... The data acquired is put to Buffer
by order. So the data read from channel 3 is stored in
Buffer[0], Buffer[3],
Buffer[6], ... The data from channel 8 is stored in Buffer[1],
Buffer[4], Buffer[7], ... The data from
channel 0 is stored in Buffer[2], Buffer[5], Buffer[8],
... If double-buffered mode is enabled, this buffer is of no use, you can
ignore this argument. The data format in Buffer is described as
below:
PCI-9118HR
Every 16-bit signed integer data:
D15 D14 D13 ................... D1 D0
where D15, D14, ... , D0 : A/D converted data
PCI-9118DG/HG
Every 16-bit unsigned integer data:
D11 D10 D9 ................... D1 D0 C3 C2 C1 C0
where D11, D10, ... , D0 : A/D converted data
C3, C2, C1, C0 : converted channel no.
ReadCount
: If double-buffered mode is disabled, ReadCount is the number
of A/D conversions to be performed. For double-buffered
acquisition, ReadCount is the size (in samples) of the circular
buffer and its value must be a multiple of 4.
SampleRate : The
sampling rate you want for analog input in hertz (samples per second).
The maximum rate depends on the card
type and your computer system.
If you set A/D trigger source as external trigger by calling AI_9118_Config(),
the
sampling rate is determined by an external trigger source, you have to
set this argument a CLKSRC_EXT_SampRate.
SyncMode :
Whether this operation is performed synchronously or asynchronously. If
any trigger mode is enabled by calling
AI_9118_Config(),this operation should be performed asynchronously.
Valid values:
SYNCH_OP : synchronous
A/D conversion, that is, the function does not return until the A/D operation
complete.
ASYNCH_OP : asynchronous
A/D conversion
@ Return Code
NoError, ErrorInvalidCardNumber, ErrorCardNotRegistered, ErrorFuncNotSupport, ErrorInvalidIoChannel, ErrorInvalidAdRange, ErrorTransferCountTooLarge, ErrorContIoNotAllowed