Section 7. Installation
Several variables can be declared on a single line, separated by commas:
Public RefTemp, AirTemp2, Batt_Volt
Variables can also be assigned initial values in the declaration. Following is an
example of declaring a variable and assigning it an initial value.
Public SetTemp = {35}
In string variables, string size defaults to 24 characters (changed from 16
characters in April 2013, OS 26).
7.8.4.3.1 Declaring Data Types
Variables and data values stored in final memory can be configured with various
data types to optimize program execution and memory usage.
The declaration of variables with the
Dim
or
Public
instructions allows an
optional type descriptor
As
that specifies the data type. The default data type
(declaration without a descriptor) is
IEEE4
floating point, which is equivalent to
the
As Float
declaration. Variable data types are listed in the table
Data Types in
Variable Memory
Final-data memory data types are listed in the table
Data Types in Final-Data Memory
(p. 131).
CRBasic example
Data Type
Declarations
shows various data types in use in the declarations and output
sections of a program.
CRBasic allows mixing data types within a single array of variables; however,
this practice can result in at least one problem. The datalogger support software is
incapable of efficiently handling different data types for the same field name.
Consequently, the software mangles the field names in data file headers.
Table 11.
Data Types in Variable Memory
Name
Command
Description
Word Size
(Bytes)
Notes
Resolution / Range
Float
As Float
or
As IEEE4
IEEE floating point
4
Data type of all variables unless
declared otherwise.
IEEE Standard 754
±
1.4E–45 to
±
3.4E38
Long
As Long
Signed integer
4
Use to store count data in the range of
±
2,147,483,648
Speed: integer math is faster than
floating point math.
Resolution: 32 bits. Compare to 24
bits in IEEE4.
Suitable for storing whole numbers,
counting number, and integers in
final-data memory. If storing non-
integers, the fractional portion of the
value is lost.
–2,147,483,648 to +2,147,483,647
Boolean
As 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 the section
True = -
1, False = 0
(p. 164).
True = –
1 or any number ≥ 1
False = any number ≥ 0 and < 1
130
Summary of Contents for CR1000
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 40: ......
Page 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Page 96: ......
Page 98: ...98 ...
Page 302: ......
Page 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Page 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Page 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Page 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Page 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Page 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Page 478: ......
Page 506: ......
Page 536: ......
Page 636: ......
Page 642: ......
Page 644: ......
Page 676: ......
Page 677: ......