Performs multiple reads of a digital input port on a device with a pacer clock.
d_in_scan(board_num, port_type, count, rate, memhandle, options)
board_num (int)
The number associated with the board when it was installed with InstaCal or created with create_daq_device().
port_type (DigitalPortType)
The digital port to read, usually DigitalPortType.FIRSTPORTA or DigitalPortType.FIRSTPORTB.
count (int)
The number of times to read the digital port.
rate (int)
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 (int)
Handle for the Windows buffer to store data. This buffer must have been previously allocated with win_buf_alloc() or win_buf_alloc_32().
options (ScanOptions)
Flags that control various options. Refer to the constants in the options parameter values section below.
BACKGROUND | If the BACKGROUND option is not used, the d_in_scan() 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 returns immediately to the next line in your program and the transfer from the digital input port to MemHandle will continue in the background. Use get_status() with DIFUNCTION to check on the status of the background operation. Use stop_background() 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 function in an endless loop. Once it transfers the required number of bytes it resets to the start of DataBuffer and begins again. The only way to stop this operation is with stop_background() 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 port_type 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. 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 digital input samples to acquire per trigger - this is the trigger count. The RETRIGMODE option can be used with the CONTINUOUS option to continue arming the trigger until stop_background() is called. You specify the trigger count with the set_config() ConfigItem option DITRIGCOUNT. If you specify a trigger count that is either zero or greater than the value of the count parameter, the trigger count is set to the value of the count parameter. Specify the CONTINUOUS option with the trigger count set to zero to fill the buffer with count 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. |