# DOutScan()

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

Member of the MccBoard class.

## Function Prototype

VB .NET

Public Function DOutScan(ByVal portType As MccDaq.DigitalPortType, ByVal count As Integer, ByRef rate As Integer, ByVal memHandle As IntPtr, ByVal options As MccDaq.ScanOptions) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo DOutScan(MccDaq.DigitalPortType portType, int count, ref int rate, IntPtr memHandle, MccDaq.ScanOptions options)

##### Deprecated methods

The following methods are deprecated, and should only be used for legacy applications. The methods above are preferred, and must be used for 64-bit application development.

VB .NET

Public Function DOutScan(ByVal portType As MccDaq.DigitalPortType, ByVal count As Integer, ByRef rate As Integer, ByVal memHandle As Integer, ByVal options As MccDaq.ScanOptions) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo DOutScan(MccDaq.DigitalPortType portType, int count, ref int rate, int memHandle, MccDaq.ScanOptions options)

## Parameters

portType

Specifies which digital I/O port to write (usually FirstPortA or FirstPortB). The specified port must be configured as an 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 WinBufAlloc().

options

Bit fields that control various options. Set it to one of the constants in the "options parameter values" section below.

## Returns

- An ErrorInfo object that indicates the status of the operation.
- rate – actual sampling rate.

### options parameter values

All of the options settings are MccDaq.ScanOptions enumerated constants. To set a variable to one of these constants, you must refer to the MccDaq object and the ScanOptions enumeration (for example, variable = MccDaq.ScanOptions.Background, variable = MccDaq.ScanOptions.Continuous, etc.).

ADCClock | Paces the data output operation using the ADC clock.
ADCClockTrig | Triggers a data output operation when the ADC clock starts.
Background | If the Background option is not used, the DOutScan() method will not return control to your program until all of the requested data has been output. When the Background option is used, control will return immediately to the next line in your program and the transfer to the digital output port from memHandle will continue in the background. Use GetStatus() with DoFunction to check on the status of the background operation. Use StopBackground() with DoFunction to terminate the background process before it has completed.
Continuous | This option puts the method 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 by calling StopBackground() with DoFunction. Normally this option should be used in combination with Background so that your program will regain control.
DwordXfer | Normally 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.
EXTCLOCK | When 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 parameter 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 parameter to an approximate maximum value.
NonStreamedIO | When 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 must be less than or equal to 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.
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 samples in the scan for each trigger event – this is the trigger count (retrigCount). The RetrigMode option can be used with the Continuous option to continue arming the trigger until StopBackground() is called. You specify the trigger count with SetDoRetrigCount(). If you specify a trigger count that is either zero or greater than the value of the DOutScan() 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 the number of samples set by the count parameter, re-arm the trigger, and refill the buffer upon the next trigger.
WordXfer | Normally this method writes a single (byte) 8-bit port. If 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

- MccDaq.ScanOptions.ByteXfer is the default option. Make sure you are using an array when your data is arranged in bytes. Use the MccDaq.ScanOptions.WordXfer option for word array transfers.
- NonStreamedIO can only be used with the number of samples (count) set equal to the size of the FIFO or less.
- Transfer Method may not be specified. DMA is used.