Foreground-circular transfers, Background-linear transfers – Measurement Computing WaveBook rev.3.0 User Manual

Page 154

Advertising
background image

8-20 Theory of Operation,

6-24-99

WaveBook User’s Manual

Foreground-Circular Transfers

Cycle mode is used in foreground transfers to collect only the last buffer-full of data. When the
daqAdcTransferBufData

command returns, the application program can access only the last scans

that fit in the buffer. For example, if the buffer can hold 100 scans, the foreground circular transfer will
complete with the buffer holding the last-acquired 100 scans (assuming at least 100 scans were acquired).
This type of transfer is most often used in pre/post-trigger acquisitions. In pre/post-trigger acquisitions, the
number of scans acquired depends on the timing of the trigger but is at least the total of the specified
number of pre-trigger and post-trigger scans. By using a buffer just large enough to hold those scans, the
buffer will hold only the scans of interest when the acquisition completes.

Foreground-circular transfers may also be used in the N-shot acquisition mode to capture the scans that
occur sometime after the trigger. For example, if the acquisition were configured for 1000 scans after the
trigger, and the buffer held only 60 scans, then, after the acquisition, the buffer would hold just scans 941
through 1000, and the preceding scans would have been overwritten. Foreground-circular transfers may
also be used for direct-to-disk acquisition, as discussed at the end of this chapter.

When a circular buffer is used with any acquisition mode, the scans are generally out of chronological order
at the completion of an acquisition. As discussed above, daqAdcBufferRotate can arrange the buffer
into its natural order from oldest to newest (first to last).

Note:

The foreground-circular transfer should never be used with the infinite acquisition modes (N-shot
with re-arm and infinite post-trigger) because the acquisition would never complete. So,
daqAdcTransferBufData

would never return, and the application program would be stuck

acquiring data until a time-out error occurs.

Background-Linear Transfers

Background transfer into a linear buffer is similar to foreground transfer, but with the advantage that the
application program continues execution during data transfer. This allows the application program to
process one buffer while another is being acquired. While the practical amount of processing depends
strongly on the PC performance and the total sample rate, the background mode makes multiple buffer
acquisitions more feasible.

Typically, a long acquisition is transferred using background-linear transfer into two buffers (A and B) in an
alternating, ping-pong fashion. This transfer type is useful when the amount of data to be processed
exceeds the available buffer space. Background-linear transfer may be appropriate with any of the
acquisition modes: N-shot (when N is large), N-shot with re-arm, infinite post-trigger, and pre/post-trigger.

In this way, an infinite amount of data can be processed with
two data buffers. As each buffer is filled it may be unpacked, if
necessary, with daqCvtRawDataFormat before further
processing. A ping-pong transfer can be implemented with the
following procedure (see figure):
1. Initialize. The acquisition is configured and started;

daqAdcTransferBufData

is invoked to transfer the

data into Buffer A.

2. Wait for A. The program waits until Buffer A is full using

daqAdcTransferGetStat

.

3. Start B. The program uses daqAdcTransferBufData

to start transferring data into Buffer B.

4. Process A. The contents of Buffer A are processed

(analyzed and/or stored).

5. Wait for B. The program waits until Buffer B is full using

daqAdcTransferGetStat

. If the transfer is done,

then Buffer B should be processed and the procedure is
complete.

6. Start A. The program uses daqAdcTransferBufData

to start transferring data into Buffer A.

7. Process B. The content of Buffer B is processed (analyzed

and/or stored). The program then repeats these steps
starting with Wait for A until the entire acquisition has been
processed.

Processed

(empty)

Processed

Processed

Processed

(empty)

Filling

Filling

Filling

Filling

Filling

Empty

Full

Full

Full

Full

Processed

(empty)

Processed

(empty)

After Initialize

After Wait for A

After Start B

After Process A

After Wait B

After Start A

After Process B

After Final
Process B

Buffer A

Buffer B

When Done

Advertising