--- In AVR-Chat@yahoogroups.com, "brewski922" <brewski@i...> wrote: > > --- In AVR-Chat@yahoogroups.com, Valerij Avrealij <avrealij@m...> > wrote: > > Hello 2AVR-Chat members. > > > > I have interrupt based keyboard inquiry. How much time I need wait > > after interrupt occurs and keyboard inquiry? > > Thanks. > > > > -- > > Valerij Avrealij > > It depends on the bounce time of the switches. Sometimes the > manufacture datasheet has the specs for the bounce, settling, time. > Most don't. Probably needless to say, but I'll say it anyway in case > there is folks that are not awhere of it. From the time that a switch > makes initial contact and a valid read is made of what switch created > the closure, the contact needs to settle to a continuous closure. > > Anyway, for your case if you feel you are having problems with > contact bounce or something else and feel a time-delay is need go > ahead a insert a delay. Start with something big that WILL correct > the problem, say a 0.001 or may be 0.01 or even 0.1 and see what > happens. When the problem is corrected say between 0.001 and 0.01, > split the difference and try 0.05. If that worked split the > difference again. You will eventually get to a point where one delay > works and just a bit faster fails. Using the number that works > increase the delay a little, I usually use 10% slower. This gives you > a little insurance. > > Mike 0.001 sec or 1/1000 or One One-Thousands of a second 0.01 sec or 1/100 or One One-Hundreds of a second 0.1 sec or 1/10 or One One-Tenth of a second The theory is "Find a value that does not work." "Find a value that does work." Then pick a value 1/2 way between the two. Does it work? Keep on dividing and testing until you get to a value, say 0.123, that works. A value of 0.122 on occasion fails. Add 10% to it. 0.135 sec = 0.123 + 0.012 or 135/1000 or delay_ms(135); //This seems to be a huge amount to me! It is better to be slow and correct than fast and wrong. Ten per cent is old engineering guess-work. Mike
Message
Re: Keyboard delay
2005-02-20 by brewski922
Attachments
- No local attachments were found for this message.