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

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
Explanation
REPEAT
of loop, including: infinite, finite, with/without loop counter, and conditional zero-to-
many/one-to-many loops.
Indention is Critical
IMPORTANT: Indention is critical. The Spin language relies on indention (of one space or
more) on lines following conditional commands to determine if they belong to that command
or not. To have the Propeller Tool indicate these logically grouped blocks of code on-screen,
you can press Ctrl + I to turn on block-group indicators. Pressing Ctrl + I again will disable
that feature. See Indenting and Outdenting, page 69, and Block-Group Indicators, page 74.
Infinite Loops (Syntax 1)
Truthfully, any of the four forms of
most often for this purpose is syntax 1 without the Count field. For example:
This code repeats the
indented from the
Since Statement(s) is really an optional part of
used as an endless loop that does nothing but keep the cog active. This can be intentional, but
sometimes is unintentional due to improper indention. For example:
The above example is erroneous; the last line is never executed because the
an endless loop that has no Statement(s); there is nothing indented immediately below it, so
the cog simply sits in an endless loop at the
active and consuming power.
Page 294 · Propeller Manual v1.0
repeat
repeat
!outa[25]
!outa[25]
waitcnt(2_000 + cnt)
is the very flexible looping structure for Spin code. It can be used to create any type
Condition(s)
or terminate the loop. When preceded by
when true. When preceded by
– Spin Language Reference
REPEAT
is one or more Boolean expression(s) used by syntax 3 and 4 to continue
!outa[25]
so they belong to the
and
REPEAT
waitcnt(2_000 + cnt)
WHILE
'Repeat endlessly
'Toggle P25
'Pause for 2,000 cycles
'Repeat endlessly
'Toggle P25
can be made into infinite loops, but the form used
, Conditions(s) terminates the loop when
REPEAT
REPEAT
REPEAT
UNTIL
line that does nothing but keep the cog
loop.
, the
, Condition(s) terminates the loop
REPEAT
lines endlessly. Both lines are
<-- This is never run
command by itself can be
REPEAT
above it is
FALSE
.

Related parts for 122-32000