Section 7. Installation
325
As an example, pseudo code using this feature might be written as:
Const Destination = LoggerType
#If Destination = 3000 Then
<code specific to the CR3000>
#ElseIf Destination = 1000 Then
<code specific to the CR1000>
#ElseIf Destination = 800 Then
<code specific to the CR800>
#ElseIf Destination = 6 Then
<code specific to the CR6>
#Else
<code to include otherwise>
#EndIf
For example, this logic allows a simple change of a constant to direct, which
measurement instructions to include.
CRBasic Editor
features a pre-compile option that enables the creation of a
CRBasic text file with only the desired conditional statements from a larger
master program. This option can also be used at the pre-compiler command line
by using -p <outfile name>. This feature allows the smallest size program file
possible to be sent to the CR6, which may help keep costs down over very
expensive comms links.
CRBasic example
Conditional Code
(p. 325)
shows a sample program that
demonstrates use of conditional compilation features in CRBasic. Within the
program are examples showing the use of the predefined
LoggerType
constant
and associated predefined datalogger constants (
6
,
800
,
1000
, and
3000
).
Conditional Code
'This program example demonstrates program compilation than is conditional on datalogger
'model and program speed. Key instructions include #If, #ElseIf, #Else and #EndIf.
'Set program options based on:
' LoggerType, which is a constant predefined in the CR6 operating system
' ProgramSpeed, which is defined in the following statement:
Const
ProgramSpeed = 2
#If
ProgramSpeed = 1
Const
ScanRate = 1
'1 second
Const
Speed = "1 Second"
#ElseIf
ProgramSpeed = 2
Const
ScanRate = 10
'10 seconds
Const
Speed = "10 Second"
#ElseIf
ProgramSpeed = 3
Const
ScanRate = 30
'30 seconds
Const
Speed = "30 Second"
#Else
Const
ScanRate = 5
'5 seconds
Const
Speed = "5 Second"
#EndIf
Summary of Contents for CR6 Series
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 76: ...Section 5 Overview 76 FIGURE 20 Half Bridge Wiring Example Wind Vane Potentiometer ...
Page 80: ...Section 5 Overview 80 FIGURE 23 Pulse Input Wiring Example Anemometer ...
Page 136: ......
Page 454: ...Section 8 Operation 454 FIGURE 104 Narrow Sweep High Noise ...
Page 459: ...Section 8 Operation 459 FIGURE 106 Vibrating Wire Sensor Calibration Report ...
Page 535: ...Section 8 Operation 535 8 11 2 Data Display FIGURE 121 CR1000KD Displaying Data ...
Page 537: ...Section 8 Operation 537 FIGURE 123 CR1000KD Real Time Custom ...
Page 538: ...Section 8 Operation 538 8 11 2 3 Final Storage Data FIGURE 124 CR1000KD Final Storage Data ...
Page 539: ...Section 8 Operation 539 8 11 3 Run Stop Program FIGURE 125 CR1000KD Run Stop Program ...
Page 541: ...Section 8 Operation 541 FIGURE 127 CR1000KD File Edit ...
Page 546: ......
Page 552: ......
Page 610: ...Section 11 Glossary 610 FIGURE 137 Relationships of Accuracy Precision and Resolution ...
Page 612: ......
Page 648: ......
Page 650: ......
Page 688: ......
Page 689: ......