Section 9. Programming
83
If Flag = True Then
DisableVar = True
End If
Else
DisableVar = False
EndIf
'Call Data Tables and Store Data
CallTable (OscAvgData)
NextScan
EndProg
Read More!
For a complete list of output processing instructions, see
Data
Storage Output Processing
(p. 94).
9.7.2
Subroutines
Subroutines allow a section of code to be called by multiple processes in the
main body of a program. Subroutines are defined before the main program body
of a program. Program
CRBASIC EXAMPLE. Use of a Subroutine
p. 83 shows
the use of a subroutine to repeatedly perform a calculation.
CRBASIC EXAMPLE 10.
Use of a Subroutine
'Declare Variables and Units
Public Temp(4), I, Temp_F(4)
'Subroutine to convert temperature in degrees C to degrees F
Sub ConvertCtoF
For I = 1 to 4
Temp_F = Temp(I)*1.8 + 32
Next I
EndSub
'Main Program
BeginProg
Scan (1,Sec)
Therm109 (Temp(),4,1,Ex1,1.0,0)
'convert Temperatures to F using Subroutine:
Call ConvertCtoF
NextScan
EndProg
9.8 Program Execution Timing
CR200(X) programs are built within a Scan () / NextScan structure, with only
variable and data table declarations outside the Scan () / NextScan structure. In
these programs, Scan () / NextScan creates an infinite loop, each periodic pass
through the loop being synchronized to the CR200(X) clock. Scan () parameters
allow modification of the period. As shown in
CRBASIC EXAMPLE. BeginProg
/ Scan / NextScan / EndProg Syntax
(p. 84) , aside from declarations, the
CRBASIC program may be relatively short.
Summary of Contents for CR200
Page 32: ...Section 2 Quickstart Tutorial 22 ...
Page 45: ...Section 3 Overview 35 3 3 Specifications ...
Page 46: ...Section 3 Overview 36 ...
Page 58: ...Section 4 Sensor Support 48 ...
Page 62: ...Section 5 Measurement and Control Peripherals 52 ...
Page 78: ...Section 8 CR200 X Configuration 68 ...
Page 102: ...Section 9 Programming 92 ...
Page 138: ...Section 11 Programming Resource Library 128 ...
Page 156: ...Section 16 Support Software 146 ...
Page 160: ...Section 17 Care and Maintenance 150 ...
Page 167: ...Section 18 Troubleshooting 157 18 3 3 2 Charging Circuit Test Solar Panel ...
Page 168: ...Section 18 Troubleshooting 158 18 3 3 3 Charging Circuit Test Transformer ...
Page 169: ...Section 18 Troubleshooting 159 18 3 3 4 Adjusting Charging Circuit Voltage ...
Page 170: ...Section 18 Troubleshooting 160 ...
Page 184: ...Appendix A Glossary 14 ...
Page 190: ...Appendix B Status Table and Settings 20 ...
Page 192: ...Appendix C Serial Port Pin Outs 22 ...
Page 211: ......