Complex triggering – Measurement Computing WaveBook rev.3.0 User Manual

Page 187

Advertising
background image

WaveBook User’s Manual,

6-22-99

daqX API - Programming Models C-13

Complex Triggering

This example takes multiple scans from hardware using a complex analog
trigger. The acquisition will start on a rising-edge of channel 1 at 2 volts OR
a falling-edge on channel 2 at 3 volts. Functions used include:

VBdaqAdcSetAcq&(handle&,mode&,preTrigCount&,

postTrigCount&)

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

flags&)

VBdaqAdcSetTrig&(handle&, triggerSource&, rising&,

level%, hysteresis%,channel&)

VBdaqAdcSetFreq&(handle&, freq!)

VBdaqAdcArm&(ByVal handle&, ByVal deviceType&)

VBdaqAdcTransferSetBuffer&(handle&, deviceType&,

chan&, buf%(), scanCount&, transferMask&)

VBdaqAdcTransferStart&(handle&)

VBdaqAdcSoftTrig&(handle&)

VBdaqAdcTransferGetStat(handle&, active&, retCount&)

VBdaqAdcClose(handle&)

The constants used in this example are defined as follows:

Const freq! = 1000
Const scans& = 9
Const channels& = 3
Const NUM_TRIG& = 2

daqAdcSetAcq

daqAdcSetMux

daqAdcSetFreq

daqAdcWaitForEvent

daqAdcTransferSetBuffer

daqAdcSetTrigEnhanced

daqAdcTransferStart

daqAdcArm

Arrays are dimensioned for configuring individual channels:

Dim chan&(NUM_TRIG&)
Dim gains&(NUM_TRIG&), polarity&(NUM_TRIG&)
Dim rising&(NUM_TRIG&)
Dim levels%(NUM_TRIG&), HYSTERESIS%(NUM_TRIG&)

Initialize these arrays which can specify individual settings for each channel:

chan&(0) = 1
gains&(0) = DgainX1&
polarity&(0) = 1
rising&(0) = DatdRisingEdge&
levels%(0) = 2
HYSTERESIS%(0) = 0.1

chan&(1) = 2
gains&(1) = DgainX1&
polarity&(1) = 1
rising&(1) = DatdFallingEdge&
levels%(1) = 3
HYSTERESIS%(1) = 0.1

Now, to open the WaveBook and specify the error handler:

handle& = VBdaqOpen("WaveBook0")
ret& = BdaqSetErrorHandler(handle&, 100)
On Error GoTo ErrorHandlerADC5

Set up the acquisition for

Nshot

, with 0 pre-trigger scans and 9 post-trigger scans.

ret& = VBdaqAdcSetAcq&(handle&, DaamNShot&, 0, scans&)

Set the scan configuration to channels 1 through 3, with a gain of ×1, and the flags parameter specifying
unipolar analog mode.

ret& = VBdaqAdcSetMux&(handle&, 1, channels&, DgainX1&,

DafAnalog&+DafUnipolar&)

Set the post-trigger scan rates:

ret& = VBdaqAdcSetFreq&(handle&, freq!)

Create the buffer to hold the collected data:

ret& = VBdaqAdcTransferSetBuffer(handle&, buf%(), scans&, DatmCycleOff& +

DatmUpdateSingle&)

Advertising