# CInScan()

Scans a range of counter channels, and stores the samples in an array. This method only works with counter boards that have counter scan capability.

Member of the MccBoard class.

## Function Prototype

VB .NET

Public Function CInScan(ByVal firstCtr As Integer, ByVal lastCtr As Integer, ByVal numPoints As Integer, ByRef rate As Integer, ByVal memHandle As IntPtr, ByVal options As MccDaq.ScanOptions) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo CInScan(int firstCtr, int lastCtr, int numPoints, ref int rate, IntPtr memHandle, MccDaq.ScanOptions Options)

##### Deprecated methods

The following methods are deprecated, and should only be used for legacy applications. The methods above are preferred, and must be used for 64-bit application development.

VB .NET

Public Function CInScan(ByVal firstCtr As Integer, ByVal lastCtr As Integer, ByVal numPoints As Integer, ByRef rate As Integer, ByVal memHandle As Integer, ByVal options As MccDaq.ScanOptions) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo CInScan(int firstCtr, int lastCtr, int numPoints, int rate, int memHandle, MccDaq.ScanOptions options)

## Parameters

firstCtr

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

lastCtr

Last counter channel of the scan. This parameter 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.

numPoints

Number of counter samples to collect. Specifies the total number of counter samples that will be collected. If more than one channel is being sampled then the number of samples collected per channel is equal to Count / (firstCtr – lastCtr + 1).

rate

The rate at which samples are taken – the counts are latched and saved in board memory, 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 (Windows). This buffer must have been previously allocated with the WinBufAlloc32Ex() method.

options

Bit fields that control various options. All of the option settings are MccDaq.ScanOptions enumerated constants. Set it to one of the constants in the "options parameter values" section below.

## Returns

- Error code or 0 if no errors
- rate – the actual sampling rate used.
- memHandle – the collected counter data returned via the Windows buffer.

### options parameter values

All of the options settings are MccDaq.ScanOptions enumerated constants. To set a variable to one of these constants, you must refer to the MccDaq object and the ScanOptions enumeration (for example, variable = MccDaq.ScanOptions.Continuous, variable = MccDaq.ScanOptions.Background, etc.).

Background | When 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 CInScan() method does not return to your program until all of the requested data has been collected and returned to the buffer.
BlockIo | A/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.
Continuous | This 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 StopBackground() with CtrFunction. Normally, you should use this option with Background so that your program regains control.
Ctr16Bit | Sets the counter resolution to 16-bits. When using devices that return data in a 16-bit format, create the buffer using WinBufAllocEx().
Ctr32Bit | Sets the counter resolution to 32-bits. When using devices that return data in a 32-bit format, create the buffer using WinBufAlloc32Ex().
Ctr48Bit | Sets the counter resolution to 48-bits. When using devices that return data in a 64-bit format, create the buffer using WinBufAlloc64Ex().
Ctr64Bit | Sets the counter resolution to 64-bits. When using devices that return data in a 64-bit format, create the buffer using WinBufAlloc64Ex().
ExtClock | If 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 parameter 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.
ExtTrigger | If 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 SetTrigger() method. Refer to board-specific information in the UL User's Guide.
HighResRate | Acquires 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 parameter above).
NoClear | Disables the clearing of counters when the scan starts.
RetrigMode | Re-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 StopBackground() is called. You can specify the number of samples to acquire with each trigger event. This is the trigger count (retrigCount). Use SetCtrRetrigCount() to set the trigger count. If you specify a trigger count that is either zero or greater than the value of the CInScan() numPoints parameter, the trigger count is set to the value of numPoints. 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.
SingleIo | A/D data is transferred to memory one sample at a time. Rates attainable using SingleIo are PC-dependent and generally less than 4 kHz.