Shop OBEX P1 Docs P2 Docs Learn Events
question about the BS1...yes the BS1... — Parallax Forums

question about the BS1...yes the BS1...

I had a couple of them laying around, so I thought I would play with one....been playing with the BS2 family for years. Please see the very simple code sample..
' {$STAMP BS1}
' {$PBASIC 1.0}


  SYMBOL button_in  =  PIN0
  SYMBOL LED_out    =  PIN1
  SYMBOL on_ = 1
  SYMBOL off = 0
  INPUT PIN0
  OUTPUT PIN1

  startover:
  IF button_in = 1 THEN strobe_off   'where to go if condition is TRUE
    LED_out = on_
    PAUSE 5000
    LED_out = off
    strobe_off:
    GOTO startover
 END

I download the above, and the code runs. However, when I disconnect the power and reply power the program does not run. Seems like it is not loading in the EEPROM, only the RAM...so what am I doing wrong...LOL

Denno

Comments

  • When compiling for the Stamps, the program always gets copied into the EEPROM. Try putting a PAUSE 100 between the OUTPUT statement and the startover: label. What do you have connected to pins 0 and 1?
  • @"Mike Green" My question as well. That's something I would also try out, if I wasn't a big fan of the TI83Plus Calculator and Stamp functions first.
  • Mike, thank you...When I look at the memory map, I see the code...it is there. Connected to pin 0 is a simple push button, providing a low when pushed. Pin 1 has a simple LED connected to it....lights for 5 seconds then off, until the button is pushed again.

    DennO
  • Is there a pull-up resistor on the push button to keep the input high until the button is pressed? The memory map just shows how the code is compiled ... it doesn't really show anything from the EEPROM memory. On the other hand, there isn't any reason why the actual program code isn't programmed into the EEPROM. Did you try the PAUSE?
  • dennodenno Posts: 227
    edited 2019-06-22 12:45
    yes, Mike there is a pull up resistor on the push button. As I said, the simple code does run when downloaded, however, if I disconnect the power, and I have tried several power sources....and reapply power, the code does not run...nothing....strange but true. I have never run into this problem, before, but I have never used a BS1 either...

    Yes, I did try the PAUSE 100 between the OUTPUT statement and the GOTO startover...and I have tried two different BS1's..same result..
  • Solved the problem...Mike....such a silly mistake. In the above code, you will notice:

    INPUT PIN0
    OUTPUT PIN1

    That was the problem..it should have been:

    INPUT 0
    OUTPUT 1

    Like I said...first time with the BS1...when did the BS1 come out...25 years ago? Basic Stamps, and the prop, are still my first and only choice....in the hobbiest...embedded...projects...

    dennO
  • That PIN0 versus 0 thing is a common error with BS1 programs. I have been programming the BS1 since 1994 and have to force myself to remember these little "gotchas" when coding it. The BS1 is still very useful.
  • ercoerco Posts: 20,257
    The BS1 rules! Mark my words: After the EMPs of the Atomic Flame Deluge, only BS1s will remain. Learn to love 256 bytes of RAM.
Sign In or Register to comment.