beautypg.com

Measurement Computing Data Acquisition Systems rev.10.4 User Manual

Page 15

background image

User Buffer Model Operation

The User Buffer Model allows the user to specify either a linear buffer or circular buffer mode.

When the linear buffer mode is selected the driver will start filling the buffer from the

beginning of the buffer with the newest available scans. Once the entire buffer has been filled

to the number of scans specified the driver will stop writing scan data to the buffer even

though the acquisition may continue.

In the User Buffer Linear mode the driver will stop writing data to the user buffer once the

total number of scans requested has been satisfied. If the acquisition continues to run after

this point scan data will accumulate in the device FIFO until another buffer (or the same

buffer) transfer has been started or the device FIFO overruns. The implication of this is that

when using linear buffers it is important to make sure that a buffer transfer remains active

during the course of the acquisition or data loss may result. In other words, if the acquisition

continues past the end of the specified buffer another transfer (into the same or a different

buffer) must immediately be initiated. While it is possible to ping pong linear buffers in this

manner it is not the recommended. Linear buffers should normally be used only when a

predetermined number of scans are to be collected for the acquisition. In this case the buffer

scan length should be set to to be the same size as the aggregate scan size [of the total

acquisition]. For more information about starting transfers see Step 5.

The User Buffer Model also has a Circular Buffer Mode. In the circular buffer mode the driver

will continue to write scan data into the User Buffer until the acquisition terminates on its own

or is aborted by the user/application. Unlike the Linear Buffer model when the end of the user

buffer is reached the driver will continue to write scan data starting at the beginning of the

buffer.

When using the Circular Buffer mode the application does not need to make sure that there is

always a buffer ready to take the scan data because the driver simply continues to fill the

specified buffer and, when necessary, will begin writing data at the beginning of the buffer.

This model ensures that a device FIFO overrun never occurs because the driver always has

place to store the data (as long as the interface is capable of the required throughput). The

application is required to monitor the transfer and remove and/or process data as it becomes

available (See Step 7 on monitoring and receiving scan data). However a User Buffer overrun

may occur if the controlling application cannot keep up in processing or removing the data

from the buffer. Therefore the application should allocate a large enough buffer to alleviate

any processing or other latencies that may be present in the system or the application. If

making the buffer larger does not alleviate user buffer overrun problems then it may be

necessary to upgrade the PC to a higher performance unit. The type of upgrade required will

be highly dependent upon the nature of the application as well as operating environment in

general. For instance, if taking data to disk then a faster HD and controller may be required.

If mathematical manipulation of the data is taking place then a faster CPU may be in order. If

graphics or video are used intensively then the solution may be a higher performance video

card. It is important to remember that the application and other tasks within the system can

have an impact on the overall performance of the data acquisition process.

Programmer’s Manual

988594

API Programming, General Models 2-5