Why won't this program work?
RichardF
Posts: 168
This works:
Pub start
·dira[noparse][[/noparse]23]~~
·led_on
Pri led_on
·repeat
· outa[noparse][[/noparse]23]~~
This doesn't!
Var
·long stack0[noparse][[/noparse]20]
Pub start
·dira[noparse][[/noparse]23]~~
·cognew(led_on, @stack0)
Pri led_on
·repeat
· outa[noparse][[/noparse]23]~~
Please help me solve this most basic problem.
·
Pub start
·dira[noparse][[/noparse]23]~~
·led_on
Pri led_on
·repeat
· outa[noparse][[/noparse]23]~~
This doesn't!
Var
·long stack0[noparse][[/noparse]20]
Pub start
·dira[noparse][[/noparse]23]~~
·cognew(led_on, @stack0)
Pri led_on
·repeat
· outa[noparse][[/noparse]23]~~
Please help me solve this most basic problem.
·
Comments
If you leave out the repeat, the newly started cog routine (led_on) exits immediately, stopping it.
The initial cog (with the start stuff in it) stops itself immediately after the COGNEW is executed.
·I honestly studied the manual and never picked up on each cog having its' own dira and outa registers, but... with a little thought, it is obvious it has to be that way! Thanks for the help.
Richard
That bit me in the butt a couple times too. So don't feel bad.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
Page 26, I/O pins
I got bitten today [noparse]:)[/noparse]
Graham