Measurement Computing Data Acquisition Systems rev.10.4 User Manual
Page 23

Programmer’s Manual
988594
API Programming, General Models 2-13
Next, set the internal sample rate to 1 kHz.
ret& = VBdaqAdcSetFreq&(handle&,1000!)
The acquisition mode needs to be configured to be fixed length acquisition with no pre-trigger scan data
and 10 scans of post-trigger scan data. The mode is set to
DaamNShot&
, which will configure the
acquisition as a fixed-length acquisition that will terminate automatically upon the satisfaction of the post-
trigger count of 10.
ret& = VBdaqAdcSetAcq&(handle&,DaamNShot&, 0, 10)
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 immediate trigger source) that will
start the acquisition immediately. The variable
DatsImmediate&
is a constant defined in DaqX.bas.
Since the trigger source is configured as immediate, the other trigger parameters are not needed.
ret& = VBdaqAdcSetTrig&(handle&,DatsImmediate&, 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 being 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 immediate
trigger, the acquisition will begin immediately upon execution of the
daqAdcArm
function.
ret& = VBdaqAdcArm&(handle&)
After setting up and arming the acquisition, the data is immediately ready to be collected. Had the trigger
source been anything other than immediate, the data would only be ready after the trigger had been
satisfied. The following line initiates an A/D transfer from the Daq device to the defined user buffer.
ret& = VBdaqAdcTransferStart&(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 k& = k& To k& + 7
Print Format$(IntToUint&(buf%(k&)), "00000"); " ";
Next k&
Print
Next i&