beautypg.com

Models – Measurement Computing Data Acquisition Systems rev.10.4 User Manual

Page 19

background image

Monitoring and Receiving Driver Buffer Model Data

The Driver Buffer Model allows the flexibility of the User Buffer Model in Circular mode without

the complication of having to manage the circular buffer at the application level. In fact, the

Buffer Model is simply a special case of the circular buffer mode in that the driver handles the

details of managing the circular buffer and “hands off” scan data to the application only when

the application requests it. The scan data is handed off to the application in easy to use and

manipulate linear buffers. Once handed off the data is removed from the Driver Buffer

permanently. In other words requesting data from the Driver Buffer is a destructive read

operation.

Upon request the Driver Buffer Model allows the application to request data from the internal

Driver Buffer as follows:

Return Scan Data Available Returns any unread scan data that is available in the

Driver Buffer up to the requested amount. The application must ensure that it has

enough space in the User Request Buffer to store any amount of unread scan data that

may be present in the Driver Buffer up to the amount requested.

Wait Until the Requested Amount is Available Waits until the requested amount

is available in the Driver Buffer. When the amount of scan data available is greater

than or equal to the amount requested the Driver Buffer will return the amount

requested.

Do Not Wait Until the Requested Amount is Available Upon receipt of the request

if the amount of scan data available in the Driver Buffer is not greater than or equal to

the amount requested then the Driver Buffer will return

no scan data. If the amount

requested is available at the time of the request the driver buffer will return the

amount requested.

Models

Initialization and Error Handling

This section demonstrates how to initialize the Daq
device and use various methods of error handling. Most
of the example programs use similar coding as detailed in
the following VB example. Functions used include:

VbdaqOpen&(daqName$)

VbdaqSetErrorHandler&(errHandler&)

VbdaqClose&(handle&)

All Visual Basic programs should include the DaqX.bas
file into their project. The DaqX.bas file provides the
necessary definitions and function prototyping for the
DAQX driver DLL.

handle& = VBdaqOpen&(“DaqBook0”)
ret& = VBdaqClose&(handle&)


The Daq device is opened and initialized with the

daqOpen

function.

daqOpen

takes one parameter—

the name of the device to be opened. The device name can be accessed and changed via the Daq*
Configuration utility located in the operating system’s Control Panel (see following figure).

Programmer’s Manual

988594

API Programming, General Models 2-9