Hello Hopkins, >How much should one allow for a switch denounce on a digital port 20,40,100ms? > > years ago I've made a routine for treating buttoms that I'm still using. It runs on an interrupt that occurs once every millisecond on most applications and have a keyDebounce variable that usually (with no key pressed) have it's value equal to 50. While a key is pressed the routine decrements keyDebounce. When keyDebounce is equal zero, the code of the key is put on the keyBuffer variable and keyDebounce = 250. Next time (we also have a keyCounter variable) the keyDebounce is equal zero, key code is put on keyBuffer again a now keyDebounce =50. It makes a nice repeating keyboard implementation and you could even implements "accelerating" keypresses. It works very well with all the buttoms/keys I've tried. I think I already used more than 6 kind of buttoms. Best regards, Brusque -- --------------------------------------------------------------------- Edson Brusque C.I.Tronics Lighting Designers Ltda Research and Development Blumenau - SC - Brazil http://www.suporte.ind.br/ryan/netiqueta.htm www.citronics.com.br --------------------------------------------------------------------- -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu