AI_ContReadChannel | ![]() ![]() ![]() ![]() |
AI_ContReadChannel
@ Description
This function performs continuous A/D conversions on the specified analog input channel at a rate as close to the rate you specified.
@ Cards Support
9111, 9112, 9113, 9114, 9118, 9812/10
@ Syntax
I16 AI_ContReadChannel (U16 CardNumber, U16 Channel, U16 AdRange, U16 *Buffer, U32 ReadCount, F32 SampleRate, U16 SyncMode)
@ Parameter
CardNumber : The
card id of the card that want to perform this operation.
Channel : Analog
input channel number
Range: 0 through 15 for PCI-9111
Range: 0 through 15 for PCI-9112/cPCI-9112
Range: 0 through 31 for PCI-9113
Range: 0 through 31 for PCI-9114
Range: 0 through 15 for PCI-9118
Range: 0 for PCI-9812/10 and cPCI-9812/10
AdRange : The
analog input range the specified channel is setting. We define some constants
to represent various A/D input ranges
in DASK.H. Please refer to the Appendix B, AI Range Codes, for the
valid range values.
Buffer
: An integer array to contain the acquired data. Buffer must
has a length equal to or greater than the value of parameter
ReadCount. 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-9112/cPCI-9112
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.
PCI-9111DG
Every 16-bit signed 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.
PCI-9111HR
Every 16-bit signed integer data:
D15 D14 D13 ................... D1 D0
where D15, D14, ... , D0 : A/D converted data
PCI-9113
Every 32-bit unsigned integer data (including 12-bit unsigned A/D data):
B31 ... B21 C4 C3 C2 C1 C0 B15 ... B12 D11 D10 ... D1 D0
where D11, D10, ... , D0 : A/D converted data
C3, C2, C1, C0 : converted channel no.
B31 ~ B21 & B15 ~ B12: dont care
PCI-9114
Every 32-bit unsigned integer data (including 16-bit signed A/D data):
B31 ... B21 C4 C3 C2 C1 C0 D15 D14 ... D1 D0
where D15, D14, ... , D0 : A/D converted data
C3, C2, C1, C0 : converted channel no.
B31 ~ B21: dont care
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.
PCI-9812/cPCI-9812
Every 16-bit signed integer data:
D11 D10 D9 ................... D1 D0 b3 b2 b1 b0
where D11, D10, ... , D0 : A/D converted data
b2, b1, b0 : Digital Input data.
b3: trigger detection flag
PCI-9810/cPCI-9810
Every 16-bit signed integer data:
D9 D8 D7 ................... D1 D0 b5 b4 b3 b2 b1 b0
where D9, D8, ... , D0 : A/D converted data
b2, b1, b0 : Digital Input data.
b3: trigger detection flag
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.
Note: if the card is PCI-9111,
PCI-9113 or PCI-9114,this function uses FIFO-Half-Full interrupt transfer
mode. So the value of
ReadCount must be the multiple of 512 for non-double-buffer mode, or
multiple of 1024 for double-buffer mode.
SampleRate : The
sampling rate you want for analog input in hertz (samples per second).
Your maximum rate depends on the card
type and your computer system. If you set A/D trigger mode as external
trigger by calling AI_9111_Config(),
AI_9112_Config(), AI_9113_Config(),AI_9114_Config(), AI_9812_Config() or
AI_9118_Config(), the sampling rate
is determined by an external trigger source, you have to set this argument
as CLKSRC_EXT_SampRate.
If you set A/D trigger mode as external trigger by calling AI_9812_Config(),
the frequency divider is set as 2 by the
driver. Hence, the sampling rate is:
Frequency of external trigger source / 2
SyncMode : Whether
this operation is performed synchronously or asynchronously. If any trigger
mode is enabled by calling
AI_9111_Config(), AI_9812_Config(), or 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