Measurement Computing WaveBook rev.3.0 User Manual
Page 181
WaveBook User’s Manual,
6-22-99
daqX API - Programming Models C-7
Next, set the internal sample rate to 1 kHz.
ret& = VBdaqAdcSetFreq&(handle&,freq!)
The sample rate will not be exactly 1 kHz; the actual frequency can be checked if necessary by:
ret& = VBdaqAdcGetFreq(handle&, freq!)
The “actual” frequency set will be stored in
freq
after the function call returns.
The acquisition begins upon detection of the trigger event. The trigger event is configured with
daqAdcSetTrig
. The next line defines the trigger event to be the software trigger source which will
start the acquisition upon a call to VBdaqAdcSoftTrig(). The variable DatsSoftware& is a
constant defined in DaqX.bas. Since the trigger source is configured as software, the other trigger
parameters are not needed.
ret& = VBdaqAdcSetTrig&(handle&,DatsSoftware&, 0, 0, 0, 0)
A buffer now is configured to hold the A/D data to be acquired. Since this is to be a fixed-length transfer to
a linear buffer, the buffer cycle mode should be turned off with DatmCycleOff&. For efficiency, block
update mode is specified with DatmUpdateBlock&. The buffer size is set to 10 scans.
Note:
The user-defined buffer must have been allocated with sufficient storage to hold the entire transfer
prior to invoking the following line.
ret& = VBdaqAdcTransferSetBuffer&(handle&,buf%(), 10,
DatmUpDateBlock&+DatmCycleOff&)
With all acquisition parameters configured, the acquisition can now be armed. Once armed, the acquisition
will begin immediately upon detection of the trigger event. As in the case of the software trigger, the
acquisition will begin immediately upon execution of the daqAdcSoftTrig()function.
ret& = VBdaqAdcArm&(handle&)
After setting up and arming the acquisition, the data is ready to be collected. The following line initiates an
A/D transfer from the WaveBook/Daq* device to the defined user buffer which will begin after the trigger
event is satisfied (upon the completion of the daqAdcSoftTrig() function call).
ret& = VBdaqAdcTransferStart&(handle&)
Now the trigger will start the transfer:
ret& = VBdaqAdcSoftTrig(handle&)
Wait for the transfer to complete in its entirety, then proceed with normal application processing.
This can be accomplished with the daqWaitForEvent command. The daqWaitForEvent allows the
application processing to become blocked until the specified event has occurred. DteAdcDone, indicates
that the event to wait for is the completion of the transfer.
ret& = VBdaqWaitForEvent(handle&,DteAdcDone&)
At this point, the transfer is complete; all data from the acquisition is available for further processing.
Print "Results of Transfer"
For i& = 0 To 10
Print "Scan "; Format$(Str$(i& + 1), "00"); " -->";
For j& = 0 To channels& - 1
Print Format$(IntToUint&(buf%(j&)), "00000"); " ";
Next j&
Print
Next i&
Print "R"