Appendix B. Introduction to CRBasic Programming
B-11
TABLE B-3. Data Types in Final-Data Memory
Name
Argument
Description
Word Size
(Bytes)
Notes
Resolution / Range
Boolean
Boolean
Signed integer
4
Use to store true or false states, such
as states of flags and control ports. 0
is always false. –1 is always true.
Depending on the application, any
other number may be interpreted as
true or false. See Appendix
. To save
memory, consider using
UINT2
or
BOOL8
.
True
= –
1 or any number ≥ 1
False
= any number ≥ 0 and < 1
Bool8
Bool8
Integer
1
8 bits (0 or 1) of information. Uses
less space than 32-bit Boolean.
Holding the same information in
Boolean will require 256 bits.
True
= 1,
False
= 0
NSEC
NSEC
Time stamp
8
Divided up as four bytes of seconds
since 1990 and four bytes of
nanoseconds into the second. Used to
record and process time data.
1 nanosecond
String
String
ASCII string
Minimum: 3
(4 with null
terminator)
Default: 24
Maximum:
limited only
to the size of
available
CR300
memory.
See caution.
1
String size is defined by the CR300
operating system and CRBasic
program.
When converting from
String
to
Float
, numerics at the beginning of a
string convert, but conversion stops
when a non-numeric is encountered.
If the string begins with a non-
numeric, the
Float
will be
NAN
. If
the string contains multiple numeric
values, the
SplitStr()
instruction can
be used to parse out the numeric
values. Refer to
CRBasic Editor
Help
.
Unless declared otherwise, string size is 24
bytes or characters. String size is allocated
in multiples of four bytes; for example,
String * 25
,
String * 26
,
String * 27
, and
String * 28
allocate 28 bytes (27 usable).
Minimum string size is 4 (3 usable). See
CRBasic Editor Help
for more information.
Maximum length is limited only by
available CR300 memory.
CRBasic Example B-7. Use of the Disable Variable
'This program example demonstrates the use of the 'disable' variable, or DisableVar, which
'is a parameter in many output processing instructions. Use of the 'disable' variable
'allows source data to be selectively included in averages, maxima, minima, etc. If the
''disable' variable equals -1, or true, data are not included; if equal to 0, or false,
'data are included. The 'disable' variable is set to false (0) by default.
'Declare Variables and Units
Public
Oscillator
As Long
Public
Flag(1)
As Boolean
Public
DisableVar
As Boolean
'Define Data Tables
DataTable
(OscAvgData,True,-1)
DataInterval
(0,1,Min,10)
Average
(1,Oscillator,FP2,DisableVar)
EndTable
'Main Program
BeginProg
Scan
(1,Sec,1,0)
Summary of Contents for CR300 series
Page 2: ......
Page 6: ......
Page 68: ...CR300 Series Datalogger 58...
Page 70: ......
Page 85: ......