beautypg.com

Measurement Computing Data Acquisition Systems rev.10.4 User Manual

Page 24

background image

Indefinite Acquisition, Direct-To-Disk Using Circular Buffers

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 then
armed by calling the

daqAdcArm

function.

At this point, the 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 0 through 7,
triggered via software with a 3000 Hz
sampling frequency and unity gain.
Functions used include:

VBdaqAdcSetScan&(handle&, startChan&, endChan&, gain&, flags&)

VBdaqAdcSetFreq&(handle&,freq!)

VBdaqAdcSetTrig&(handle&, triggerSource&, rising&, level%,
hysteresis%,channel&)

VBdaqAdcSetAcq&(handle&,mode&,preTrigCount&,postTrigCount&)

VBdaqAdcTransferSetBuffer&(handle&,buf%(), scanCount&, transferMask&)

VBdaqAdcTransferStart&(handle&)

VBdaqAdcTransferGetStat&(handle&,status&,retCount&)

VBdaqAdcWaitForEvent&(handle&,daqEvent&)

VBdaqAdcSetDiskFile&(handle&,filename$,openMode&,preWrite&)

This program will initialize the Daq device hardware, then take readings from the analog input channels in
the base unit (not the expansion cards) and store them to disk automatically. The following lines
demonstrate channel scan group configuration using the

daqAdcSetScan

command.

Note: flags may be channel-specific.

2-14 API Programming, General Models

988594

Programmer’s

Manual