On Tue, 28 May 1996, Mark K Sullivan wrote: > I always use 20 mS as a rule of thumb for switch bounce time. One of the few > things PICs do poorly is waste time. How much time did your loop take? At any > reasonable clock rate, the PIC executes 255 iterations in far less than 20 mS. > Your approach is fine, but you need to make sure the delay is at least 20 mS. > The only problem arises if you need to be doing something else while you are > timing the switch. Unless, that is, you have enough other things to do! In which case you might be able to put them all into a "great mucking big loop" that executes, oh, say 60 times per second, and you can run a very simple debouncing state machine for each switch input on each cycle, and sample the other sensors, etc, etc. But sometimes I wonder: is the the result of having once learned a little bit about RPG, or does everyone doing interactive interfaces end up reinventing the event processing loop eventually? ;-)