Performs multiple reads of a digital input port on a device with a pacer clock.
Member of the MccBoard class.
VB .NET
Public Function DInScan(ByVal portType As MccDaq.DigitalPortType, 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 DInScan(MccDaq.DigitalPortType portType, int numPoints, ref int rate, 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 DInScan(ByVal portType As MccDaq.DigitalPortType, 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 DInScan(MccDaq.DigitalPortType portType, int numPoints,ref int rate, int memHandle, MccDaq.ScanOptions options)
Specifies which digital I/O port to read (usually FirstPortA or FirstPortB). The specified port must be configured as an input.
numPoints
The number of times to read the digital input.
rate
Number of times per second (Hz) to read the port. The actual sampling rate in some cases will vary a small amount from the requested rate. The actual rate is returned.
memHandle
Handle for the Windows buffer to store data. This buffer must have been previously allocated with WinBufAllocEx() or WinBufAlloc32Ex().
options
Bit fields that control various options. Set it to one of the constants in the "options parameter values" section below.
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.Background, variable = MccDaq.ScanOptions.Continuous, etc.).
Background | If the Background option is not used, the DInScan() method will not return to your program until all of the requested data has been collected and returned to memHandle. When the Background option is used, control will return immediately to the next line in your program and the transfer from the digital input port to memHandle will continue in the background. Use GetStatus() with DiFunction to check on the status of the background operation. Use StopBackground() with DiFunction to terminate the background process before it has completed. |
BlockIo | Data 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 method in an endless loop. Once it transfers the required number of bytes it resets to the start of the buffer and begins again. The only way to stop this operation is by calling StopBackground() with DiFunction. Normally this option should be used in combination with Background so that your program will regain control. |
DwordXfer | Normally this function reads a single (byte) 16-bit port. When DwordXfer is specified, this function reads two adjacent 16-bit ports at a time, and stores the value of both ports together as the low and high byte of a single array element in the buffer. It is usually required to set portType to AuxPort0. |
ExtClock | If this option is used then transfers will be controlled by the signal on the trigger input line rather than by the internal pacer clock. Each transfer will be triggered on the appropriate edge of the trigger input signal (refer to board-specific information in the Universal Library User's Guide). When this option is used, the rate parameter is ignored. The transfer rate is dependent on the trigger signal. |
ExtTrigger | If this option is used then the scan will not begin until the signal on the trigger input line meets the trigger criteria. |
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). |
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 - this is the trigger count (retrigCount). The RetrigMode option can be used with the Continuous option to continue arming the trigger until StopBackground() is called.
You specify the trigger count with SetDiRetrigCount(). If you specify a trigger count that is either zero or greater than the value of the DInScan() numPoints parameter, the trigger count is set to the value of the numPoints parameter. 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 | Data is transferred to memory one sample at a time. Rates attainable using SingleIo are PC-dependent, and generally less than 4 kHz. |
WordXfer | Normally this function reads a single (byte) 8-bit port. When WORDXFER is specified, this function reads two adjacent 8-bit ports at a time, and stores the value of both ports together as the low and high byte of a single array element in the buffer. It is usually required to set portType to FIRSTPORTA. |