cbCInScan()

Scans a range of counter channels, and stores the samples in an array.

Function Prototype

C/C++

int cbCInScan(int BoardNum, int FirstCtr, int LastCtr, long Count, long *Rate, int MemHandle, int Options)

Visual Basic

Function cbCInScan(ByVal BoardNum&, ByVal FirstCtr&, ByVal LastCtr&, ByVal Count&, Rate&, ByVal MemHandle&, ByVal Options&) As Long

Arguments

BoardNum

The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99. The specified board must have a counter with scan capability.

FirstCtr

First counter channel of the scan. This argument is zero-based, so the first counter number is "0".

LastCtr

Last counter channel of the scan. This argument is zero-based, so the first counter number is "0".

The maximum allowable channel for both FirstCtr and LastCtr depends on how many scan counters are available on the Measurement Computing device in use.

Count

The total number of counter samples to collect. If more than one channel is being sampled then the number of samples collected per channel is equal to Count / (LastCtr – FirstCtr + 1).

Rate

The rate at which samples are taken in samples per second.

Rate also returns the value of the actual rate set, which may be different from the requested rate because of pacer limitations.

MemHandle

The handle for the Windows buffer to store data. This buffer must have been previously allocated with the cbWinBufAlloc32() function.

Options

Bit fields that control various options. This field may contain any combination of non-contradictory choices in the "Options argument values" section below.

Returns

Options argument values

BACKGROUNDWhen the BACKGROUND option is used, control returns immediately to the next line in your program and the data collection from the counters into the buffer continues in the background. If the BACKGROUND option is not used, the cbCInScan() function does not return to your program until all of the requested data has been collected and returned to the buffer.

Use cbGetStatus() with CTRFUNCTION to check on the status of the background operation. Use cbStopBackground() with CTRFUNCTION to terminate the background process before it has completed. Execute cbStopBackground() after normal termination of all background functions in order to clear variables and flags.
BLOCKIOA/D transfers are handled in blocks (by REP-INSW for example). BLOCKIO is not recommended for slow acquisition rates. If the rate of acquisition is very slow (for example less than 200 Hz) BLOCKIO may not be the best transfer mode, as the operation status is not available until one packet of data is collected (typically 512 samples). For example, when acquiring 100 samples at 100 Hz using BLOCKIO, the operation will not complete until 5.12 seconds has elapsed.
CONTINUOUSThis option puts the function in an endless loop. Once it collects the required number of samples, it resets to the start of the buffer and begins again. The only way to stop this operation is by using cbStopBackground() with CTRFUNCTION. Normally, you should use this option with BACKGROUND so that your program regains control.
CTR16BITSets the counter resolution to 16-bits. When using devices that return data in a 16-bit format, create the buffer using cbWinBufAlloc().
CTR32BITSets the counter resolution to 32-bits. When using devices that return data in a 32-bit format, create the buffer using cbWinBufAlloc32().
CTR48BITSets the counter resolution to 48-bits. When using devices that return data in a 64-bit format, create the buffer using cbWinBufAlloc64().
CTR64BITSets the counter resolution to 64-bits. When using devices that return data in a 64-bit format, create the buffer using cbWinBufAlloc64().
Note: this option is not available when using Visual Basic.
EXTCLOCKIf this option is specified, conversions will be controlled by the signal on the external clock input rather than by the internal pacer clock. Each conversion will be triggered on the appropriate edge of the clock input signal (refer to board-specific information in the UL User's Guide). When this option is used the Rate argument is ignored. The sampling rate is dependent on the clock signal. Options for the board will default to a transfer mode that will allow the maximum conversion rate to be attained unless otherwise specified.
EXTTRIGGERIf this option is specified, sampling does not begin until the trigger condition is met. You can set the trigger condition to rising edge, falling edge, or the level of the digital trigger input with the cbSetTrigger() function. Refer to board-specific information in the UL User's Guide.
HIGHRESRATEAcquires data at a high resolution rate. When specified, the rate at which samples are acquired is in "samples per 1000 seconds per channel". When this option is not specified, the rate at which samples are acquired is in "samples per second per channel" (refer to the Rate argument above).
NOCLEARDisables the clearing of counters when the scan starts.
RETRIGMODERe-arms the trigger after a trigger event is performed. With this mode, the scan begins when a trigger event occurs. When the scan completes, the trigger is re-armed to acquire the next the batch of data. You can specify the number of samples in the scan for each trigger event (described below). The RETRIGMODE option can be used with the CONTINUOUS option to continue arming the trigger until cbStopBackground() is called.

You can specify the number of samples to acquire with each trigger event. This is the trigger count (retrigCount). Use the cbSetConfig() ConfigItem option BICTRTRIGCOUNT to set the trigger count. If you specify a trigger count that is either zero or greater than the value of the cbCInScan() Count argument, the trigger count is set to the value of Count.

Specify the CONTINUOUS option with the trigger count set to zero to fill the buffer with numPoints samples, re-arm the trigger, and refill the buffer upon the next trigger.
SINGLEIOA/D data is transferred to memory one sample at a time. Rates attainable using SINGLEIO are PC-dependent and generally less than 4 kHz.