Specifications
Section 9. CR1000 Programming
9-10
Boolean Boolean variables are typically used for flags and to represent
conditions or hardware that have only two states such as flags and
control ports. A Boolean variable uses the same 4-byte integer format
as a LONG but can be set to only one of two values. To save
memory space, consider using BOOL8 format instead.
BOOL8 BOOL8 is used to store variables that hold bits (0 or 1) of
information. This data type uses less space than normal 32-bit values.
Any reps stored must be divisible by two, since an odd number of
bytes cannot be stored in a data table. When converting from a LONG
or a FLOAT to a BOOL8, only the least significant 8 bits are used.
NSEC 8 bytes divided up as 4 bytes of seconds since 1990 and 4 bytes of
nanoseconds into the second. Used when a LONG variable being
sampled is the result of the RealTime
instruction or when the sampled
variable is a LONG storing time since 1990, such as when time of
maximum or time of minimum is asked for. Alternatively, if the
variable array (must be FLOAT or LONG) is dimensioned to 7, the
values stored will be year, month, day of year, hour, minutes,
seconds, and milliseconds. If the variable array (must be LONG) is
dimensioned to two, the instruction assumes that the first element
holds seconds since 1990 and the second element holds microseconds
into the second. If the variable array (must be LONG) is dimensioned
to 1, the instruction assumes that the variable holds seconds since
1990 and microseconds into the second is 0. In this instance, the
value stored is a standard datalogger timestamp rather than the
number of seconds since January 1990.
Read more! NSEC data type is discussed in depth, with examples, in
Section 18.12.
String ASCII String; size defined by the CR1000 CRBASIC program. The
minimum string datum size (regardless of word length), and the
default if size is not specified, is 16 bytes or characters. A string
conveniently handles alphanumeric variables associated with serial
sensors, dial strings, text messages, etc.
9.6.2 Constants
A constant can be declared at the beginning of a program to assign an
alphanumeric name to be used in place of a value so the program can refer to
the name rather than the value itself. Using a constant in place of a value can
make the program easier to read and modify, and more secure against
unintended changes. Constants can be changed while the program is running if
they are declared using the ConstTable/EndConstTable instruction.
Programming Tip: Using all uppercase for constant names may make
them easier to recognize.