> > You are better off filtering the RA0 input. You may find that you need > > to take two or three readings to get a stabilised value if you are > > expecting things to happen fast, but I would have thought this is the > > sort of use where the person keeps their finger on the button until the > > desired action happens, so speed is not essential, so a longish (1/10 > > to 1/4 sec?) time constant on the filter would be fine. > > I agree about the filtering, but not so sure that 250mS might not be > annoying. I guess it depends on exactly what the user expects to happen. Action will happen at button release (and one action per release) what I had planned on doing was... Sample as fast as possible, normally this will yield 0's (no button pushed) On button push, start counting how many times the value falls inside each range of values (ie button 1 is 5-25) once the button goes back to 0 (for a few samples to debounce) take the button with the most samples recorded in range as the pressed button. So if say b3 was pushed then there'd be low numbers in b1 and b2 counts (from the rise and fall), a higher number in b3 (because your thumb is not momentary contact) , perhaps a few in b4 from something funky going on, but from the counts b3 is it and it gets sent once the values have returned to zero (or near). I think if I can just smooth RA0 a bit I won't have to do too much fancy work inside the PIC. -- Anthony Toft I'm Anton, and I approve this message -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist