Measurement Computing WaveBook rev.3.0 User Manual
Page 190

C-16 daqX API - Programming Models,
6-22-99
WaveBook User’s Manual
Set the post-trigger scan rate:
ret& = VBdaqAdcSetFreq&(handle&, POST_freq!)
Set the trigger source to an analog trigger on channel 1 at 2 volts:
ret& = VBdaqAdcSetTrig&(handle&, DatsHardwareAnalog&, rising&, level%,
HYSTERESIS%, chans&(0))
Arm the acquisition:
ret& = VBdaqAdcArm&(handle&)
Start reading data in the background mode with cycle mode and updateSingle off:
ret& = VBdaqAdcTransferSetBuffer(handle&, buf%(), BLOCK&, DatmCycleOff&
+ DatmUpdateSingle&)
Start the transfer:
ret& = VBdaqAdcTransferStart(handle&)
Issue a software trigger command to the hardware, and wait for the transfer to begin:
ret& = VBdaqAdcSoftTrig&(handle&)
retCount& = 0
While retCount& < BLOCK '= 0
ret& = VBdaqAdcTransferGetStat&(handle&, active&, retCount&)
Wend
Print "Triggered. Transfer in progress."
Wait for first data to be received:
ret& = VBdaqWaitForEvent(handle&, DteAdcData&)
Wait for the rest of the data to be transmitted:
While retCount& < BLOCK
ret& = VBdaqAdcTransferGetStat&(handle&, active&, retCount&)
Wend
Print "Acquisition complete:"; retCount&; "scans acquired."
Print
Unpack the packed data using the same buffer:
ret& = VBdaqCvtRawDataFormat&(buf%(), DacaUnpack, retCount&, BLOCK&,
channels&)
Rotate the unpacked data so that the earliest data starts at the beginning of the buffer and the latest is at the
end:
ret& = VBdaqCvtRawDataFormat&(buf%(), DacaRotate, retCount&, BLOCK&,
channels&)
Display the results:
Print "Pre-trigger data acquired:"
For i& = 0 To channels& - 1
Print "Channel"; i& + 1; "Data:";
For j& = 0 To PRE_SCANS& - 1
Print Tab(j& * 7 + 17); buf%(j& * channels& + i&);
Next j&
Print
Next i&
Print
Print "Post-trigger data acquired:"
For i& = 0 To channels& - 1
Print "Channel"; i& + 1; "Data:";
For j& = PRE_SCANS& To BLOCK& - 1
Print Tab((j& - PRE_SCANS&) * 7 + 17); buf%(j& * channels& + i&);
Next j&
Print
Next i&
Finally, close the device before exiting:
ret& = VBdaqClose(handle&)