122-32000 Parallax Inc, 122-32000 Datasheet - Page 296

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Since the Start and Finish fields can be expressions, they can contain variables. The next
example assumes that
The above example uses a nested loop. The outer loop (the first one) repeats 2 times. The
inner loop repeats with
The inner loop increments the values in RAM locations $7000 to $7009, in that order,
because the inner loop is counting iterations from 0 to 9. Then, the inner loop terminates
(with
the Start and Finish values. Since this is still inside the outer loop, the outer loop then
executes its contents again (for the second time) causing the inner loop to repeat with
from 9 down to 0. The inner loop increments the values in RAM locations $7009 to $7000,
in that order (reverse of the previous time) and terminates with
two lines set
REPEAT
REPEAT
Variable by the Delta amount. In the syntax 2 form,
value, but when the “
depending on the range of Start and Finish. The following example includes the optional
Delta value to increment by 2.
Here,
effectively increments every other RAM location (the even numbered locations) from $7000
to $7008 and terminates with
The Delta field can be positive or negative, regardless of the natural ascending/descending
range of the Start and Finish values, and can even be adjusted within the loop to achieve
interesting effects. For example, assuming
following code sets
Page 296 · Propeller Manual v1.0
S := 0
F := 9
repeat 2
repeat Index from 0 to 8 step 2 'Repeat 5 times
repeat Index from S to F
S := 9
F := 0
byte[$7000][Index]++
Index
REPEAT
loops don’t have to be limited to incrementing or decrementing by 1 either. If the
command uses the optional
byte[$7000][Index]++
being set to 10) and the last two lines set
– Spin Language Reference
S
loops five times, with
and
F
Index
again, but the outer loop does not repeat a third time.
S
STEP
Index
and
to the following sequence: 5, 6, 6, 5, 3.
Delta” component is omitted, it uses either +1 or -1 by default,
F
Index
are variables created previously.
from
S
equaling 10.
STEP
Index
to
F
, which were previously set to 0 and 9, respectively.
Delta syntax, it will increment or decrement the
'Repeat twice
'Repeat 10 times
'Increment RAM locations 7000..$7009
set to 0, 2, 4, 6, and 8, respectively. This code
Index
'Increment even RAM $7000 to $7008
and
REPEAT
S
D
to 9 and
are previously defined variables, the
is actually always using a Delta
Index
F
to 0, effectively swapping
equaling -1. The last
Index

Related parts for 122-32000