Campbell Scientific CR5000 Measurement and Control Module User Manual
Page 93

Section 5. Program Declarations
5-5
Subroutine Example
'CR5000
'Declare Variables used in Program:
Public RefT, TC(4),PRTresist,PRTtemp,I
'Data output in deg C:
DataTable (TempsC,1,-1)
DataInterval (0,5,Min,10)
Average (1,RefT,FP2,0)
Average (4,TC(),FP2,0)
Average (1,PRTtemp,FP2,0)
EndTable
'Same Data output in F:
DataTable (TempsF,1,-1)
DataInterval (0,5,Min,10)
Average (1,RefT,FP2,0)
Average (4,TC(),FP2,0)
Average (1,PRTtemp,FP2,0)
EndTable
'Subroutine to convert temperature in degrees C to degrees F
Sub ConvertCtoF (Tmp)
Tmp = Tmp*1.8 +32
EndSub
BeginProg
Scan (1,Sec,3,0)
'Measure Temperatures (panel, 4 thermocouples, and 100 ohm PRT) in deg C
PanelTemp (RefT,250)
TCDiff (TC(),4,mV20C ,1,TypeT,RefT,True ,0,250,1.0,0)
Resistance (PRTresist,1,mV50,7,Ix1,1,500,True ,True ,0,250,0.01,0)
PRT (PRTtemp,1,PRTresist,1.0,0)
'Call Output Table for C
CallTable TempsC
'Convert Temperatures to F using Subroutine:
Call ConvertCtoF(RefT)
'Subroutine call using Call statement
For I = 1 to 4
ConvertCtoF(TC(I))
'Subroutine call without Call statement
Next I
ConvertCtoF(PRTtemp)
'Subroutine call without Call statement
'Call Output Table for F:
CallTable TempsF
NextScan
EndProg