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