
Appendix B. Introduction to CRBasic Programming
B-3
code. When the CR300 compiler sees a single quote ('), it ignores the rest of
the line.
CRBasic Example B-2. Inserting Comments
'This program example demonstrates the insertion of comments into a program. Comments are
'placed in two places: to occupy single lines, such as this explanation does, or to be
'placed after a statement.
'Declaration of variables starts here.
Public
Start(6)
'Declare the start time array
BeginProg
EndProg
B.2 Variables
A variable is a packet of memory that is given an alphanumeric name.
Measurements and processing results pass through variables during program
execution. Variables are declared as
Public
or
Dim
.
Public
variables are
viewable through datalogger support software.
Dim
variables cannot be
viewed.
Declared variables are initialized once when the program starts.
Variable names can be up to 39 characters in length, but most variables should
be no more than 35 characters long. This allows for four additional characters
that are added as a suffix to the variable name when it is output to a data table.
Variable names can contain the following characters:
•
A to Z
•
a to z
•
0 to 9
•
_ (underscore)
•
$
Names must start with a letter, underscore, or dollar sign. Spaces and quotation
marks are not allowed. Variable names are not case sensitive.
Keywords and predefined constants are reserved for CR300 use
and will cause a runtime or compile error if used otherwise.
CRBasic Editor Help
provides a list of keywords and predefined
constants.
Several variables can be declared on a single line, separated by commas:
Public
RefTemp, AirTemp2, Batt_Volt
By default, variables are set equal to zero at the time the datalogger program
compiles. 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}
NOTE
Summary of Contents for CR300 series
Page 2: ......
Page 6: ......
Page 68: ...CR300 Series Datalogger 58...
Page 70: ......
Page 85: ......