In SX Microcontrollers, SX/B Compiler and SX-Key Tool, steve_b wrote: Almost sounds like you've got a debounce problem....before a switch fully closes, there are a number of little "stutters" or "arcs" (if you like) that will connect/disconnect in rapid succession.... You could fix this in hardware or software. Both are handy ways to know....Got down the software path first....at some point you may run out of timing to do the waits/whiles to get rid of the 'bounciness' and you would have to revert to hardware. For interests sake, you could connect a pull-up resistor to your switch and then put a capacitor across the switch. What you are doing is making what's called an RC circuit (R for resistor; C for Capacitor), which is basically a delay type of circuit or filter. There are some calculations you could make to determine what either should be....personally, I'd just use an appropriate pullup resistor, like Jon suggest, then pick a capacitor that works for you (this is easily done if you have an oscilloscope!). The other way to debounce a circuit (and really the better way IMHO - unless you DO have noise; then the RC could act as a filter as well) is to use a schmitt trigger. You set up your switch the same way (pull-up resistor, cap in parallel with switch - ~10nF) then where the resistor and the switch/cap join, you connect the input of a schmitt Actually, here's a webpage for future reference... [url]http://www.all-electric.com/schematic/debounce.htm[/url] Cheers ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=243116#m243204 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)