
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
Summary of Contents for CR5000
Page 40: ...Section 1 Installation and Maintenance 1 16 This is a blank page ...
Page 54: ...Section 2 Data Storage and Retrieval 2 14 This is a blank page ...
Page 88: ...Section 4 CRBasic Native Language Programming 4 12 This is a blank page ...
Page 94: ...Section 5 Program Declarations 5 6 This is a blank page ...
Page 172: ...Section 7 Measurement Instructions 7 46 This is a blank page ...
Page 206: ......
Page 236: ...Index Index 4 This is a blank page ...
Page 237: ...This is a blank page ...