cbAOutScan()

Outputs values to a range of D/A channels. This function can be used for paced analog output on hardware that supports paced output. It can also be used to update all analog outputs at the same time when the SIMULTANEOUS option is used.

Function Prototype

C/C++

int cbAOutScan(int BoardNum, int LowChan, int HighChan, long NumPoints, long *Rate, int Range, int MemHandle, int Options)

Visual Basic

Function cbAOutScan(ByVal BoardNum&, ByVal LowChan&, ByVal HighChan&, ByVal NumPoints&, Rate&, ByVal Range&, 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.

LowChan

First D/A channel of scan.

HighChan

Last D/A channel of scan.

LowChan/HighChan: The maximum allowable channel depends on which type of D/A board is being used.

NumPoints

Number of D/A values to output. Specifies the total number of D/A values that will be output. Most D/A boards do not support timed outputs. For these boards, set the count to the number of channels in the scan.

Rate

Sample rate in scans per second. For many D/A boards the Rate is ignored and can be set to NOTUSED. For D/A boards with trigger and transfer methods which allow fast output rates, such as the CIO-DAC04/12-HS, Rate should be set to the D/A output rate (in scans/sec). This argument returns the value of the actual rate set. This value may be different from the user specified rate due to pacer limitations.

If supported, this is the rate at which scans are triggered. If you are updating 4 channels, 0-3, then specifying a rate of 10,000 scans per second (10 kHz) will result in the D/A converter rates of 10 kHz (one D/A per channel). The data transfer rate is 40,000 words per second; 4 channels * 10,000 updates per scan.

The maximum update rate depends on the D/A board that is being used. It is also dependent on the sampling mode options.

Range

D/A range code. The output range of the D/A channel can be set to any of those supported by the board. If the D/A board does not have a programmable gain, this argument is ignored.

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).

When the device supports output scanning of scaled data, such as cbAOutScan() using the SCALEDATA option, create the buffer with cbScaledWinBufAlloc(). See hardware-specific information to determine if the device supports scaled data.

Note: when scanning to multiple channels, the data must be interleaved into a 1-D array.

Options

Bit fields that control various options. This field may contain any combination of non-contradictory choices from the values listed 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.
BACKGROUNDThis option may only be used with boards which support interrupt, DMA or REP-INSW transfer methods. When this option is used the D/A operations will begin running in the background and control will immediately return to the next line of your program. Use cbGetStatus() with AOFUNCTION to check the status of background operation. Alternatively, some boards support cbEnableEvent() for event notification of changes in status of BACKGROUND scans. Use cbStopBackground() with AOFUNCTION to terminate background operations before they are completed. cbStopBackground() should be executed after normal termination of all background functions in order to clear variables and flags.
CONTINUOUSThis option may only be used with boards which support interrupt, DMA or REP INSW transfer methods. This option puts the method in an endless loop.

Once it outputs the specified number (NumPoints) of D/A values, it resets to the start of the buffer and begins again. The only way to stop this operation is by calling cbStopBackground() with AOFUNCTION. This option should only be used in combination with BACKGROUND so that your program can regain control.
EXTCLOCKIf this option is specified, 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 (refer to board-specific information contained in the Universal Library Users Guide).

When this option is used the Rate argument is ignored. The sampling rate is dependent on the clock signal. Options for the board default to transfer types that allow the maximum conversion rate to be attained unless otherwise specified.
EXTTRIGGERIf 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).
HIGHRESRATEAcquires 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).
NONSTREAMEDIOWhen this option is used, you can output non-streamed data to a specific DAC output channel. The aggregate size of the data output buffer must be less than or equal to the size of the internal data output FIFO in the 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. 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.

NONSTREAMEDIO can only be used with the number of samples (Count) set equal to the size of the FIFO or less.
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 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.
SCALEDATAGets 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().
SIMULTANEOUSWhen this option is used (if the board supports it and the appropriate switches are set on the board) 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.

Caution!

You will generate an error if you specify a total D/A rate beyond the capability of the board. The maximum update rate depends on the D/A board that is being used and on the sampling mode options.