beautypg.com

Measurement Computing Data Acquisition Systems rev.10.4 User Manual

Page 18

background image

Monitoring User Buffer Model Transfers

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 of size

n (scans) with the newest available scans. Once the entire

buffer has been filled to the number of scans specified by

n the driver will stop writing scan

data to the buffer even though the acquisition may continue.

For monitoring progress into a linear User Buffer, the retCount parameter will return the

current location (in scans) of the write pointer. This location indicates the next scan to be

written as well as representing the total number of scans acquired thus far. For instance, if

retCount =

m then scan0 through scanm-1 can be processed.

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.

2-8 API Programming, General Models

988594

Programmer’s

Manual