Indefinite Acquisition, Direct-To-Disk Using Circular
Buffers
Configure a scan
group of channels.
Set the sampling
rate.
Configure the acquisition
to be indefinite post-trigger.
Configure the trigger event
to be software trigger.
Configure a circular acquisition
buffer 10,000 scans in length.
Open the disk file and make it
ready to receive A/D Data.
Arm the acquisition.
Trigger the acquisition.
Wait for data to
become available.
Check status of transfer.
User code to determine
if transfer should stop.
Transfer is complete;
disarm the acquisition.
Initiate data transfer to disk
(no data will transfer until
trigger event occurs).
DaqAdcSetTrigEnhanced
daqAdcSetDiskFile
daqAdcArm
daqAdcSetScan
DaqAdcSetRate
daqAdcSetAcq
daqAdcTransferSetBuffer
daqAdcSoftTrig
daqAdcTransferStart
DaqWaitForEvent
daqAdcTransferGetStat
daqAdcDisarm
Yes
User
Terminator
No
This program demonstrates the use of circular buffers in cycle
mode to collect analog input data directly to disk. In cycle mode,
this data transfer can continue indefinitely. When the transfer
reaches the end of the physical data array, it will reset its array
pointer back to the beginning of the array and continue writing
data to it. Thus, the allocated buffer can be used repeatedly like a
FIFO buffer.
The API has built-in direct-to-disk functionality. Therefore, very
little needs to be done by the application to configure direct-to-
disk operations.
First, the acquisition is configured by setting up the channel scan
group configuration, the acquisition frequency, the acquisition
trigger and the acquisition mode. Once configured, the transfer
to disk is set up and the acquisition is armed by calling the
daqAdcArm
function.
At this point, the Personal Daq device trigger is armed and A/D
acquisition to disk will begin immediately upon trigger detection.
This example will retrieve an indefinite amount of scans for
channels 1 through 8, triggered via software with a 3 Hz
sampling frequency and unity gain. Functions used include:
•
VBdaqAdcSetScan&(handle&, channels&(),
gains&(), flags&(), ChanCount&)
•
VBdaqAdcSetRate&(handle&,mode&,state&,req
uested!,actual!)
•
Function
VBdaqAdcSetTrigEnhanced&(handle&,
triggerSources&(), gains&(),
adcRanges&(), trigSense&(), levels!(),
hysteresis!(), chan&(), ChanCount&,
opstr$)
•
VBdaqAdcSetAcq&(handle&,mode&,preTrigCoun
t&,postTrigCount&)
•
VBdaqAdcTransferSetBufferSingle&(handle&,
buf!(), ScanCount&, transferMask&)
•
VBdaqAdcTransferStart&(handle&)
•
VBdaqAdcTransferGetStat&(handle&,status&,retCount&)
•
VBdaqWaitForEvent&(handle&,daqEvent&)
•
VBdaqAdcSetDiskFile&(handle&,filename$,openMode&,preWrite&)
This program will initialize the Personal Daq hardware, then take readings from the analog input channels in the base
unit (not the expansion channels) and store them to disk automatically. The following lines demonstrate channel scan
group configuration using the
daqAdcSetScan
command.
Note
: Flags may be channel-specific.
Dim handle&, ret&, channels&(8), gains&(8) flags&(8)
Dim buf!(80,000), active&, count&
Dim bufsize&
bufsize& = 10000
Personal Daq User’s Manual Appendix A,
878495
API Custom Program
Models
A-7
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com