Campbell Scientific CR200X CR200/CR200X-series Dataloggers - Page 83
Numerical Formats
View all Campbell Scientific CR200X manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 83 highlights
Section 9. Programming 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. Public FlagInt Public Flag(8) Public I Load binary information into a single variable 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 = FlagInt + 2 ^ (I - 1) EndIf Next I CallTable FlagOut NextScan EndProg 71