Section 7. Installation
CRBasic Example 8.
Using the Const Declaration
'This program example demonstrates the use of the Const declaration.
'Declare variables
Public
PTempC
Public PTempF
'Declare constants
Const
CtoF_Mult = 1.8
Const
CtoF_Offset = 32
BeginProg
Scan
(1,Sec,0,0)
PanelTemp
(PTempC,250)
PTempF = PTempC * Cto CtoF_Offset
NextScan
EndProg
7.8.4.7.1 Predefined Constants
Many words are reserved for use by CRBasic. These words cannot be used as
variable or table names in a program. Predefined constants include instruction
names and valid alphanumeric names for instruction parameters. On account the
list of predefined constants is long and frequently increases as the operating
system is developed, the best course is to compile programs frequently during
CRBasic program development. The compiler will catch the use of any reserved
words. Following are listed predefined constants that are assigned a value:
•
LoggerType = 1000 (as in CR1000)
These may be useful in programming.
7.8.4.8 Declaring Aliases and Units
A variable can be assigned a second name, or alias, in the CRBasic program.
Aliasing is particularly useful when using arrays. Arrays are powerful tools for
complex programming, but they place near identical names on multiple variables.
Aliasing allows the power of the array to be used with the clarity of unique
names.
The declared variable name can be used interchangeably with the declared alias in
the body of the CRBasic program. However, when a value is stored to final-
memory, the value will have the alias name attached to it. So, if the CRBasic
program needs to access that value, the program must use the the alias-derived
name.
Variables in one, two, and three dimensional arrays can be assigned units. Units
are not used elsewhere in programming, but add meaning to resultant data table
headers. If different units are to be used with each element of an array, first
assign aliases to the array elements and then assign units to each alias. For
example:
Alias var_array(1) = solar_radiation
Alias var_array(2) = quanta
Units solar_radiation = Wm-2
Units variable2 = moles_m-2_s-1
138
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: ......