# a_out_scan

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.

## Prototype

a_out_scan(board_num, low_chan, high_chan, num_points, rate, ul_range, memhandle, options)

## Parameters

board_num (int)

The number associated with the board when it was installed with InstaCal or created with create_daq_device().

low_chan (int)

First D/A channel of scan.

high_chan (int)

Last D/A channel of scan.

num_points (int)

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, rate should be set to the D/A output rate (in scans/sec).

The actual sampling rate in some cases will vary a small amount from the requested rate. The actual rate is returned.

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.

ul_range (ULRange)

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

mem_handle (int)

Handle for the Windows buffer to store data. This buffer must have been previously allocated.

For 16-bit data, create the buffer with win_buf_alloc(). For data that is > 16-bit and ≤ 32-bit, use win_buf_alloc_32(). For data that is > 32-bit and ≤ 64-bit, use win_buf_alloc_64(). When using scaled data, use scaled_win_buf_alloc(). Load the data values with win_array_to_buf(), or scaled_win_array_to_buf() for scaled data.

When the device supports output scanning of scaled data, such as a_out_scan() using the SCALEDATA option, create the buffer with scaled_win_buf_alloc(). 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 (ScanOptions)

Flags that control various options. May contain any combination of non-contradictory choices in the options parameter values table below.

## Returns

- The actual rate set, which may be different from the requested rate because of pacer limitations. (int)

### Options parameter values

ADCCLOCK | Paces the data output operation using the ADC clock.
ADCCLOCKTRIG | Triggers a data output operation when the ADC clock starts.
BACKGROUND | This 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 get_status() with AOFUNCTION to check the status of background operation. Alternatively, some boards support enable_event() for event notification of changes in status of BACKGROUND scans. Use stop_background() with AOFUNCTION to terminate background operations before they are completed. stop_background() should be executed after normal termination of all background functions in order to clear variables and flags.
CONTINUOUS | This 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 stop_background() with AOFUNCTION. This option should only be used in combination with BACKGROUND so that your program can regain control.
EXTCLOCK | If 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. When this option is used the rate parameter 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.
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 set_trigger() and board-specific information 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 parameter above).
NONSTREAMEDIO | When 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.
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 stop_background() is called. You can specify the number of samples to generate with each trigger event. This is the trigger count. Use the set_config() 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 num_points parameter, the trigger count will be set to the value of num_points.
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 scaled_win_buf_alloc(). Results using SCALEDATA may be slightly different from results using from_eng_units() 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 from_eng_units().
SIMULTANEOUS | When 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 and sampling mode options.