Hello, all 8 Cog Worlds ! each cog blinks a led with its #+1, challenge.
Phillip Y.
Posts: 62
This example program uses all 8 cogs,
they all·blink CogId+1·then wait for all to finish,
then ClkSet($80) reboots.
My 3 challenges·are;
#1·to use the;
PUB BlinkNextLED (loaded into·cogs 1-7)
to load cog 0 instead of loading it first seperatly.
#2 (Use an aray to) shorten this;
VAR
· long stack1[noparse][[/noparse]6]
· long stack2[noparse][[/noparse]6]
· long stack3[noparse][[/noparse]6]
· long stack4[noparse][[/noparse]6]
· long stack5[noparse][[/noparse]6]
· long stack6[noparse][[/noparse]6]
· long stack7[noparse][[/noparse]6]
· long stack8[noparse][[/noparse]6]·· .
··
#3 (Use an aray to) shorten this;
PUB
· cognew (BlinkNextLed, @stack2)
· cognew (BlinkNextLed, @stack3)
· cognew (BlinkNextLed, @stack4)
· cognew (BlinkNextLed, @stack5)
· cognew (BlinkNextLed, @stack6)
· cognew (BlinkNextLed, @stack7)
· cognew (BlinkNextLed, @stack8)· .
Phillip Y.
they all·blink CogId+1·then wait for all to finish,
then ClkSet($80) reboots.
My 3 challenges·are;
#1·to use the;
PUB BlinkNextLED (loaded into·cogs 1-7)
to load cog 0 instead of loading it first seperatly.
#2 (Use an aray to) shorten this;
VAR
· long stack1[noparse][[/noparse]6]
· long stack2[noparse][[/noparse]6]
· long stack3[noparse][[/noparse]6]
· long stack4[noparse][[/noparse]6]
· long stack5[noparse][[/noparse]6]
· long stack6[noparse][[/noparse]6]
· long stack7[noparse][[/noparse]6]
· long stack8[noparse][[/noparse]6]·· .
··
#3 (Use an aray to) shorten this;
PUB
· cognew (BlinkNextLed, @stack2)
· cognew (BlinkNextLed, @stack3)
· cognew (BlinkNextLed, @stack4)
· cognew (BlinkNextLed, @stack5)
· cognew (BlinkNextLed, @stack6)
· cognew (BlinkNextLed, @stack7)
· cognew (BlinkNextLed, @stack8)· .
Phillip Y.
Comments
Is this what you wanted?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
"This includes the current cog; i.e.: a cog can use COGINIT to stop and restart itself to run, perhaps, completely different code."
Now I need some data to persist past the ReBoot so I can alternate the blink direction at each ReBoot.
Should this be in main ram or cog0 ram ?
How do you force the location of a var to either location ?
Phillip Y.
Spin keeps ALL its variables and code in System(HUB) RAM.
The only thing that is loaded in the COGs is the interpreter and whatever tokens it is interpreting at the moment. (There's not room for anything else.)
The only way to 'persist' data through a Reboot is to store it externally.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...
After 6 cycles·P10 or P10 ·reaches the proper treshold to work properly and alternate the direction of blinking.
This is·like a·Dram bit.
I am concerned with the 0.1uF cap on P8 and the 50ma output ability of each pin,
·since this will look like a short circuit while it is charging or discharging with out a current limiting resistor
·like P10 and P11 have, espeialy if it was used at a higher frequency.
Is the ELECTRET MIC active or passive ?
Is there a part # to look it up ?
Chip Gracey
Parallax, Inc.