beautypg.com

B.1.3, Example 3 — sample program using the brhalf() – Campbell Scientific 109SS Temperature Probe User Manual

Page 24

background image

Appendix B. Example Programs

'*AG = Analog Ground (represented by ground symbol on CR1000 wiring panel

'Declare the variables for the temperature measurement

Public

T109_C

'Define a data table for 60 minute averages

DataTable

(Table1,True,-1)

DataInterval

(0,10,Min,10)

Average

(1,T109_C,FP2,False)

EndTable

'Main Program

BeginProg

Scan

(1,Sec,1,0)

'Measure the temperature

Therm109

(T109_C,1,1,1,0,_60Hz,1.0,0)

'Call Data Table

CallTable

(Table1)

NextScan

EndProg

B.1.3 Example 3 — Sample Program using the BrHalf()

instruction rather than Therm109()

‘Program measures a single 109 Thermistor probe once a second and
‘stores the average temperature every 60 minutes.

'Wiring Diagram
'==============
'109SS Probe
'
' Wire
' Color Function CR1000
' ----- -------- ------
' Black Voltage-excitation input VX1 or EX1
' Red Analog-voltage output SE1
' Purple Bridge-resistor ground AG*
' Clear Shield G*

'*AG = Analog Ground (represented by ground symbol on CR1000 wiring panel

'Declare the variables for the temperature measurement

Public

T109_C

'Declare variables for the raw measurement, thermistor resistance,
‘and ln(resistance):

Dim

V_Vx, Rtherm, lnRt

'Define a data table for 60 minute averages

DataTable

(Table1,True,-1)

DataInterval

(0,10,Min,10)

Average

(1,T109_C,IEEE4,False)

EndTable

BeginProg

Scan

(1,sec,5,0)

'Measure the 109SS probe. The result is V/Vx.

BrHalf

(V_Vx,1,mV5000,3,Vx1,1,5000,True,0,_60Hz,1.0,0)

'Calculate reistance:

RTherm=24900

*

(1

/

V_Vx-1)

'Calculate the natural log of the resistance

lnRt=

Log

(Rtherm)

'Apply the Steinhart-Hart equation and convert to degrees C in one step:

Air_Temp=1

/

(1.129241e-3

+

2.341077e-4

*

lnRt

+

8.775468e-8

*

(lnRt

^

3))

-

273.15

B-2