cbDOutScan()

Writes a series of bytes or words to the digital output port on a board with a pacer clock.

Function Prototype

C/C++

int cbDOutScan(int BoardNum, int PortType, long Count, long *Rate, int MemHandle, int Options)

Visual Basic

Function cbDOutScan(ByVal BoardNum&, ByVal PortType&, 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.

PortType

Specifies which digital I/O port to write to(usually FIRSTPORTA or FIRSTPORTB). The port must be configured for output.

Count

The number of times to write the digital output.

Rate

Number of times per second (Hz) to write to the port. The actual update 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 cbWinBufAlloc().

Options

Bit fields that control various options. Refer to the constants in the "Options argument values" section below.

Returns

Options argument values

ADCCLOCKPaces the data output operation using the ADC clock.
ADCCLOCKTRIGTriggers a data output operation when the ADC clock starts.
BACKGROUNDIf the BACKGROUND option is not used, then the cbDOutScan() function will not return control to your program until all of the requested data has been output.

When the BACKGROUND option is used, control returns immediately to the next line in your program and the transfer to the digital output port from MemHandle will continue in the background. Use cbGetStatus() with DOFUNCTION to check on the status of the background operation. Use cbStopBackground() with DOFUNCTION to terminate the background process before it has completed.
CONTINUOUSThis option puts the function 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 with cbStopBackground() with DOFUNCTION. Normally this option should be used in combination with BACKGROUND so that your program will regain control.
DWORDXFERNormally this function writes to a single (byte) 16-bit port. When DWORDXFER is specified, it writes to two adjacent 16-bit ports at a time as the low and high byte of a single array element in the buffer. It is usually required to set PortType to AUXPORT0.
EXTCLOCKWhen this option is used, transfers are controlled by the signal on the external clock input rather than by the internal pacer clock. Each transfer will be triggered on the appropriate edge of the clock input signal (refer to board-specific information contained in the UL Users Guide).

When this option is used, the Rate argument is used for reference only. The transfer rate is dependent on the clock signal. An approximation of the external clock rate is used to determine the size of the packets to transfer from the board. Set the Rate argument to an approximate maximum value.
NONSTREAMEDIOWhen this option is used, you can output non-streamed data to a specific DAC output channel.

To load the data output buffer into the device's internal output FIFO, the aggregate size of the data output buffer must be ≤ the size of the internal data output FIFO in the device. Once the sample data are transferred or downloaded to the device, the device is responsible for outputting the data. You can't make any changes to the output buffer once the output begins.

With NONSTREAMEDIO mode, you do not have to periodically feed output data through the program to the device for the data output to continue. However, the size of the buffer is limited.
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 digital output samples to generate per trigger - this is the trigger count. The RETRIGMODE option can be used with the CONTINUOUS option to continue arming the trigger until cbStopBackground() is called.

You specify the trigger count with the cbSetConfig() ConfigItem option BIDOTRIGCOUNT. If you specify a trigger count that is either zero or greater than the value of the cbDInScan() Count argument, the trigger count is set to the value of the Count argument.

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.
WORDXFERNormally this function writes to a single (byte) 8-bit port. When WORDXFER is specified, it writes to two adjacent 8-bit ports as the low and high byte of a single array element in the buffer. When WORDXFER is used, it is generally required to set PortType to FIRSTPORTA.

Notes