![background image](http://html1.mh-extra.com/html/campbell/cr200/cr200_instruction-manual_489088086.webp)
Section 9. Programming
76
CRBASIC EXAMPLE 5.
Flag Declaration and Use
Public batt_volt
Public Flag
BeginProg
Scan (1,Sec)
Flag = IIF (Flag=0,0,-1)
If Flag = true Then
Battery (batt_volt)
EndIf
NextScan
EndProg
9.6.2
Constants
CRBASIC EXAMPLE. Using the Const Declaration
(p. 76) shows use of the
constant declaration. A constant can be declared at the beginning of a program
to assign an alphanumeric name to be used in place of a value so the program
can refer to the name rather than the value itself. Using a constant in place of a
value can make the program easier to read and modify, and more secure against
unintended changes.
Note
Using all uppercase for constant names may make them easier to
recognize.
CRBASIC EXAMPLE 6.
Using the Const Declaration
Public PTempC, PTempF
Const CtoF_Mult = 1.8
Const CtoF_Offset = 32
BeginProg
Scan (1,Sec,0,0)
Therm109 (PTempC,1,1,Ex1,1.0,0)
PTempF = PTempC * Cto CtoF_Offset
NextScan
EndProg
9.6.2.1
Predefined Constants
Several words are reserved for use by CRBASIC. These words cannot be used
as variable or table names in a program. Predefined constants include some
instruction names, as well as valid alphanumeric names for instruction
parameters. In general, instruction names should not be used as variable,
constant, or table names in a datalogger program, even if they are not
specifically listed as a predefined constant. If a predefined constant, such as
"Sub" is used as a variable in a program, an error similar to the following may
be, but is not always, displayed at CRBASIC pre-compile.
Compile Failed!
line 8: Sub is already is use as a predefined CONST.
Содержание CR200
Страница 32: ...Section 2 Quickstart Tutorial 22 ...
Страница 45: ...Section 3 Overview 35 3 3 Specifications ...
Страница 46: ...Section 3 Overview 36 ...
Страница 58: ...Section 4 Sensor Support 48 ...
Страница 62: ...Section 5 Measurement and Control Peripherals 52 ...
Страница 78: ...Section 8 CR200 X Configuration 68 ...
Страница 102: ...Section 9 Programming 92 ...
Страница 138: ...Section 11 Programming Resource Library 128 ...
Страница 156: ...Section 16 Support Software 146 ...
Страница 160: ...Section 17 Care and Maintenance 150 ...
Страница 166: ...Section 18 Troubleshooting 156 18 3 3 Diagnosis and Fix Procedures 18 3 3 1 Battery Voltage Test ...
Страница 167: ...Section 18 Troubleshooting 157 18 3 3 2 Charging Circuit Test Solar Panel ...
Страница 168: ...Section 18 Troubleshooting 158 18 3 3 3 Charging Circuit Test Transformer ...
Страница 169: ...Section 18 Troubleshooting 159 18 3 3 4 Adjusting Charging Circuit Voltage ...
Страница 170: ...Section 18 Troubleshooting 160 ...
Страница 184: ...Appendix A Glossary 14 ...
Страница 190: ...Appendix B Status Table and Settings 20 ...
Страница 192: ...Appendix C Serial Port Pin Outs 22 ...
Страница 211: ......