Section 9. Programming
71
processing instructions that compress many common calculations used in
CR200(X) dataloggers.
These four elements must be properly placed within the program structure.
9.4 Numerical Formats
Four numerical formats are supported by CRBASIC. Most common is the use of
base 10 numbers. Scientific notation, binary, and hexadecimal formats may also
be used, as shown in
TABLE. Formats for Entering Numbers in CRBASIC
(p.
71). Only standard base 10 notation is supported by Campbell Scientific
hardware and software displays.
Table 5.
Formats for Entering Numbers in CRBASIC
Format
Example
Base 10 Equivalent Value
Standard 6.832
6.832
Scientific notation
5.67E-8
5.67X10
-8
Binary &B1101
11
Hexadecimal &HFF
255
Binary format is useful when loading the status (1 = high, 0 = low) of multiple
flags or ports into a single variable, e.g., storing the binary number
&B11100000 preserves the status of flags 8 through 1. In this case, flags 1 - 5
are low, 6 - 8 are high.
CRBASIC EXAMPLE. Load Binary Information into a
Variable
(p. 71) shows an algorithm that loads binary status of flags into a
LONG integer variable.
CRBASIC EXAMPLE 2.
Load binary information into a single variable
Public FlagInt
Public Flag(8)
Public I
DataTable (FlagOut,True,1000)
Sample (1,FlagInt)
EndTable
BeginProg
Scan (1,Sec)
FlagInt = 0
For I = 1 To 8
Flag (I) = IIF (Flag(I)= 0,0,-1)
If Flag(I) = true then
FlagInt = F 2 ^ (I - 1)
EndIf
Next I
CallTable FlagOut
NextScan
EndProg
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: ......