??? 07/01/06 03:54 Read: times |
#119500 - Taking samples Responding to: ???'s previous message |
Suresh said:
The code given in the text 'for scanning and identifying the key that is pressed' takes the switch press as 'continuously pressed' (a delay of 20msec is produced after switch press for debounce) and identifies the correct location(row,column) by setting each row zero and comparing with the column value.
So my doubt is, how would this comparison work? since the switch press would only produce a trigger pulse at the port but not a constant low level. Yes, that's a weak point of every debouncing scheme! We can only hope, that the switch does only bounce for a certain maximum bounce duration. Assume that typical bounce time is 5...10msec for a brand new switch, then you can expect a maximum bounce time of about 50msec for the same switch when it's aged. A good bouncing scheme samples the switch as often as possible and accepts a valid key pressing only, when for a period of 50msec there's not even one different reading. So, when you sample at a rate of 10msec, then 5 samples in a row must show an identical reading, and this reading must be in opposite to the last valid and stored key state (here key released) of course. Kai |