beautypg.com

3 user flags, 8 program control logical constructions – Campbell Scientific CR510 Basic Datalogger User Manual

Page 52

background image

SECTION 3. INSTRUCTION SET BASICS

3-4

TABLE 3.7-2. Example of the Use of Flag 9

1: If time is (P92)

1:

0

Minutes (Seconds --) into a

2:

10

Interval (same units as above)

3:

10

Set Ouptut Flag High (Flag 0)

2: If (X

!F) (P89)

1:

14

X Loc [ Wind_spd ]

2:

4

<

3:

4.5

F

4:

19

Set Intermed. Proc. Disable Flag High (Flag 9)

3: Histogram (P75) ; See Section 11 for details of this intruction.

4: Do (P86) ; Required when additional output processing follows

1:

29

Set Intermed. Proc. Disable Flag Low (Flag 9)

5: Maximum (P73)

1:

1

Reps

2:

00

Time Option

3:

14

Loc [ Wind_spd ]

As an example, suppose it is desired to obtain a
wind speed rose incorporating only wind speeds
greater than or equal to 4.5 m/s. The wind
speed rose is computed using the Histogram
Instruction 75, and wind speed is stored in input
location 14, in m/s. Instruction 89 is placed just
before Instruction 75 and is used to set Flag 9
high if the wind speed is less than 4.5 m/s:

NOTE: Flag 9 is automatically reset the
same as Flag 0. If the intermediate
processing disable flag is already set high
and the test condition of a subsequent
Program Control Instruction acting on Flag
9 fails, the flag is set low. This feature
eliminates having to enter another
instruction to specifically reset Flag 9 low
before proceeding to another group of test
conditions.

3.7.3 USER FLAGS

Flags 1-8 are not dedicated to a specific
purpose and are available to the user for
general programming needs. The user flags
can be manually toggled from the keyboard in
the

6 Mode (Section 1.3). By inserting the flag

test (Instruction 91) at appropriate points in the
program, the user can use the

6 Mode to

manually direct program execution.

3.8 PROGRAM CONTROL LOGICAL

CONSTRUCTIONS

Most of the Program Control Instructions have a
command code parameter which is used to
specify the action to be taken if the condition
tested in the instruction is true. Table 3.8-1 lists
these codes.

TABLE 3.8-1. Command Codes

0

Go to end of program table

2

1-9, 79-99

Call Subroutine 1-9, 79-99

1

10-19

Set Flag 0-9 high

20-29

Set Flag 0-9 low

30

Then Do

31

Exit loop if true

32

Exit loop if false

41

Set Port 1 high

51

Set Port 1 low

61

Toggle Port 1

71

Pulse Port 1

1

98 is a special subroutine which can be
called by Control port 2 going high; see
Instruction 85 for details (Section 12).

2

If this command is executed while in a
subroutine, execution jumps directly to the
end of the table that called the subroutine.