Section 7. Installation
7.8.4.9 Numerical Formats
Four numerical formats are supported by CRBasic. Most common is the use of
base-10 numbers. Scientific notation, binary, and hexadecimal formats can also
be used, as shown in the table
Formats for Entering Numbers in CRBasic
(p. 139).
Only standard, base-10 notation is supported by Campbell Scientific hardware and
software displays.
Table 13.
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
13
Hexadecimal
&HFF
255
Binary format (1 = high, 0 = low) is useful when loading the status of multiple
flags or ports into a single variable. For example, storing the binary number
&B11100000 preserves the status of flags 8 through 1: flags 1 to 5 are low, 6 to 8
are high. CRBasic example
Load binary information into a variable
(p. 139)
shows
an algorithm that loads binary status of flags into a LONG integer variable.
CRBasic Example 9.
Load binary information into a variable
'This program example demonstrates how binary data are loaded into a variable. The binary
'format (1 = high, 0 = low) is useful when loading the status of multiple flags
'or ports into a single variable. For example, storing the binary number &B11100000
'preserves the status of flags 8 through 1: flags 1 to 5 are low, 6 to 8 are high.
'This example demonstrates an algorithm that loads binary status of flags into a LONG
'integer variable.
Public
FlagInt
As Long
Public
Flag(8)
As Boolean
Public
I
DataTable
(FlagOut,True,-1)
Sample
(1,FlagInt,UINT2)
EndTable
BeginProg
Scan
(1,Sec,3,0)
FlagInt = 0
For
I = 1
To
8
If
Flag(I) = true
Then
FlagInt = F 2 ^ (I - 1)
EndIf
Next
I
CallTable
FlagOut
NextScan
EndProg
139
Summary of Contents for CR1000
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 40: ......
Page 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Page 96: ......
Page 98: ...98 ...
Page 302: ......
Page 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Page 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Page 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Page 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Page 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Page 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Page 478: ......
Page 506: ......
Page 536: ......
Page 636: ......
Page 642: ......
Page 644: ......
Page 676: ......
Page 677: ......