
Section 7. Installation
145
Constants Conversion
Constants are not declared with a data type, so the CR800 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, i.e., if the
expression has not yet encountered a
FLOAT
. CRBasic example
Constants to
LONGs or FLOATs
(p. 145)
lists a programming case wherein a value normally
considered an integer (10) is assigned by the CR800 to be
As FLOAT
.
CRBasic
Example
22.
Constants
to
LONGs
or
FLOATs
Public
I
As Long
Public
A1, A2
Const
ID = 10
BeginProg
A1 = A2 + ID
I = ID * 5
EndProg
In CRBasic example
Constants to LONGs or FLOATs
(p. 145),
I is an integer. A1
and A2 are
FLOATS
. The number 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.7.3.9.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 CR800 can render the state of the event into binary form for further
processing, i.e., 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
argument
TRUE
is predefined in the CR800 operating system to only equal
-1
, so
only the argument
-1
is
always
translated as
TRUE
. Consider the expression
If
Condition(1) = TRUE
Then
...
This condition is true only when Condition(1) =
-1
. If Condition(1) is any other
non-zero, the condition will not be found true because the constant
TRUE
is
predefined as
-1
in the CR800 system memory. By entering
= TRUE
, a literal
comparison is done. So, to be absolutely certain a function is true, it must be set
to
TRUE
or
-1
.
Note
TRUE
is
-1
so that every bit is set high (-1 is &B11111111 for all four
bytes). This allows the
AND
operation to work correctly. The
AND
operation
does an AND boolean function on every bit, so
TRUE AND X
will be non-zero if
at least one of the bits in X is non-zero, i.e., if X is not zero. When a variable of
data type BOOLEAN is assigned any non-zero number, the CR800 internally
converts it to
-1
.
Summary of Contents for CR850
Page 2: ......
Page 4: ......
Page 6: ......
Page 26: ...Table of Contents 26...
Page 30: ...Section 2 Cautionary Statements 30...
Page 32: ...Section 3 Initial Inspection 32...
Page 35: ...Section 4 Quickstart Tutorial 35 Figure 2 Wiring panel...
Page 55: ...Section 4 Quickstart Tutorial 55 Figure 24 PC200W View data utility...
Page 78: ...Section 5 System Overview 78...
Page 80: ...Section 6 CR800 Specifications 80...
Page 267: ...Section 7 Installation 267 Figure 84 Running average signal attenuation...
Page 268: ...Section 7 Installation 268...
Page 384: ...Section 8 Operation 384 Figure 113 Using the keyboard display...
Page 387: ...Section 8 Operation 387 Figure 116 Real time custom...
Page 388: ...Section 8 Operation 388 8 8 1 3 Final Storage Tables Figure 117 Final storage tables...
Page 389: ...Section 8 Operation 389 8 8 2 Run Stop Program Figure 118 Run Stop Program...
Page 390: ...Section 8 Operation 390 8 8 3 File Display Figure 119 File display...
Page 396: ...Section 8 Operation 396...
Page 402: ...Section 9 Maintenance 402...
Page 450: ...Section 11 Glossary 450...
Page 504: ...Appendix A CRBasic Programming Instructions 504...
Page 526: ...Appendix B Status Table and Settings 526...
Page 530: ...Appendix C Serial Port Pinouts 530...
Page 536: ...Appendix E FP2 Data Format 536...
Page 550: ...Appendix F Other Campbell Scientific Products 550...
Page 565: ......