Debounce everything, even software switches. Especially mechanical switches. Bill Just kidding about software switches, but some times I wonder???? ----- Original Message ----- From: "Wouter van Ooijen" To: "'Microcontroller discussion list - Public.'" Sent: Tuesday, December 27, 2005 10:12 AM Subject: RE: [PIC] Comments on keypad design? >> Ok, I'll admit it, I never really understood the need for diodes. If >> I'm controlling the scan, how do they help? Assume that I'm driving >> columns and reading rows. If I drive column A, then read in all the >> rows, I know that any high line must be from a column A key, right? > > Take a chessboard, the scan is pulling the letters-side selectively low > (first A, then B, etc), you read the numbers-side, with pull-ups. Now > press keys A1, B1, B2. Pulling A low will pull 1 low dircetly, but also > 2 (via A1, B1, B2). Now you can't detect whether A2 is pressed or not. > When diodes are used the one at B1 would prevent this. > >> > For debouncing: just take care that you scan slower than the longest >> > devounce time (50ms is a good upper limit if the switches do not >> > document this). So with a 20 Hz scan frequency you can forget about >> > bouncing. >> >> Doesn't this assume that the keypresses will always happen directly >> after a scan, > > No, but it assumes that bouncing takes at most one scan interval. Think > like this: the scan before the counce will read 'not pressed', the one > after it will read 'pressed'. There can be at most one during the > bounce, which will read either 'pressed' or 'not pressed', but who > cares? > > > Wouter van Ooijen > > -- ------------------------------------------- > Van Ooijen Technische Informatica: www.voti.nl > consultancy, development, PICmicro products > docent Hogeschool van Utrecht: www.voti.nl/hvu > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist