# cbDaqOutScan()

Outputs values synchronously to analog output channels and digital output ports. This function only works with boards that support synchronous output.

## Function Prototype

C/C++

int cbDaqOutScan(int BoardNum, short ChanArray[], short ChanTypeArray[], short GainArray[], int ChanCount, long* Rate, long Count, int MemHandle, int Options);

Visual Basic

Function cbDaqOutScan(ByVal BoardNum&, ChanArray%, ChanTypeArray%, GainArray%, ByVal ChanCount&, CBRate&, ByVal CBCount&, 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. The board must support synchronous output.

ChanArray

Array containing channel values. Valid channel values are analog output channels and digital ports.

ChanTypeArray

Array containing channel types. Each element of this array defines the type of the corresponding element in the ChanArray. Set to one of the constants in the "ChanTypeArray argument values" section below.

GainArray

Array containing D/A range codes. If the corresponding element in the ChanArray is not an analog output channel, the range code for this channel is ignored. If the board does not have programmable gain, this parameter is ignored, and therefore can be set to null.

ChanCount

Number of elements in each of the three arrays - ChanArray, ChanTypeArray, and GainArray.

Rate

Sample rate in scans per second. Rate also returns the value of the actual rate set, which may be different from the requested rate because of pacer limitations.

Count

Sets the total number of values to output. Count also returns the value of the actual count set, which may be different from the requested total count because count must be a multiple of the channel count.

MemHandle

Handle for the Windows buffer from which data is output. This buffer must have been previously allocated and data values loaded.
For 16-bit data, create the buffer with cbWinBufAlloc(). For data that is >16-bit and ≤32-bit, use cbWinBufAlloc32(). For data that is >32-bit and ≤64-bit, use cbWinBufAlloc64(). When using scaled data, use cbScaledWinBufAlloc(). You can load the data values with cbWinArrayToBuf() or cbScaledWinArrayToBuf() (for scaled data).

Options

Bit fields that control various options. This field may contain any combination of non-contradictory choices in the "Options argument values" section below.

## Returns

- Error code or 0 if no errors
- Rate – Actual sampling rate used.

### ChanTypeArray argument values

ANALOG | Analog output channel.
DIGITAL16 | 16-bit digital output port. (FIRSTPORTA only)

### Options argument values

ADCCLOCK | When this option is used, the data output operation will be paced by the ADC clock.
ADCCLOCKTRIG | If this option is used, the data output operation will be triggered upon the start of the ADC clock.
BACKGROUND | When this option is used, the output operations will begin running in the background and control will immediately return to the next line of your program. Use cbGetStatus() with the DAQOFUNCTION option to check the status of background operation. Use the cbStopBackground() function with the DAQOFUNCTION option to terminate background operations before they are completed. Execute cbStopBackground() with DAQOFUNCTION after normal termination of all background functions in order to clear variables and flags.
CONTINUOUS | This option puts the function in an endless loop. Once it outputs the specified number (Count) of output values, it resets to the start of the buffer and begins again. The only way to stop this operation is by calling cbStopBackground() with DAQOFUNCTION. This option should only be used in combination with BACKGROUND so that your program can regain control.
EXTCLOCK | If this option is used, conversions will be paced 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 transfer types that 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. On many boards, this trigger condition is programmable (refer to the cbSetTrigger() function and board-specific information contained in the Universal Library Users Guide for details).
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 argument 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 cbACalibrateData().
NONSTREAMEDIO | This option allows non-streamed data output to be generated to a specified output channel. In this mode, the aggregate size of data output buffer must be less than or equal to the size of the internal data output FIFO on the Measurement Computing device. This allows the data output buffer to be loaded into the device's internal output FIFO. Once the sample updates are transferred (or downloaded) to the device, the device is responsible for outputting the data. While the size is limited, and the output buffer cannot be changed once the output is started, this mode has the advantage being able to continue data output without having to periodically feed output data through the program to the device.
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 generate the next the batch of data. You can specify the number of samples to generate for each trigger event (described below). The RETRIGMODE option can be used with the CONTINUOUS option to continue arming the trigger until cbStopBackground() is called. You can specify the number of samples to generate with each trigger event. This is the trigger count. Use the cbSetConfig() ConfigItem option BIDACTRIGCOUNT to set the trigger count. If you specify a trigger count that is either zero or greater than the value of the NumPoints argument, the trigger count will be set to the value of NumPoints.
SCALEDATA | Gets scaled data, such as voltage, temperature, and so on, from the user buffer, and converts it to raw data. The user buffer should have been allocated with cbScaledWinBufAlloc(). Results using SCALEDATA may be slightly different from results using cbFromEngUnits() 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 cbFromEngUnits().
SIMULTANEOUS | When this option is used, all of the D/A voltages will be updated simultaneously when the last D/A in the scan is updated. This generally means that all the D/A values will be written to the board, then a read of a D/A address causes all D/As to be updated with new values simultaneously.