PDA

View Full Version : interrupts



goldfingerfif
08-24-2006, 01:02 AM
Are there any type of interupts with the Basic Stamp? I want it to monitor voltage but if you press a button for it to change what it limits it at but i cannot figure out how to do the interrupt to raise or lower it. I could do a loop that watches it but then it must constantly check the button status which would significantly slow the chip down.

Bruce Bates
08-24-2006, 02:37 AM
goldfingerfif-

Looping as you suggested is the best way to do it, unless you are using a BS-2P? then look at the POLL command.

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->

metron9
08-24-2006, 02:54 AM
Somebody said...
it must constantly check the button status which would significantly slow the chip down


That depends on how many times the polling routine needs to execute. A button press is pretty slow, so testing could be 10 times per second, your main code would have to be written on a way that uses flags and short routines that last a maximum of less than 1/10 second though. If it is a single button press you could use a flip flop to store the on off condition and clear it after you read it. If it's a hold button to increase voltage then it really dosent matter if its even 1 second delay before your program finds it is held down and can deal with it when it finds it.

So it really depends on how much you need to do and of course how you program it to do it.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!