beautypg.com

Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 217

background image

Section 9. Program Control Instructions

9-11

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

Power Off

Used to turn the CR5000 off until a designated time.

Syntax
PowerOff(
StartTime, Interval, Units)

Parameter
& Data Type

Enter

Start Time
Array

The name of a six element array that contains the start time: Year, month,
day, hour, minutes, and seconds, respectively.

Interval
Constant

Enter the time interval on which the CR5000 is to be powered up.

Units

The units for the time parameters.

Constant

Alpha
Code

Numeric
Code

Units

SEC

2

seconds

MIN

3

minutes

HR

4

hours

DAY

5

days

Remarks
This instruction sets a time to power up and then shuts off CR5000 power.
Only the clock continues running while the CR5000 is powered down. When
the time to power up arrives, the power is restored, the CR5000 reloads its
program from Flash memory and begins running.

The interval allows the CR5000 to periodically power up and execute a program.
StartTime is a time value. If StartTime is in the future when PowerOff is
executed, it is the time the CR5000 will be programmed to power up. If
StartTime is in the past when PowerOff is executed, The CR5000 will set the
time to power up to the next occurrence of the interval (using StartTime as the
start of the first interval)

The units for the interval are days, hours, minutes, or seconds.

When the CR5000 is in this power off state the ON Off switch is in the on position
just like when the CR5000 is turned off from the keyboard’s configure menu. The
CR5000 will wake up if a key is pressed on the keyboard or in response to
communication on the CSI/O or RS232 ports.