AI_ContScanChannels Previous topicNext topicFirst topicLast topic

AI_ContScanChannels

@ Description

This function performs continuous A/D conversions on the specified continuous analog input channels at a rate as close to the rate you specified. This function takes advantage of the hardware auto-scan functionality to perform multi-channel analog input.

@ Cards Support

9111, 9112, 9113, 9114, 9118, 9812/10

@ Syntax

I16 AI_ContScanChannels (U16 CardNumber, U16 Channel, U16 AdRange, U16 *Buffer, U32 ReadCount, F64 SampleRate, U16 SyncMode)

@ Parameter
CardNumber : The card ID of the card that want to perform this operation.
Channel : The largest channel number of specified continuous analog input channel. The channel order for acquiring data is as
               follows:
               PCI-9111: number of Channel must be within 0 and 15. The continuous scan sequence is ascending and the first one
                              must be zero. For example, 0, 1, 2, 3.
               PCI-9112/cPCI-9112: number of Channel must be within 0 and 15. The continuous scan sequence is descending, and the
                              first one must be zero. For example, 3, 2, 1, 0.
               PCI-9113: number of Channel must be within 0 and 31. The continuous scan sequence is ascending and the first one
                              must be zero. For example, 0, 1, 2, 3.
               PCI-9114: number of Channel must be within 0 and 31. The continuous scan sequence is ascending and the first one
                              must be zero. For example, 0, 1, 2, 3.
               PCI-9118: number of Channel must be within 0 and 15. The continuous scan sequence is ascending and the first one
                              must be zero. For example, 0, 1, 2, 3.
              PCI-9812/10: number of Channel must be 0, 1 or 3. The continuous scan sequence is ascending and the first one must be
                              zero. For example, 0, 1, 2, 3.
              cPCI-9812/10: number of Channel must be 0, 1 or 3. The continuous scan sequence is ascending and the first one must
                              be zero. For example, 0, 1, 2, 3.
AdRange : The analog input range the continuous specified channel is setting. Please refer to the Appendix B for the valid range
                values.
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 Channel is 3, and the scanned channel
                  numbers is descending (e.g. PCI-9112), then this function input data from channel 2, then channel 1, then channel 0,
                  then channel 2, then channel 1, ... The data acquired is put to Buffer by order. So the data read from channel 2 is
                  stored in Buffer[0], Buffer[3], Buffer[6], ... The data from channel 1 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-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-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-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). 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_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, ErrorLastChannelNotZero, ErrorDiffRangeNotSupport, ErrorChannelNotDescending, ErrorChannelNotAscending