6.5.5 Loops
Although list jumps, see
Chapter 6.5.3 "Jumps",
page
120, and conditional jumps, see
"Conditional Command Execution", page
you repeat any number of list commands limitlessly
or under external control, precisely specifying the
number of executions is not always reliably possible.
But this can be achieved by the command pair
list_repeat
and list_until. The command sequence
between these two short list commands execute
exactly as often as specified with the
command's parameter, but at least once. Here,
nesting up to 8 loops deep is allowed.
list_repeat
and
list_until
pairs. Unpaired or supernumerous commands
(list_until
without an associated list_repeat, as well
as
list_repeat
commands leading to a nesting depth
greater than 8) are ignored. Empty loops (for
example,
list_repeat
directly followed by list_until)
terminate immediately and are not repeated.
The command pairs can be located both within lists
and within subroutines.
list_until
Within subroutines,
list_jump_rel
to the address directly after the
associated list_repeat. Loops do not function
beyond the boundaries of a subroutine, because list
jumps into or out of subroutines are not allowed, see
Chapter 6.5.3 "Jumps", page
Within lists, however,
list_until
list_jump_pos
(to the address directly after the
associated list_repeat). Thus,
list_until
can even reside in two different lists,
provided that list changing is ensured (by either an
explicit list jump or an automatic list change).
If, on the other hand, a list actually has been
terminated (as may be the case when using
auto_change_pos), then the
automatically deleted and the started loop can no
longer be ended because the next
finds an associated list_repeat.
RTC6 boards
Doc. Rev. 1.0.21 en-US
6 Developing RTC6-User Programs
Chapter 9.3.2
295, let
list_until
must always be used in
performs a
120.
executes a
list_repeat
and
list_repeat
stack gets
list_until
no longer
set_end_of_list
deletes the entire loop
management, if no automatic list change is pending,
but
list_return
does not.
Explicit list jumps into or out of the body of a
list_repeat/list_until
loop are allowed because they
cannot be monitored. Careless use could therefore
compromise loop management integrity so severely
that started loops do not execute as expected (but
subroutine calls from inside a loop are always reliably
possible as long as the subroutine itself contains no
list_repeat/list_until
unpaired
If a
list_repeat/list_until
loop is to be executed with
an initially unknown number of repetitions, a high
value (for example, greater than the highest expected
number) can be specified for the
list_until. Within the loop, a conditional branch (for
example, which is dependent on an external signal)
can jump to a position outside the loop and leave the
loop this way. At this point there should be a
Number
list_until(
= 0 ) to end the just left loop
properly.
commands).
Number
parameter of
122
Need help?
Do you have a question about the RTC6 PCIe Board and is the answer not in the manual?