Measurement-computing TempBook rev.3.0 Instrukcja Użytkownika Strona 103

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 166
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 102
TempBook Users Manual
Enhanced
API Programming Models (TempBook) 10-7
Temperature Acquisition Using One-Step Commands
This example demonstrates the Enhanced APIs high-level one-step routines to
read thermocouple input from the TempBook/66 device. These functions
combine scan sequencer setup, ADC data collection, and thermocouple
linearization. Functions used include:
VBdaqSetDefaultHandler&(handler&)
VBdaqGetDeviceCount&(deviceCount&)
VBdaqGetDeviceList&(deviceList&, deviceProps)
VBdaqOpen&(daqName$)
VBdaqAdcSetDataFormat&(handle&, rawFormat&,
postProcFormat&)
VBdaqAdcRd&(handle&,chan&, sample%, gain&, flags&)
VBdaqAdcRdScan&( handle&,startChan&, endChan&, buf%,
gain&, flags&)
VBdaqAdcRdScanN&( handle&,chan&, buf%, scanCount&,
triggerSource&, rising&, level%, freq!, gain&, flags&)
VBdaqAdcRdN&(handle&,chan&, startChan&, endChan&, buf%,
scanCount&, triggerSource&, rising&, level%, freq!,
gain&, flags&)
VBdaqClose&(handle&,daqEvent&)
Const Scans& = 5000
Const Level% = 0
Const Rising& = 0
Const Start& = 0
Const End& = 0
Const Freq! = 6000.0
Const Gain& = TbkBiTypeJ&
Const Flags& = DafBipolar& + DafDifferential& + DafTcTypeJ&
Const Chans& = End& - Start&+1
Dim buf%(80), handle&, ret&, flags&
Dim I&, j&, deviceCount&, handle&, deviceIndex&
Dim temp%, temps%(Scans&*Chans&)
Dim sum!, totals!(Chans&)
Dim ret&
First, we need to open the TempBook/66 device. This example uses a device named TempBook0. The
device name must be a valid device name for a configured device.
handle& = VBdaqOpen&(TempBook0)
Set the raw data format to native and the post-processing data format to temperature in tenths of a degree C.
The post-processing data format controls the format of the data returned by the one-step acquisition
functions such as
daqAdcRd
. In this case,
daqAdcRd
returns temperatures rather than raw ADC
readings.
ret& = VBdaqAdcSetDataFormat& (handle&, DardfNative&, DappdfTenthsDegC&)
The following statement retrieves a single ADC sample from a type J thermocouple on channel
Start&
and converts the reading to a temperature. The temperature is returned in the
sample%
parameter and is a
16-bit quantity which represents tenths of degrees C.
ret& = VBdaqAdcRd& (handle&, Start&, temp%, TbkBiTypeJ, Flags&)
Now the results for the single-sample read are displayed:
Print "Results of daqAdcRd for channel , Start&, : (single reading)"
Print "Temperature: , temp/10.0, C"
The next statement retrieves
Scans&(5000)
number of samples from a type J thermocouple on channel
Start&
and converts the readings to a single temperature using block averaging. The trigger source is set
to
DatsImmediate&
so the scans will be acquired immediately. Again, the temperatures are returned as
16-bit words representing tenths of degrees C.
Przeglądanie stron 102
1 2 ... 98 99 100 101 102 103 104 105 106 107 108 ... 165 166

Komentarze do niniejszej Instrukcji

Brak uwag