beautypg.com

88 if x compared to y, 89 if x compared to f – Campbell Scientific CR10X Measurement and Control System User Manual

Page 186

background image

SECTION 12. PROGRAM CONTROL INSTRUCTIONS

12-4

The Loop with a delay may be used so that only
those instructions within the Loop are executed
while certain conditions are met. As a simple
example, suppose it is desired to execute one
set of instructions from midnight until 6 AM,
another set between 6 AM and 4 PM, and a
third set between 4 PM and midnight. Between
6 AM and 4 PM, samples are desired every 10
seconds; the rest of the time one minute
between samples is sufficient. The execution
interval is set to 10 seconds; when a one minute
sample rate is desired, a delay of 6 (6 x 10s =
60s) is used in the loop.

TABLE 12-4. Example: Loop with Delay

*

1

Table 1 Programs

01:

10

Sec. Execution Interval

01:

P87

Beginning of Loop

01:

6

Delay

02:

0

Loop Count

11:

P86

Do

01:

1

Call Subroutine 1

12:

P89

If X<=>F

01:

25

X Loc DAY

02:

3

>=

03:

6

F

04:

31

Exit Loop if true

13:

P95

End

14:

P87

Beginning of Loop

01:

1

Delay

02:

0

Loop Count

27:

P86

Do

01:

1

Call Subroutine 1

28:

P89

If X<=>F

01:

25

X Loc DAY

02:

3

>=

03:

16

F

04:

31

Exit Loop if true

29:

P95

End

30:

P87

Beginning of Loop

01:

6

Delay

02:

0

Loop Count

36:

P86

Do

01:

1

Call Subroutine 1

37:

P89

If X<=>F

01:

25

X Loc DAY

02:

3

>=

03:

5

F

04:

32

Exit Loop if false

38:

P95

End

39:

P

End Table 1

*

3

Table 3 Subroutines

01:

P85

Beginning of Subroutine

01:

1

Subroutine Number

02:

P18

Time

01:

2

Hours into current year
(maximum 8784)

02:

24

Mod/by

03:

25

Loc [:DAY ]

03:

P95

End

*** 88 IF X COMPARED TO Y ***

FUNCTION
This Instruction compares two input locations
and, if the result is true, executes the specified
Command. The comparison codes are given in
Table 12-5.

PARAM.

DATA

NUMBER

TYPE

DESCRIPTION

01:

4

Input location for X

02:

2

Comparison code
(Table 12-5)

03:

4

Input location for Y

04:

2

Command (Table 12-2)

TABLE 12-5. Comparison Codes

Parameter 1

Function

1

IF X = Y

2

IF X

≠Y

3

IF X

≥ Y

4

IF X < Y

*** 89 IF X COMPARED TO F ***

FUNCTION
This Instruction compares an input location to a
fixed value and, if the result is true, performs
the specified Command. The comparison codes
are given in Table 12-5.

PARAM.

DATA

NUMBER

TYPE

DESCRIPTION

01:

4

Input location for X

02:

2

Comparison code
(Table 12-5)

03:

FP

Fixed value

04:

2

Command (Table 12-2)