Measurement Computing WaveBook rev.3.0 User Manual
Page 183

WaveBook User’s Manual,
6-22-99
daqX API - Programming Models C-9
the acquisition as having indefinite length and, as such, will be terminated by the application. In this mode,
the pre- and post-trigger count values are ignored.
ret& = VBdaqAdcSetAcq&(handle&,DaamInfinitePost&, 0, 0)
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 which will
start the acquisition immediately. The variable DatsSoftware& 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&,DatsSoftware&, 0, 0, 0, 0)
A buffer now is configured to hold the A/D data to be acquired. This buffer is necessary to hold incoming
A/D data while it is being prepared for disk I/O. Since this is to be an indefinite-length transfer to a circular
buffer, the buffer cycle mode should be turned on with DatmCycleOn&. For efficiency, block update
mode is specified with DatmUpdateBlock&. The buffer size is set to 10,000 scans. The buffer size
indicates only the size of the circular buffer, not the total number of scans to be taken.
ret& = VBdaqAdcTransferSetBuffer&(handle&,buf%(), bufsize&,
DatmUpDateBlock&+DatmCycleOn&)
Now the destination disk file is configured and opened. For this example, the disk file is a new file to be
created by the driver. After the following line has been executed, the specified file will be opened and
ready to accept data.
ret& = VBdaqAdcSetDiskFile&(handle&,”c:dasqdata.bin”, DaomCreateFile&, 0)
With all acquisition parameters being configured and the acquisition transfer to disk 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, data collection will begin upon satisfaction of the trigger event.
Since the trigger source is software, the trigger event will not take place until the application issues the
software trigger event. To prepare for the trigger event, the following line initiates an A/D transfer from the
Daq* device to the defined user buffer and, subsequently, to the specified disk file. No data is transferred at
this point, however.
ret& = VBdaqAdcTransferStart&(handle&)
The transfer has been initiated, but no data will be transferred until the trigger event occurs. The following
line will signal the software trigger event to the driver; then A/D input data will be transferred to the
specified disk file as it is being collected.
ret& = VBdaqAdcSoftTrig&(handle&)
Both the acquisition and the transfer are now currently active. The transfer to disk will continue indefinitely
until terminated by the application. The application can monitor the transfer process with the following
lines of code:
acqTermination& = 0
Do
‘ Wait here for new data to arrive
ret& = VBdaqWaitForEvent(handle&,DteAdcData&)
‘ New data has been transferred - Check status
ret& = VBdaqAdcTransferGetStat&(handle&,active&,retCount&)
‘ Code may be placed here which will process the buffered data or
‘ perform other application activities. At some point the application
‘ needs to determine the event on which the direct-to-disk acquisition
‘ is to be halted and set the acqTermination flag.
Loop While acqTermination& = 0
At this point the application is ready to terminate the acquisition to disk. The following line will terminate
the acquisition to disk and will close the disk file.
ret& = VBdaqAdcDisarm&(handle&)
The acquisition as well as the data transfer has been stopped. We should check status one more time to get
the total number of scans actually transferred to disk.
ret& = VBdaqAdcTransferGetStat(handle&,active&,retCount&)
The specified disk file is now available. The retCount& parameter will indicate the total number of
scans transferred to disk.