Shop OBEX P1 Docs P2 Docs Learn Events
Loop out of the program — Parallax Forums

Loop out of the program

WILLQHWILLQH Posts: 11
edited 2006-01-20 16:10 in Learn with BlocklyProp
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

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-01-20 07:19
    WILLQ -

    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
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-20 13:28
    I think the likely culprit is that you are reseting the stamp (Bruce's brownout event), make sure your not trying to drive anything requiring much current from the on-board regulator on the stamp (<50ma or so), or overtaxing any off-board regulator you may have. Without knowing you hardware setup, it hard to pinpoint the exact cause for the stamp resetting.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • neotericneoteric Posts: 144
    edited 2006-01-20 15:19
    Also, check your batteries.· If they are geting low, this will cause some surprising results.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-01-20 16:10
    Posting your code will better help us to identify the problem or at least determine if it's related to the code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.