Measurement Computing TempBook rev.3.0 User Manual

Page 116

Advertising
background image

10-20 Enhanced API Programming Models (TempBook)

TempBook User’s Manual

ret& = VBdaqAdcTransferGetStat& (handle&, active&, retCount&)
Print retCount&, “ Scans acquired. Converting data... "

The raw data is now available to be converted to temperature readings. The following code performs the
conversion process on the buf%() raw data buffer. When complete, the temperature values will be
available in the temps%() array. The VBdaqCvtTCSetupConvert function is used to perform the
conversion. Here, the conversion is configured with the number of readings per scan
(TotalChans&=11), CJC position of 2, the number of thermocouple channels (NumTcChans&=8), the
thermocouple type (TcType&= TbkTCTypeJ&), bipolar raw data, no averaging (AvgType&=0), the
raw data buffer (buf%()), the total number of scans (Scans&=10) and the target array for the converted
temperature data in tenths of degrees C (temp%()).

‘ Configure the TC conversion functions to use zero correction
ret& = VBdaqAutoZeroCompensate& (1)

‘ Configure and Perform Thermocouple Linearization
ret& = VBdaqCvtTCSetupConvert& (TotalChans&, 2, NumTcChans&, TcType&,1,

AvgType&,

buf%(), Scans&, temps%(), NumTcChans&)

‘ Print a channel column labels
Print "Averaged temperature readings:"

For I& = 0 To NumTcChans&

Print “Channel”, I&, “ Temperatue “, temp%(I&)/10.0,” C”

Next I&

‘ Close and exit
ret& = VBdaqClose& (handle&)

Advertising