Function Syntax

RETURN_CODE AlazarBeforeAsyncRead(HANDLE handle, U32 channelSelect, long transferOffset, U32 transferLength, U32 recordsPerBuffer, U32 recordsPerAcquisition, U32 flags)

Configure a board to make an asynchronous AutoDMA acquisition.

In non-DSP mode, when record headers are not enabled, the total number of bytes per AutoDMA buffer is given by:

bytesPerBuffer = bytesPerSample * samplesPerRecord * recordsPerBuffer;

When record headers are enabled, the formula changes to:

bytesPerBuffer = (16 + bytesPerSample * samplesPerRecord) *

For best performance, AutoDMA parameters should be selected so that the total number of bytes per buffer is greater than about 1 MB. This allows for relatively long DMA transfer times compared to the time required to prepare a buffer for DMA transfer and re-arm the DMA engines.

ATS460, ATS660 and ATS860 digitizer boards require that AutoDMA parameters be selected so that the total number of bytes per buffer is less than 4 MB. Other boards require that the total number of bytes per buffer be less than 64 MB. It is however recommended to keep the DMA buffer size below 16 MB for all boards.


ApiSuccess upon success, or an error code. See RETURN_CODE for more detailed information.


transferLength must meet certain alignment criteria which depend on the board model and the acquisition type. Please refer to board-specific documentation for more information.


recordsPerBuffer must be set to 1 in continuous streaming and triggered streaming AutoDMA modes.


recordsPerAcquisition must be 0x7FFFFFFF in Continuous Streaming and Triggered Streaming modes. The acquisition runs continuously until AlazarAbortAsyncRead() is called. In other modes, it must be either:

  • A multiple of recordsPerBuffer

  • 0x7FFFFFFF to indicate that the acquisition should continue indefinitely.

  • [in] handle: Handle to board

  • [in] channelSelect: Select the channel(s) to control. This can be one or more of the channels of ALAZAR_CHANNELS, assembled with the OR bitwise operator.

  • [in] transferOffset: Specify the first sample from each on-board record to transfer from on-board to host memory. This value is a sample relative to the trigger position in an on-board record.

  • [in] transferLength: Specify the number of samples from each record to transfer from on-board to host memory. In DSP-mode, it takes the number of bytes instead of samples. See remarks.

  • [in] recordsPerBuffer: The number of records in each buffer. See remarks.

  • [in] recordsPerAcquisition: The number of records to acquire during one acquisition. Set this value to 0x7FFFFFFF to acquire indefinitely until the acquisition is aborted. This parameter is ignored in Triggered Streaming and Continuous Streaming modes. See remarks.

  • [in] flags: Specifies AutoDMA mode and option. Must be one element of ALAZAR_ADMA_MODES combined with zero or more element(s) of ALAZAR_ADMA_FLAGS using the bitwise OR operator.

LabVIEW Block Diagram