Non-Trigger Mode Async. Input - Double-buffered AI/DI Operation | ![]() ![]() ![]() ![]() |
Non-Trigger Mode Asynchronous Input Programming Hints :
Double-buffered AI/DI Operation
Double Buffer Mode Principle
The data buffer for double-buffered
DMA input operation is a circular buffer logically. It logically divided
into two equal halves. The double-buffered input begins when device starts
writing data into the first half of the circular buffer (Figure B-1a).
After device begins writing to the second half of the circular buffer,
you can copy the data from the first half into the transfer buffer (user
buffer) (Figure B-1b). You now can process the data in the transfer buffer
according to application needs. After the board has filled the second half
of the circular buffer, the board returns to the first half buffer and
overwrites the old data. You now can copy the second half of the circular
buffer to the transfer buffer (Figure B-1c). The data in the transfer buffer
is again available for process. The process can be repeated endlessly to
provide a continuous stream of data to your application (Figure B-1d).
Figure B-1
The PCIS-DASK double buffer mode
functions were designed according to the principle described above. If
you use AI_AsyncDblBufferMode/DI_AsyncDblBufferMode to enable double
buffer mode, the following continuous AI/DI function will perform double-buffered
DMA AI/DI. You can call AI_AsyncDblBufferHalfReady/DI_AsyncDblBufferHalfReady
to check if data in the circular buffer is half full and ready for copying
to the transfer buffer. Then you can call AI_AsyncDblBufferTransfer/DI_AsyncDblBufferTransfer
to copy data from the ready half buffer to the transfer buffer.