SlowSequence 'Begin slow sequence
'Declare Public Variables for Secondary Scan (can be declared at head of program)
Public Batt_Volt
Public Counter2
'Declare Data Table
DataTable(DataTable2,1,-1) 'DataTable2 is event driven.
'The event is the scan.
Sample(1,Batt_Volt,FP2)
Sample(1,Counter2,FP2)
EndTable
Scan(5,Sec,0,0) 'Begin 1st secondary scan
Counter2 = Counter2 + 1
Battery(Batt_Volt)
CallTable DataTable2 'Call DataTable2
NextScan 'End slow sequence scan
EndProg 'End executable section of program
7.9.2 Compiling: Conditional Code
When a CRBasic user program is sent to the CR1000, an exact copy of the
program is saved as a file on the CPU: drive
(p. 371). A binary version of the
program, the "operating program", is created by the CR1000 compiler and written
to Operating Memory
(p. 372). This is the program version that runs the CR1000.
CRBasic allows definition of conditional code, preceded by a hash character (#),
in the CRBasic program that is compiled into the operating program depending on
the conditional settings. In addition, all Campbell Scientific datalogger (except
the CR200) accept program files, or Include() instruction files, with .DLD
extensions. This feature circumvents system filters that look at file extensions for
specific loggers; it makes possible the writing of a single file of code to run on
multiple models of CRBasic dataloggers.
Note Do not confuse CRBasic files with .DLD extensions with files of .DLD
type used by legacy Campbell Scientific dataloggers.
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
This logic allows a simple change of a constant to direct, for instance, which
measurement instructions to include.
CRBasic Editor now 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
180