Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp programming — Parallax Forums

basic stamp programming

NikolayNikolay Posts: 8
edited 2009-02-22 02:44 in BASIC Stamp
here is my question...

after you write your program and click run, the program is downloaded into the basic stamp, but it is not executed.

is it possible to get it to execute the program after download, without unplugging the serial cable and pressing reset? if so how.

Thank you for your time.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-21 05:43
    When you click the menu item for RUN, the program is downloaded and it is executed. I'm not aware of any way to just download it without executing it.
  • remmi870remmi870 Posts: 79
    edited 2009-02-21 10:14
    if your just trying to keep your program from actualy doing anything, like setting outputs or accidently turning stuff on, you could just have the program start with a do/loop until input 0 = 1, so it wont actualy run your program without pin one high.
  • SRLMSRLM Posts: 5,045
    edited 2009-02-21 10:44
    An even simpler do nothing program is:

    END
  • remmi870remmi870 Posts: 79
    edited 2009-02-21 12:58
    no, i think the problem is, if i understand correctly, he wants to be able to download a program, (asuming it runs and stops, no loop), then restart the program without resetting or downloading again.
  • AmaralAmaral Posts: 176
    edited 2009-02-21 13:09
    Are you using an USB converter to an Serial BOE ?
    Something is keeping your lines on RESET ..
    Please post what kind of equipament are you using.


    Amaral
  • NikolayNikolay Posts: 8
    edited 2009-02-21 14:00
    I am using a homework board with a serial cable. And like remmi870 said i want to start the program after the download is finished. right now i can only achieve that if i put a DEBUG "" command at the end of the program.

    if for example i put

    counter VAR Word

    FOR counter 1 = 100
    PULSOUT 15, 1000
    PAUSE 20
    NEXT

    END

    My motor twitches and thats it
    if i add DEBUG ""

    counter VAR Word

    FOR counter 1 = 150
    PULSOUT 15, 1000
    PAUSE 20
    NEXT

    DEBUG ""

    END

    The the motor goes throug the whole program

    is there a way of getting the same result without putting a debug screen at the end?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-21 14:36
    What you've posted is not a valid program. The FOR statement has to be "FOR counter = 1 to 150". How about posting your actual program?

    You should not need the DEBUG statement for it to work properly. I've used a program almost identical to your first example (with a correct FOR statement) for adjusting a servo and it's worked just as expected.
  • NikolayNikolay Posts: 8
    edited 2009-02-21 14:53
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    x VAR Word

    FOR x = 1 TO 100
    PULSOUT 15, 1000
    PAUSE 20
    NEXT

    END

    Here is the actual program

    sorry for the error
  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-21 15:40
    There is nothing wrong with your program. Like I said, I've used the same program and it's worked as expected. I suspect there's something going on with your power source. Either it can't supply adequate power for the servo when that's starting up and the transient drop in voltage causes the Stamp to reset or noise is getting into the Stamp from the servo, again causing it to reset. You might try running the servo off a separate power supply (with a common ground). I'd normally suggest putting a DEBUG statement at the beginning of your program to display "Hello" or something like that. This would be executed every time the program starts and before the servo is activated and would indicate that your Stamp is repeatedly resetting. In your case, with the odd behavior placing DEBUG statements at the end, it might confuse things to put another DEBUG statement in.
  • AveryAvery Posts: 9
    edited 2009-02-22 02:35
    Check out page 50 of What's a Microcontroller under "A Diagnostic Test for your Computer". Some computers have non-standard serial ports and need the debug statement to allow looping commands to work.
  • NikolayNikolay Posts: 8
    edited 2009-02-22 02:44
    That's the problem, thanks for your help everyone.
Sign In or Register to comment.