2 the intermediate processing disable flag, 3 user flags, 8 program control logical constructions – Campbell Scientific CR7 Measurement and Control System User Manual

Page 46: 1 if then/else comparisons

Advertising
background image

SECTION 3. INSTRUCTION SET BASICS

3-4

NOTE: If the Output Flag is already set
high and the test condition of a subsequent
Program Control Instruction acting on the
flag fails, the flag is set low. This feature
eliminates having to enter another
instruction to specifically reset the Output
Flag at the end of an output array before
proceeding to another group of Output
Instructions with a different output interval
(see example in OV4.3).

3.7.2 THE INTERMEDIATE PROCESSING

DISABLE FLAG

The Intermediate Processing Disable Flag, Flag
9, suspends intermediate processing when it is
set high. This flag is used to restrict sampling
for averages, totals, maxima, minima, etc., to
times when certain criteria are met. The flag is
automatically set low at the beginning of the
program table.

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:

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

Inst. Param.
Loc. No.

Entry

Description

X

P

89

If wind speed < 4.5 m/s

1

14

Wind speed location

2

4

Comparison: <

3

4.5

Minimum wind speed for

histogram

4

19

Set Flag 9 high

X+1

P

75

Histogram

X+2

P

86

Do

1

29

Set Flag 9 Low

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 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) or from a computer
using TERM's monitor feature. By inserting flag
tests (Instruction 91) at appropriate points in the
program, the user can manually set flags to
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

1-9, 79-99 -

Call Subroutine 1-9, 79-99

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-48 -

Set port 1 - 8 high*

51-58 -

Set port 1 - 8 low*

61-68 -

Toggle port 1 - 8*

71-78 -

Pulse port 1 - 8* 100 ms

* Port commands default to Excitation Card 1;
Instruction 20 is used to change to another
card.

3.8.1 IF THEN/ELSE COMPARISONS

When Command 30, THEN DO, is used with
one of the IF Instructions, 88-92, the instruction
is followed immediately by instructions to

Advertising