Shop OBEX P1 Docs P2 Docs Learn Events
Activating inputs to basic stamp. — Parallax Forums

Activating inputs to basic stamp.

Chez 7Chez 7 Posts: 4
edited 2011-04-13 21:20 in BASIC Stamp
Hi, can anyone help me re, activating inputs to a basic stamp homework board. At present I have a few "leds" running in sequence at different time intervals, What I want to do is, interrupt the running of the programme ,ie cause a pause through an input command then restart as and when I want through another input command. Is this possible? Chez 7.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-13 20:28
    It's possible to do, sort of, but not the way you're thinking about it. There are no interrupts in the Basic Stamp, but your program has a number of loops used to control the LEDs. Each loop has to have a test for whatever input condition you want and the loops all exit (via a GOTO) to where they check the input condition for details. Note that this won't quite work if your input condition involves an input character from the PC or another serial input. The reason there is that the Stamp's SERIN or DEBUGIN statements are not buffered. While the Stamp is doing something else like controlling LEDs, it's not listening to the serial port and will miss anything sent to the Stamp during that time.

    Usually this sort of thing is handled by using a handshaking signal from the Stamp (see the documentation for the SERIN statement) that means "OK, I'm listening" and a timeout on the SERIN statement so the Stamp won't wait indefinitely for an answer if the PC isn't sending anything.
  • Chez 7Chez 7 Posts: 4
    edited 2011-04-13 21:20
    Thanks Mike, you have given me a lot to think about, will study up on SERIN statement, handshakes, etc. Chez 7.
Sign In or Register to comment.