Searching \ for '[EE]: Keyscan repetition rate?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=keyscan+repetition
Search entire site for: 'Keyscan repetition rate?'.

Exact match. Not showing close matches.
PICList Thread
'[EE]: Keyscan repetition rate?'
2001\02\09@054918 by Stein Sem-Jacobsen

picon face
Hi

I'm designing a timer with an LCD, relay and four buttons. To get the
timing right, all that is handeled by an ISR. The keys however, connected
to RB4-7 using the internal pullups, is polled manually. How often do I
have to poll the keys to be sure that I don't miss any keystrokes?

Regards
Stein Sem-Jacobsen

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\02\09@062044 by NDuckworth

flavicon
face
I poll keys every 50mS using TMR0 interrupt in several projects without
problems,
I also use this for timekeeping (20 interrupts per second).
50mS is convenient to generate with a 4MHz crystal and the maximum prescaler on
TMR0.

If you only want to record a single keypress then set a flag which is only
cleared when you detect the key has been released.

Regards

Nigel




On Friday, February 09, 2001 10:55 AM, Stein Sem-Jacobsen
[SMTP:.....ssemjacoKILLspamspam@spam@ONLINE.NO] wrote:
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2001\02\09@082914 by Wynn Rostek

flavicon
face
>  ... How often do I
> have to poll the keys to be sure that I don't miss any keystrokes?

Stein,

I've found that if I scan the whole keyboard 20 times a second people are
satisfied with the response.
Any faster is really pretty much a waste of CPU time as humans can't react
too much faster than this.
This should be easy enough to do with so few keys.

Wynn Rostek

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2001\02\09@085005 by Olin Lathrop

face picon face
> I'm designing a timer with an LCD, relay and four buttons. To get the
> timing right, all that is handeled by an ISR. The keys however, connected
> to RB4-7 using the internal pullups, is polled manually. How often do I
> have to poll the keys to be sure that I don't miss any keystrokes?

Missing a short key press is not so much the problem as debouncing.
Debouncing requires more frequent reading.  I like to do this by checking
every 1mS and consider the state valid when it has been the same every
sample over a 50mS period.  I imagine you don't really need to sample every
1mS, and the 50mS depends somewhat on the switches.  However, these are
conservative numbers that should yield good solid operation unless you've
got a really unusual switch.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, olinspamspam_OUTembedinc.com, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2001\02\09@120350 by Bill Westfield

face picon face
   Missing a short key press is not so much the problem as debouncing.
   Debouncing requires more frequent reading.

Why?  I don't see how scanning every ms waiting for 50ms of continuous
keypress is different than scannng every 50ms looking for two consecutive
same-state values?  For that matter, I don't see why it's different than
detecting any keypress signal and ignoring additional transitions for the
next 50ms.  You don't need to see all the bounces, you just need to make
sure you don't treat them as individual keypresses...

BillW

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2001\02\09@143530 by Stein Sem-Jacobsen

picon face
The way I did it is the following:

An ISR occur every 3.9 ms. Then it checks to se if a key's been pressed.
(another routine is called in the main rutine to check the keys, it sets a
"flag" to indicate that the key has been pressed and released)

When the ISR has been run 8 times (approx 31.25ms), it resets the flag. In
the main code I then just skip the keyscan rutine as long as the debounce
flag is set. The correct prosedure to respond to the keystroke is made by
making a binary number out of the four bits (1-4)-1 wich is then added to
the PCL for branching to the correct subroutine/procedure

Regards
Stein S-J

> {Original Message removed}

2001\02\10@041241 by Bill Westfield

face picon face
I suppose that in some sense, it depends on whether you're thinking along
the lines of the old SPDT RS-flipflop debouncer (which latches on on the
first "bounce", and assumes that the bounces "break" but don't go all the
way to the other contact) or a more common SPST RC/schmidt-trigger
debouncer, which requires the contact remain closed for longer than a
typical bounce time.  I think I was thinking along the former lines, and
everyone else is thinking along the latter (which is probably more correct,
given SPST switches.)

BillW

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2001\02\10@220331 by rich+piclist

flavicon
face
> Missing a short key press is not so much the problem as debouncing.
> Debouncing requires more frequent reading.

Standard 8042 keyboard controller only has 256 bytes of RAM, trust me they
don't burn 101 bits for key debounce, much less 101 bytes.

What they do is low-pass filter by polling SLOWER than the worst-case
bounce period, and debounce becomes a non-issue: if it reads pressed, it
IS pressed, end of story.

Not that anyone uses 8042's anymore. Keyboards I've used bounce for about
18 mS -- 25 ms poll works fine.

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestspamBeGonespammitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...