end program
guili_23
Posts: 11
Hi all,
I ´m new using the propeller chip and while I was learning who to use spin languages a doubt poped up. Is it a way to finish the main program in the middle of the running ? (for example because of a FALSE condition). And if it is so, what should I take in consideration to finish in a proper way ?
Thanks in advance.
BR !
I ´m new using the propeller chip and while I was learning who to use spin languages a doubt poped up. Is it a way to finish the main program in the middle of the running ? (for example because of a FALSE condition). And if it is so, what should I take in consideration to finish in a proper way ?
Thanks in advance.
BR !
Comments
When you say "end' the program, what exactly do you want the program to do upon a condition? There are a number of ways to stop what the program is doing, including shutting down the cog or restarting the Prop, or getting out of a repeat loop with : ABORT, QUIT, RETURN. You can see examples if each of these in the Propeller manual.
-Phil
I thought that's what you use clkset(2, 0) for (SCNR).
-Phil
It's the official suspend mode used in the boot loader when external sources have been exhausted. Besides, OSCENA is disabled so XI is not relevant at this point.
Anyway, sorry for this OT discussion.
That's a new one on me! Where is it documented? My Prop manual shows a clkmode of 2 being equivalent to XINPUT.
-Phil
That's official enough for me Sorry, should have been more clear on the nature of official.
-Phil
- revoke I/O assignments
- single cog
- multiple cogs
- keep outputs alive but stop execution (all active cogs)
- reset (and re-boot) chip
As well as combinations of the above (e.g. shutdown selected cogs then enter suspend mode).- cogstop(cogid)
- Note that exiting the main method (first PUBlic method) in the top object will also stop the corresponding cog. The same is true for an uncaught abort.
- clkset(%0000_0010, 0)
- clkset(%1000_0000, 0)
Note, if you have drivers active which need to be shutdown properly then use the appropriate methods. Just forcing them to shutdown may lead to data loss.
PUB Main
...
if <condition>
Program_finish
...
<more code>
...
PUB Program_finish
clkset(%0000_0010, 0)
Sure, just be aware that all outputs stay outputs in this case.