Loop out of the program
WILLQH
Posts: 11
Hii,
· Sometimes while running my program, the program will loop itself back to the start, even·though the program sequence has not been·completed. May I know what are some of the possible reason for this ? Is it·because the processor encountered some error while trying to run the program ??
Thanks
Regards
· Sometimes while running my program, the program will loop itself back to the start, even·though the program sequence has not been·completed. May I know what are some of the possible reason for this ? Is it·because the processor encountered some error while trying to run the program ??
Thanks
Regards
Comments
If there is a label (often "Main", "Start" or "Begin") at the beginning of your program, make sure you're not branching there inadvertantly. If there is no label at the beginning then the program is restarting.
A program will restart due to some external event which has caused the brown-out circuit to kick in (low source voltage) or the when the Stamp's ATN line has been activated. The brown-out circuit can also kick in if there is too heavy an output load on one or more of the output pin ports, or a short which is causing an extreme power draw-down.
The easiest way to detect if a restart has occurred, is to add the following to the very beginning of your program:
DEBUG "Starting"
If you see "Starting" displayed more than one, any time you run your program, you will know that the program has restarted, since there is no label before it to branch to. Thus, the only way to get there is at the first iteration of your program, and any time it restarts thereafter.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com