beautypg.com

Measurement Computing Data Acquisition Systems rev.10.4 User Manual

Page 22

background image

The program will then collect one sample of channels 0 through 7 using the

VBdaqAdcRdScan

function.

ret& = VBdaqAdcRdScan&(handle&,0, 7, buf%(), DgainX1&,

DafAnalog&+DafUnipolar&)

Print “Results of AdcRdscan:”
For x& = 0 To 7

Print Format$“& # & ####”; “Channel:”; buf%(x); “Data:”; buf%(x)

Next x&: Print

Counted Acquisitions Using Linear Buffers

This section sets up an acquisition that
collects post-trigger A/D scans. This
particular example demonstrates the setting
up and collection of a fixed-length A/D
acquisition in a linear buffer.

First, the acquisition is configured by
setting up the channel scan group
configuration, the acquisition frequency,
the acquisition trigger and the acquisition
mode. When configured, the acquisition is
then armed by calling the

daqAdcArm

function.

At this point, the Daq device trigger is
armed and A/D acquisition will begin upon
trigger detection. If the trigger source has
been configured to be

DatsImmediate&

,

A/D data collection will begin
immediately.

This example will retrieve 10 samples from
channels 0 through 7, triggered
immediately with a 1000 Hz sampling
frequency and unity gain. Functions used
include:

VBdaqAdcSetMux&(handle&, startChan&, endChan&, gain&, flags&)

VBdaqAdcSetFreq&(handle&,freq!)

VBdaqAdcSetTrig&(handle&, triggerSource&, rising&, level%,
hysteresis%,channel&)

VBdaqAdcSetAcq&(handle&,mode&,preTrigCount&,postTrigCount&)

VBdaqAdcTransferSetBuffer&(handle&,buf%(), scanCount&, transferMask&)

VBdaqAdcTransferStart&(handle&)

VBdaqAdcWaitForEvent&(handle&,daqEvent&)

This program will initialize the Daq device hardware, then take readings from the analog input channels in
the base unit (not the expansion cards). The functions used in this program are of a lower level than those
used in the previous section and provide more flexibility.

Dim buf%(80), handle&, ret&, flags&

The following function defines the channel scan group. The function specifies a channel scan group from
channel 0 through 7 with all channels being analog unipolar input channels with a gain of ×1. Specifying
this configuration uses

DgainX1

in the gain parameter and the

DafAnalog

and the

DafUnipolar

values

in the

flags

parameter. The

flags

parameter is a bit-mask field in which each bit specifies the

characteristics of the specified channel(s). In this case, the

DafAnalog

and the

DafUnipolar

values are

added together to form the appropriate bit mask for the specified

flags

parameter.

ret& = VBdaqAdcSetMux&(handle&,0, 7, DgainX1&, DafAnalog&+DafUnipolar&)

2-12 API Programming, General Models

988594

Programmer’s

Manual