
CR10X Reference Manual
12-2
Subroutines can be called from within other subroutines (nested). The maximum
nesting level for subroutines is six deep. Attempts to nest more than six deep are
not detected at compilation, but result in a run time error: when the sixth
subroutine attempts to call the seventh, error 31 is displayed. Execution does not
branch to the seventh subroutine, but continues with the instruction following that
calling the subroutine.
Port Interrupt Subroutines (96, 97 and 98)
If subroutine 96, 97 or 98 is included in Table 3 then a rising edge on control port
6 (subroutine 96), port 7 (subroutine 97) or 8 (subroutine 98) causes an interrupt
which calls the subroutine. These subroutines can also be called as normal from
any table.
Special subroutines 96, 97 and 98, initiated by a port going high (see above), can
interrupt either Table 1 or 2, or can occur when neither Table is being executed.
These subroutines can interrupt a table while the Output Flag (flag 0) is set. When
the port activating subroutine 96, 97 or 98 goes high during the execution of a
table, the instruction being executed is completed before the subroutine is run (i.e.
it is as if the subroutine was called by the next instruction).
The priority order is subroutine 98, subroutine 97, subroutine 96, Table 1, Table
2. If subroutines 96, 97 and 98 are all pending (ports go high at the same time or
all go high during the execution of the same instruction in one of the tables),
subroutine 98 will be executed first, then subroutine 97 and finally subroutine 96.
Subroutines 96, 97 and 98 cannot interrupt each other, and cannot be interrupted
by a program table. However, when subroutines 96, 97 and 98 interrupt a table, it
is as if the subroutine were in that table. For example, if subroutine 98 interrupts
Table 2, either Table 1 or subroutine 97 or subroutine 96 can interrupt it.
While subroutine 96, 97 or 98 is being executed as a result of the appropriate port
going high, that port interrupt is disabled (i.e. the subroutine must be completed
before the port going high will have any effect).
If control ports 6, 7 or 8 are used for pulse measurement or interrupt
subroutines the CR10X will not go into the quiescent power state
(1mA) if any one of control ports 6, 7 or 8 is high.
Control port 6 cannot be used as a pulse input or interrupt
subroutine while using any of the following instructions:
•
Serial I/O (Instruction 15)
•
SDI-12 (Instructions 105 and 106)
•
SDM instructions (Instructions 100-102, 107, 113 or 116).
Error E33 will be displayed when you compile the program if
the above instructions are used together.
PARAM.
DATA
NUMBER TYPE
DESCRIPTION
01:
2
Subroutine number
(1-9, 79-99)
NOTE
CAUTION