Section 7. Installation
173
Evaluation of Integers
'This program example demonstrates the evaluation of integers.
Public
I
As Long
Public
X
As Float
BeginProg
I = 126
X = (I+3) * 3.4
'I+3 is evaluated as an integer, then converted to Float data type before it is
'multiplied by 3.4.
EndProg
Constants Conversion
Constants are not declared with a data type, so the CR3000 assigns the data type
as needed. If a constant (either entered as a number or declared with CONST) can
be expressed correctly as an integer, the compiler will use the type that is most
efficient in each expression. The integer version is used if possible, for example, if
the expression has not yet encountered a FLOAT. CRBasic example Constants to
LONGs or FLOATs
(p. 173)
lists a programming case wherein a value normally
considered an integer (10) is assigned by the CR3000 to be As FLOAT.
Constants to LONGs or FLOATs
'This program example demonstrates conversion of constants to Long or Float data types.
Public
L
As Long
Public
F1
As Float
Public
F2
As Float
Const
ID = 10
BeginProg
F1 = F2 + ID
L = ID * 5
EndProg
In the just previous CRBasic example
,
L is an integer. F1 and F2 are FLOATS.
The numeral 5 is loaded As FLOAT to add efficiently with constant ID, which
was compiled As FLOAT for the previous expression to avoid an inefficient
runtime conversion from LONG to FLOAT before each floating point addition.
7.6.3.16.4
Logical Expressions
Measurements can indicate absence or presence of an event. For example, an RH
measurement of 100% indicates a condensation event such as fog, rain, or dew.
The CR3000 can render the state of the event into binary form for further
processing, so the event is either occurring (true), or the event has not occurred
(false).
True = -1, False = 0
In all cases, the argument 0 is translated as FALSE in logical expressions; by
extension, any non-zero number is considered "non-FALSE." However, the
Summary of Contents for CR3000 Micrologger
Page 2: ......
Page 3: ......
Page 4: ......
Page 6: ......
Page 30: ......
Page 34: ......
Page 36: ......
Page 96: ......
Page 485: ...Section 8 Operation 485 8 11 2 Data Display FIGURE 110 Keyboard and Display Displaying Data ...
Page 487: ...Section 8 Operation 487 FIGURE 112 CR1000KD Real Time Custom ...
Page 491: ...Section 8 Operation 491 FIGURE 116 Keyboard and Display File Edit ...
Page 496: ......
Page 502: ......
Page 564: ...Section 11 Glossary 564 FIGURE 126 Relationships of Accuracy Precision and Resolution ...
Page 566: ......
Page 594: ......
Page 598: ......
Page 600: ......
Page 602: ......
Page 624: ......
Page 642: ......
Page 643: ......