Crbasic example 9. data type declarations – Campbell Scientific CR3000 Micrologger User Manual
Page 125

Section 7. Installation
125
Table 12. Data Types
Name:
Command
or
Argument
Description /
Word Size
Where Used
Notes
Resolution / Range
As Boolean
BOOLEAN
Signed Integer /
4 byte
Dim & Public
variables
Final data storage
Use to store TRUE or FALSE states, 
such as with 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 True = -1, False = 0 (p. 
150).To save memory, consider using 
UINT2 or BOOL8. 
0, -1
BOOL8
Integer /
1 byte
Final data storage
8 bits (0 or 1) of information. Uses less 
space than 32-bit BOOLEAN. Holding 
the same information in BOOLEAN will 
require 256 bits. See Bool8 Data Type 
(p. 232). 
0, -1
NSEC
Time Stamp /
8 byte
Final data storage
Divided up as four bytes of seconds 
since 1990 and four bytes of 
nanoseconds into the second. Used to 
record and process time data. See NSEC 
Data Type (p. 228). 
1 nanosecond
As String
STRING
ASCII String /
word size varies
Dim & Public
variables
Final data storage
Size is defined by the CR3000 operating 
system. 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 separated by non-numeric 
characters, SplitStr() can be used to 
parse out the numeric values. See String 
Operations (p. 241) and Serial I/O (p. 
205). 
Unless declared otherwise, the minimum 
string size is 16 bytes or characters. Size 
above 16 bytes increases in multiples of 
four bytes; for example, String * 18 
allocates 20 bytes (19 usable). 
CRBasic Example 9.
Data Type Declarations
'Float Variable Examples
Public
Z
Public
X
As Float
'Long Variable Example
Public
CR3000Time
As Long
Public
PosCounter
As Long
Public
PosNegCounter
As Long
Boolean Variable Examples
Public
Switches(8)
As Boolean
Public
FLAGS(16)
As Boolean
'String Variable Example
Public
FirstName
As String
* 16
'allows a string up to 16 characters long
