Scans analog, digital, counter, and temperature input channels synchronously, and stores the samples in an array. This method only works with boards that support synchronous input.
Member of the MccBoard class.
VB .NET
Public Function DaqInScan(ByVal chanArray As Short(), ByVal chanTypeArray As MccDaq.ChannelType,ByVal gainArray as MccDaq.Range, ByVal chanCount As Integer, ByRef rate As Integer, ByRef pretrigCount As Integer, ByRef totalCount As Integer, ByVal memHandle As IntPtr, ByVal options MccDaq.ScanOptions) As MccDaq.ErrorInfo
C# .NET
public MccDaq.ErrorInfo DaqInScan(short[] chanArray, MccDaq.ChannelType[] chanTypeArray, MccDaq.Range[] gainArray, int chanCount, ref int rate, ref int pretrigCount, ref int totalCount, IntPtr memHandle, MccDaq.ScanOptions options)
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 DaqInScan(ByVal chanArray As Short( ), ByVal chanTypeArray As MccDaq.ChannelType,ByVal gainArray as MccDaq.Range, ByVal chanCount As Integer, ByRef rate As Integer, ByRef pretrigCount As Integer, ByRef totalCount As Integer, ByVal memHandle As Integer, ByVal options MccDaq.ScanOptions) As MccDaq.ErrorInfo
C# .NET
public MccDaq.ErrorInfo DaqInScan(short[] chanArray, MccDaq.ChannelType[] chanTypeArray, MccDaq.Range[] gainArray, int chanCount, ref int rate, ref int pretrigCount, ref int totalCount, int memHandle, MccDaq.ScanOptions options)
chanArray
Array containing channel values. Valid channel values are analog input channels, digital ports, counter input channels, and temperature input channels on the device.
chanTypeArray
Array containing channel types. Each element of this array defines the type of the corresponding element in the chanArray.
All of the chanTypeArray settings are MccDaq.ChannelType enumerated constants. Set it to one of the constants in the chanTypeArray parameter values section below.
gainArray
Array containing A/D range codes. If the corresponding element in the chanArray is not an analog input channel, the range code for this channel is ignored.
All of the gainArray settings are MccDaq.Range enumerated constants. Set to any range that is supported by the selected A/D board. Refer to the board-specific information in the Universal Library User's Guide for a list of the supported A/D ranges of each device.
chanCount
Number of elements in each of the three arrays - chanArray, chanTypeArray, and gainArray.
rate
The sample rate at which samples are acquired, in samples per second per channel. rate also returns the value of the actual rate set, which may be different from the requested rate because of pacer limitations.
pretrigCount
Sets the number of pre-trigger samples to collect. Specifies the number of samples to collect before the trigger occurs. This method won't run in pre-trigger mode if preTrigCount is set to zero. preTrigCount is ignored if the ExtTrigger option is not specified.
pretrigCount also returns the value of the actual pre-trigger count set, which may be different from the set pre-trigger count because pre-trigger count must be a multiple of the channel count (chanCount).
pretrigCount must be evenly divisible by the number of channels being scanned (chanCount). If it is not, this method adjusts the number (down) to the next valid value, and returns that value to the pretrigCount parameter.
totalCount
Total number of samples to collect. Specifies the total number of samples to collect and store in the buffer. totalCount must be greater than pretrigCount.
totalCount also returns the value of the actual total count set, which may be different from the requested total count, because total count must be a multiple of the channel count (chanCount).
totalCount must be evenly divisible by the number of channels being scanned (chanCount). If it is not, this method adjusts the number (down) to the next valid value, and returns that value to the totalCount parameter.
memHandle
Handle for the Windows buffer to store data. This buffer must have been previously allocated. For 16-bit data, create the buffer with WinBufAllocEx(). For data that is >16-bit and ≤32-bit, use WinBufAlloc32Ex(). For data that is >32-bit and ≤64-bit, use WinBufAlloc64Ex(). When using scaled data, use ScaledWinBufAllocEx().
options
Bit fields that control various options. All of the options settings are MccDaq.ScanOptions enumerated constants. This field may contain any combination of non-contradictory choices in the options parameter values section below.
Analog | Analog input channel. |
AnalogSE | Analog input channel, single-ended mode. |
ANALOGDiff | Analog input channel, differential mode. |
Digital | Digital port; not programmable. |
Digital8 | 8-bit digital input port. |
Digital16 | 16-bit digital input port. (FirstPortA only) |
PadZero | Placeholder channel; fills the corresponding data elements with zero. |
CJC | CJC channel. |
Ctr | Counter channel. |
Ctr16 | 16-bit counter. |
Ctr32Low | Lower 16-bits of a 32-bit counter. |
Ctr32High | Upper 16-bits of a 32-bit counter. |
CtrBank0 | Bank 0 of a counter. |
CtrBank1 | Bank 1 of a counter. |
CtrBank2 | Bank 2 of a counter. |
CtrBank3 | Bank 3 of a counter. |
SetpointStatus | The setpoint status register. This is a bit field indicating the state of each of the setpoints. A "1" indicates that the setpoint criteria has been met. |
TC | Thermocouple channel. The GetTCValues() method can be used to convert raw thermocouple data to data on a temperature scale (MccDaq.TempScale.Celsius, MccDaq.TempScale.Fahrenheit or MccDaq.TempScale.Kelvin). Note: If at least one TC channel is listed in the channel array, and averaging is enabled for that channel, the averaging will be applied to all of the channels listed in the channel array. |
SetpointEnable | Enables a setpoint. When this option is specified, it must be OR'ed with the ChanTypeArray parameter values. You set the setpoint criteria with the DaqSetSetpoints() method. The number of channels set with the SetpointEnable flag must match the number of setpoints set by the DaqSetSetpoints() method's setpointCount parameter. |
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 DaqInScan() method does not return to your program until all of the requested data has been collected and returned to the buffer. Use GetStatus() with DaqiFunction to check on the status of the background operation. Use StopBackground() with DaqiFunction to terminate the background process before it has completed. Execute StopBackground() after normal termination of all background functions in order to clear variables and flags. |
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 is probably not the best choice for transfer mode. The reason for this is that status for the operation is not available until one packet of data has been collected (typically 512 samples). The implication is that if 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 to use StopBackground() with DaqiFunction. Normally, this option should be used in combination with Background so that your program will regain control. |
ExtClock | If this option is used, 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. 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. |
ExtTrigger | If this option is specified, the sampling will not begin until the trigger condition is met (refer to the DaqSetTrigger() method). |
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). |
NoCalibrateData | Turns off real-time software calibration for boards which are software calibrated, by applying calibration factors to the data on a sample by sample basis as it is acquired.
Turning off software calibration saves CPU time during a high speed acquisition run, which may be required if your processor is less than a 150 MHz Pentium and you require an acquisition speed faster than 200 kHz. These numbers may not apply to your system. Only trial will tell for sure. DO NOT use this option if you do not have to. If this option is used, the data must be calibrated after the acquisition run with the ACalibrateData() method. |
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 SetAdRetrigCount() to set the trigger count. If you specify a trigger count that is either zero or greater than the value of the AInScan() 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. |
ScaleData | Converts raw scan data — to voltage, temperature, and so on, depending upon the selected channel sensor category — during the analog input scan, and puts the scaled data directly into the user buffer. The user buffer should have been allocated with ScaledWinBufAllocEx(). Results using ScaleData may be slightly different from results using ToEngUnits() near range limits, due to the nature of the calibration being applied and the internal calculation using floating count values. If this is undesirable use ToEngUnits(). |
SingleIo | A/D transfers to memory are initiated by an interrupt. One interrupt per conversion. Rates attainable using SingleIo are PC-dependent and generally less than 10 kHz. |