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

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
Simple Finite Loops (Syntax 1)
Most loops are finite in nature; they execute a limited number of iterations only. The
simplest form is syntax 1 with the Count field included.
For example:
The above code toggles P25 ten times, then increments the value in RAM location $7000.
Counted Finite Loops (Syntax 2)
Quite often it is necessary to count the loop iterations so the loop’s code can perform
differently based on that count. The
The next example assumes the variable
Like the previous example, the code above loops 10 times, but each time it adjusts the
variable
and each upon each iteration afterwards
by the “to 9”): ..1, 2, 3…9. After the tenth iteration,
loop will terminate, causing the next code following the
any exists.
byte[$7000][Index]++
locations $7000 to $7009 by 1, one at a time.
The
Finish is increasing or decreasing. Since the above example used 0 to 9, the range is an
increasing range; adjusting
simply reverse the Start and Finish values, as in:
This example also loops 10 times, but counts with
by -1 each time. The contents of the loop still increments the values in RAM, but from
locations $7009 down to $7000. After the tenth iteration,
repeat 10
byte[$7000]++
repeat Index from 0 to 9
repeat Index from 9 to 0
REPEAT
!outa[25]
byte[$7000][Index]++
byte[$7000][Index]++
Index
command automatically determines whether the range suggested by Start and
. The first time through the loop,
The code in the loop uses
; in this case it is incrementing each of the byte-sized values in RAM
Index
by +1 every time. To get the count to go backwards,
REPEAT
'Repeat 10 times
'Toggle P25
'Increment RAM location $7000
'Repeat 10 times
'Increment RAM locations $7000 to $7009
'Repeat 10 times
'Increment RAM $7009 down through $7000
Index
4: Spin Language Reference –
Index
command makes it easy to do this with syntax 2.
was created previously.
will be 1 higher than the previous (as indicated
Index
Index
Index
Index
will be 0 (as indicated by the “from 0”)
as an offset to affect memory,
REPEAT
Index
from 9 down to 0; adjusting
will be incremented to 10 and the
Propeller Manual v1.0 · Page 295
will equal -1.
loop structure to execute, if
Index

Related parts for 122-32000