beautypg.com

Include – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 342

background image

Section 9. Program Control Instructions

For Example

If

a > 1

AND

a <= 100

Then

...

ElseIf

a = 200

Then

...

End If

Select Case may be more useful when evaluating a single
expression that has several possible actions.

TIP

If...Then ... Else Statement Example
The example illustrates the various forms of the If...Then...Else syntax.

Dim X, Y, Temp( 5 )

'Declare variables.

X = Temp( 1 )

If

X < 10

Then

Y = 1

'1 digit.

ElseIf

X < 100

Then

Y = 2

'2 digits.

Else

Y = 3

'3 digits.

End If

. . . .

'Run some code

. . . .

'Run some code

Include

The Include instruction is used to Include a program file segment that is not
contained in the original program.

Syntax
Include "Device: FileName"

Remarks
The Include file can be a subroutine, slow sequence, or any portion of code
that you do not want to include in the main program. The code from the
Include file is inserted in the program wherever the Include statement resides.
If the Include file is not found on the datalogger (or in the same directory in
which the file is being precompiled in CRBasic) an error message will be
returned.

"Device:FileName" The "Device:Filename" argument is the file that contains
the additional code that should be executed. Device = CPU, the file is stored in
datalogger memory. Device = CRD, the file is stored on a compact flash card.

9-12