Loops
With
Counters
(DSE, ISG)
When
you
want
to
execute
a
loop
a
specific
number
of
times,
usethe
DSE
(decrement;
skip
if
less
than
or
equal
to)
or
ISG
(increment;
skip
if
greater
than)
conditional
functions
in the
LOOP
menu
(Hi loop
I).
Each time a LOOP function is executedin a program, it automatically
decrements
or
increments a
counter
value
stored
in
a
variable.
It
com
pares
the
current
counter
value
to a
final
counter
value,
then
continues or
exits
the loop depending on the result.
For a count-down loop, use:
HI
loop
I
{DSE}
variable
For a count-up loop, use:
Bl
loop
I
{ISG}
variable
These functions accomplish the same thing as a
FOR-NEXT
loop in
BASIC:
FOR
variable
= initial-value TO
final-value
STEP
increment
NEXT
variable
A DSE instruction is like a FOR-NEXT loop with a negative
increment.
After pressing the menu key for {DSE} or {ISG}, you will be
promptedfor a
variable
that will contain the
loop-control
number
(de
scribed below).
The
Loop-Control Number. The specified variable should contain a
loop-control number
±ccccccc.fffii,
where:
• ±ccccccc is the current counter value (1 to 12 digits). This value
changes
with loop execution.
• fffis the final counter value (must be three
digits).
Thisvalue does
not change as the loop runs.
• ii is the interval for incrementing and decrementing (must be two
digits or unspecified). This value does
not
change. An unspecified
value for ii is assumed to be 01 (increment/decrement by 1).
6:
Programming
Techniques
101