beautypg.com

Programming models, Initialization and error handling – Measurement Computing Personal Daq rev.6.0 User Manual

Page 120

background image

Channel Identification

Scan Rates and Sequencing With multiple scans, the time between scans becomes a parameter.

This time can be a constant or can be dependent upon a trigger.

Counter/Timer Operation

Triggering Options Triggering starts the A/D conversion. The trigger can be an external analog or

TTL trigger, or a program controlled software trigger.

Foreground/Background Foreground routines ( …Rd routines) require the entire transfer to

occur before returning control to the application program. Background routines ( … Transfer
routines) start the A/D acquisition and return control to the application program before the transfer
occurs. Data is transferred while the application program is running. Data will be transferred to the
user memory buffer during program execution in 1 or more sample blocks, depending on the
configuration. The programmer must determine what tasks can proceed in the background while
other tasks perform in the foreground and how often the status of the background operations should
be checked.

Parameters in the various A/D routines include: number of channels, number of scans, start of conversion
triggering, timing between scans, and mode of data transfer. Channels can be sampled in consecutive or
non-consecutive order with the same [or different] gains. The scan sequence makes no distinction between
local and expansion channels.

Programming Models

Note:

Two types of VB function wrappers exist for the API functions that reference data buffers. One
type references an integer buffer, and the other references a single-precision floating point buffer.
The wrappers that reference single-precision floating point buffers have the word

Single

appended to the function name. For example,

VBdaqAdcTransferSetBufferSingle

would be

used to set a single-precision floating point buffer, whereas

VBdaqAdcTransferSetBuffer

be

used to set an integer buffer.

This section outlines basic programming steps commonly used for data acquisition. Consider the models
as building blocks that can be put together in different ways or modified as needed. As a general tutorial,
these examples use Visual Basic since most programmers know BASIC and can translate to other
languages as needed. The following table identifies the API programming models discussed in this
appendix.

Model Type

Model Name

Page

Configuration

Initialization and Error Handling

A-2

Acquisition

Foreground Acquisition with One-Step Commands

Counted Acquisition Using Linear Buffers

Indefinite Acquisition, Direct-To-Disk Using Circular Buffers

Multiple Channel Types

A-4

A-5

A-7

A-10

Initialization and Error Handling

This section demonstrates how to initialize the Personal Daq
and use various methods of error handling.

Most of the example programs use similar coding as detailed
here. Functions used include:

VBdaqOpen&(daqName$)

VBdaqSetErrorHandler&(errHandler&)

VBdaqClose&(handle&)

A-2 API Custom Program Modules Appendix A,

878495

Personal Daq User’s Manual

This manual is related to the following products: