Section 7. Installation
'Call output tables
CallTable
TwoInt
NextScan
EndProg
7.9.9 Data Output: Using Data Type Bool8
Variables used exclusively to store either
True
or
False
are usually declared
As
BOOLEAN
. When recorded in final-data memory, the state of Boolean variables
is typically stored in
BOOLEAN
data type.
BOOLEAN
data type uses a four-
byte integer format. To conserve final-data memory or telecommunication band,
you can use the
BOOL8
data type. A BOOL8 is a one-byte value that holds eight
bits of information (eight states with one bit per state). To store the same
information using a 32 bit
BOOLEAN
data type, 256 bits are required (8 states *
32 bits per state).
When programming with BOOL8 data type, repetitions in the output processing
DataTable()
instruction must be divisible by two, since an odd number of bytes
cannot be stored. Also note that when the CR1000 converts a LONG or FLOAT
data type to BOOL8, only the least significant eight bits of the binary equivalent
are used, i.e., only the binary representation of the decimal integer
modulo divide
(p. 520)
256 is used.
Example:
Given: LONG integer 5435
Find: BOOL8 representation of 5435
Solution:
5435 / 256 = 21.2304687
0.2304687 * 256 = 59
Binary representation of 59 = 00111011 (CR1000 stores
these bits in reverse order)
When
datalogger support software
(p. 95)
retrieves the BOOL8 value, it splits it
apart into eight fields of
-1
or
0
when storing to an ASCII file. Consequently,
more memory is required for the ASCII file, but CR1000 memory is conserved.
The compact
BOOL8
data type also uses less telecommunication band width
when transmitted.
CRBasic example
Programming with Bool8 and Bit-Shift Operators
(p. 200)
programs the CR1000 to monitor the state of 32 "alarms" as a tutorial exercise.
The alarms are toggled by manually entering zero or non-zero (e.g., 0 or 1) in
each public variable representing an alarm as shown in figure
Alarms Toggled in
Bit-Shift Example
(p. 199).
Samples of the four public variables
FlagsBool8(1)
,
FlagsBool8(2)
,
FlagsBool8(3)
, and
FlagsBool8(4)
are stored in data table
Bool8Data
as four one-byte values. However, as shown in figure
Bool8 Data
from Bit-Shift Example (Numeric Monitor)
(p. 199),
when viewing the data table in a
numeric monitor
(p. 521),
data are conveniently translated into 32 values of
True
or
False
. In addition, as shown in figure
Bool8 Data from Bit-Shift Example (PC
Data File)
(p. 200),
when
datalogger support software
(p. 95)
stores the data in an
ASCII file, it is stored as 32 columns of either
-1
or
0
, each column representing
the state of an alarm. You can use variable
aliasing
(p. 138)
in the CRBasic
program to make the data more understandable.
198
Содержание CR1000
Страница 2: ......
Страница 4: ......
Страница 6: ......
Страница 32: ......
Страница 36: ......
Страница 38: ......
Страница 40: ......
Страница 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Страница 96: ......
Страница 98: ...98 ...
Страница 302: ......
Страница 350: ...Section 8 Operation Figure 91 Pulse Sensor Output Signal Types Figure 92 Switch Closure Pulse Sensor 350 ...
Страница 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Страница 454: ...Section 8 Operation 8 8 1 Data Display Figure 116 Displaying Data with the Keyboard Display 454 ...
Страница 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Страница 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Страница 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Страница 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Страница 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Страница 478: ......
Страница 506: ......
Страница 536: ......
Страница 636: ......
Страница 642: ......
Страница 644: ......
Страница 676: ......
Страница 677: ......