2 nesting, 9 instruction memory and execution time – Campbell Scientific CR10X Measurement and Control System User Manual
Page 59

SECTION 3. INSTRUCTION SET BASICS
3-5
FIGURE 3.8-2. Logical AND Construction
If Then/Else comparisons may be nested to
form logical AND or OR branching. Figure 3.8-
2 illustrates an AND construction. If conditions A
and B are true, the instructions included
between IF B and the first End Instruction will
be executed.
If either of the conditions is false, execution will
jump to the corresponding End Instruction,
skipping the instructions between.
A logical OR construction is also possible.
Figure 3.8-3 illustrates the instruction sequence
that will result in subroutine X being executed if
either A or B is true.
IF A (88-92 with command 30)
Call subroutine X (86, command=X)
ELSE (94)
IF B (88-92 with command 30)
Call subroutine X (86, command=X)
END B (95)
END A (95)
FIGURE 3.8-3. Logical OR Construction
A logical OR can also be constructed by setting
a flag if a comparison is true. (The flag is
cleared before making comparisons.) After all
comparisons have been made, execute the
desired instructions if the flag is set.
The Begin Case Instruction 93 and If Case
Instruction 83 allow a series of tests on the
value in an input location. The case test is
started with Instruction 93 which specifies the
location to test. A series of Instruction 83s are
then used to compare the value in the location
with fixed values. When the value in the input
location is less than the fixed value specified in
Instruction 83, the command in that Instruction
83 is executed, and execution branches to the
END Instruction 95 which closes the case test
(see Instruction 93, Section 12).
3.8.2 NESTING
A branching or loop instruction which occurs
before a previous branch or loop has been
closed is nested. The maximum nesting level is
11 deep. Loop Instruction 87 and Begin Case
Instruction 93 both count as 1 level.
Instructions 83, 86, 88, 89, 91, and 92 each
count as one level when used with the
Command "30" which is the "Then Do"
command. Use of Else, Instruction 94, also
counts as one nesting level each time it is used.
For example, the AND construction above is
nested 2 deep while the OR construction is
nested 3 deep.
Subroutine calls do not count as nesting with
the above instructions, though they have their
own nesting limit (maximum of 7, see
Instruction 85, Section 12). Branching and loop
nesting start at zero in each subroutine.
Any number of groups of nested instructions
may be used in any of the three Programming
Tables. The number of groups is only restricted
by the program memory available.
3.9 INSTRUCTION MEMORY AND
EXECUTION TIME
Each instruction requires program memory and
uses varying numbers of Input, Intermediate,
and Final Storage locations. Tables 3.9-1 to
3.9-4 list the memory used by each instruction
and the approximate time required to execute it.
When attempting to make a series of
measurements and calculations at a fast rate, it
is important to examine the time required for the
automatic calibration sequence and possibly
make use of the program controlled calibration,
Instruction 24. Section 13.7 describes the
calibration process.