PDA

View Full Version : basic SX , interrupt functions ?



sunil
06-10-2005, 12:07 AM
Hi,

I am using a basic stamp 2 sx .

The stamp is waiting for a serial signal , but at the same time has to be allerted if a button is being pressed. Is there a way to do this, also is there any provision for interrupts.
Thanks

Sunil

Jon Williams
06-10-2005, 12:10 AM
No interrupts.·

There are two things you can do: 1) you can use flow-control with your SERIN statement so the external device doesn't try to send anything when the BASIC Stamp is not ready, or 2) you can use a timeout in SERIN to escape out of it if nothing shows up.·

To catch your button input you can either latch it with a flip-flop or, as I've done a couple times, you can "stretch" the button input with a simple 555 circuit, using an extra pin on the BASIC Stamp to reset the 555 after the input is scanned.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

sunil
06-10-2005, 12:13 AM
Actually I cannot stop the serial process, once it has started , it has to wait for atleast 5 seconds, but at the same time I need to be able to recognize as soon as a button is pressed.

Jon Williams
06-10-2005, 12:24 AM
You need some sort of hardware serial buffer, then, because the BASIC Stamp uses software serial routines (which is why it works on any pin) and it cannot be interrupted once it is receiving data.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

Ryan Clarke
06-10-2005, 04:47 AM
Sunil, have you considered using the SXes?

Ryan

Vern Graner
06-10-2005, 05:11 AM
This may also depend on what your definiton of "at the same time" is. http://forums.parallax.com/images/smilies/smile.gif If a short delay is allowable from the time the button is pressed till the time you poll for the button state, you could use some pretty clever polling code created by Jon and shared/discussed in the ParallaxEFX area detailed in this thread:

http://forums.parallax.com/showthread.php?p=537937 (http://forums.parallax.com/showthread.php?p=537937)

Vern

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Vern Graner CNE/CNA/SSE | "If the network is down, then you're
Senior Systems Engineer | obviously incompetent so why are we
Texas Information Services | paying you? Of course,if the network
http://www.txis.com | is up, then we obviously don't need
Austin Office 512 328-8947 | you, so why are we paying you?" İVLG