Measurement Computing TempBook rev.3.0 User Manual
Page 115

TempBook User’s Manual
Enhanced API Programming Models (TempBook) 10-19
Chans[0] = 18
‘ Shorted channel
Chans[1] = 18
‘ Shorted channel
Chans[2] = 16
‘ CJC channel
Gains[0] = TbkBiCJC&
‘ Shorted channel at CJC gain
Gains[1] = TC_GAIN; ‘ Shorted channel at thermocouple gain
Gains[2] = TbkBiCJC;
‘ CJC channel reading at CJC gain
‘ All channels bipolar
Flags&[0] = Flag&
Flags&[1] = Flag&
Flags&[2] = Flag&
‘ Configure thermocouple channels after shorted and CJC channels in scan
For I& =0 To NumTcChans
Chans&(I&+3) = Start& + I&;
Gains&(I&+3) = TcGain&
Flags&(i+3) = Flag&
Next I&
‘ Configure the TempBook with the scan sequence
ret& = VbdaqAdcSetScan& (handle&, chans&(), gains&(), flags&(), TotalChans&)
Now the acquisition itself needs to be configured. This acquisition specifies a counted acquisition
(DaamNShot&) with no pre-trigger and 10 post-trigger (Scans&) scans.
‘ Set the acquisition mode and clock source
ret& = VBdaqAdcSetAcq& (handle&, DaamNShot&, 0, Scans&)
ret& = VBdaqAdcSetClockSource& (handle&, DacsAdcClock&)
The acquisition trigger is set to immediate triggering (DatsImmediate&); however, the acquisition will
not be started until it is armed later on.
‘ Configure to trigger immediately after armed
ret& = VBdaqAdcSetTrig& (handle&, DatsImmediate&, True, 0, 0, 0)
The scan frequency is now set to 1000 Hz (Freq!).
‘ Set the scan frequency
ret& = VBdaqAdcSetFreq& (handle&, Freq!)
Now that the acquisition has been configured, the transfer buffer for the raw data must be defined. The
following routines will configure the buf% array as the raw data array with a length of 10 (Scans&) scans.
Also, the buffer is set to linear mode by specifying the DatmCycleOff& flag. The
DatmUpdateSingle&
flag indicates that the buffer should be updated while each sample is acquired.
After the buffer has been defined, the raw data transfer will be started with the daqAdcTransferStart
routine. However, data transfer into the raw data buffer will not really begin until the acquisition has been
triggered.
‘ Set up and start the transfer
ret& = VBdaqAdcTransferSetBuffer& (handle&, buf%(), Scans&, DatmCycleOff& +
DatmUpdateSingle&)
ret& = VBdaqAdcTransferStart& (handle&)
The acquisition is now configured, and the raw data buffer is ready to receive transferred data. To initiate
the transfer, the acquisition needs to be armed. Once armed, the data transfer will begin immediately since
the trigger source was configured as DatsImmediate&.
‘ Arm the acquisition
VBdaqAdcArm& (handle&)
The acquisition and transfer of the raw data is now active. The following statement can be used to wait for
the termination of the transfer. Once the transfer is terminated, the raw data will then be present in the
buffer.
‘ Wait until the acquisition is complete
ret& = VBdaqWaitForEvent& (handle&, DteAdcDone&)
‘ Get the number of scans acquired