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

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
Exercise 8: Blinker2.spin – Many Objects, Many Cogs
Now let’s make a new object that takes advantage of the enhancements to Output to use many
cogs for many parallel processes. Here’s the code:
Example Object: Blinker2.spin
{{ Blinker2.spin }}
CON
OBJ
PUB Main
{Toggle pins at different rates, simultaneously}
PUB NextObject : Index
{Scan LED objects and return index of next available LED object.
Page 124 · Propeller Manual v1.0
Scanning continues until one is available.}
MAXLEDS = 6
LED[6] : "Output"
dira[16..23]~~
LED[NextObject].Start(16, 3_000_000,
LED[NextObject].Start(17, 2_000_000,
LED[NextObject].Start(18,
LED[NextObject].Start(19, 6_000_000, 40)
LED[NextObject].Start(20,
LED[NextObject].Start(21, 1_250_000, 250)
LED[NextObject].Start(22,
LED[NextObject].Start(23,
LED[0].Start(20, 12_000_000, 0)
repeat
repeat
while Index == MAXLEDS
repeat Index from 0 to MAXLEDS-1
if not LED[Index].Active
quit
'Number of LED objects to use
600_000, 300)
350_000, 300)
750_000, 200)
400_000, 160)
0)
0)
'Set pins to outputs
'Blink LEDs
'<-Postponed
'<-Postponed
'Restart object 0
'Loop endlessly

Related parts for 122-32000