Searching \ for '[PIC]: {handling keys}' 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/microchip/devices.htm?key=pic
Search entire site for: '{handling keys}'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: {handling keys}'
2004\06\20@094117 by Koen van Leeuwen

flavicon
face
On Friday 18 June 2004 19:59, Bob Axtell wrote:
> While it would seem that testing that a key is pressed would seem
> simple, it actually isn't because most applications need to know
> when it was RELEASED as well. In fact, for me, a keypress occurs when it
> is PRESSED THEN RELEASED.
>
> About 10 years ago I began using a bulletproof way to process keys:
>
> 1. I read the keys- all of them- every 10ms or so. I can either read 'em
> all at one tome, or rotate so that I read each one on a rotating basis.
> Doesn't matter how its done, it works perfectly regardless.
>
> 2. Every 10ms I read the key and shift its value into a register
> decicated just for that application.
>
> 3. If the key is ZERO when it is pressed, I look for the pattern
> b'11110000' on that key's register. When that is seen, that key was
> PRESSED AND RELEASED, so set a flag. To prevent more action, jam the
> key's register with '11111111' so it can't be used again.

What happens with key bounce? Isn't it possible that bouncing during release
of the key would produce the pattern b'11101000'?

> This works great. If anyone is interested, I'll publish some code.

I'm interested :o)


Koen

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2004\06\20@110246 by Scott Dattalo

face
flavicon
face
On Sun, 20 Jun 2004, Koen van Leeuwen wrote:

> On Friday 18 June 2004 19:59, Bob Axtell wrote:
>> While it would seem that testing that a key is pressed would seem
>> simple, it actually isn't because most applications need to know
>> when it was RELEASED as well. In fact, for me, a keypress occurs when it
>> is PRESSED THEN RELEASED.
>>
>> About 10 years ago I began using a bulletproof way to process keys:

Hi Bob,

About 15 years ago, I started using this one:

http://www.dattalo.com/technical/software/pic/debounce.html

The only advantage it has is that it handles multiple keys simultaneously
(using vertical counters).

> What happens with key bounce? Isn't it possible that bouncing during release
> of the key would produce the pattern b'11101000'?

Koen,

Since Bob said he looks for the  pattern 11110000, then this pattern will
get ignored. Using Bob's technique, I think it'd be more appropriate to
look for an all 1 or 0 pattern (or for n-consecutive 1's or 0's). Perhaps
he meant to say that he looks for 1111XXXX?

Scott

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

2004\06\21@045330 by Lindy Mayfield

flavicon
face
> On Friday 18 June 2004 19:59, Bob Axtell wrote:
>
> What happens with key bounce? Isn't it possible that bouncing
> during release
> of the key would produce the pattern b'11101000'?
>
Does the bounce occur only during button press, or during release, too?



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.699 / Virus Database: 456 - Release Date: 6/4/2004

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2004\06\21@054424 by hael Rigby-Jones

picon face
>-----Original Message-----
>From: Koen van Leeuwen [spam_OUTkoenTakeThisOuTspamVANLEEUWEN.XS4ALL.NL]
>>
>> What happens with key bounce? Isn't it possible that bouncing during
>> release of the key would produce the pattern b'11101000'?

>
>-----Original Message-----
>From: Lindy Mayfield [.....Lindy.MayfieldKILLspamspam@spam@EUR.SAS.COM]
>
>Does the bounce occur only during button press, or during release, too?

Bounce can occur during both press and release.  BTW you quoted Bob Axtel
instead of Koen van Leeuwen in your reply.

Regards

Mike




=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================
Any questions about Bookham's E-Mail service should be directed to
postmasterspamKILLspambookham.com.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2004\06\21@085341 by Ishaan Dalal

flavicon
face
Lindy Mayfield wrote:
>
> Does the bounce occur only during button press, or during release, too?
>

Theoretically, both. Varies in practice though. You only need one
debounce in general if all your circuit involves is momentary button
pushes. If it has genuine button presses only -- i.e., holding a button
down for some amount of time -- then you need to debounce that too. Of
course, this "debouncing" is usually part of the code that times the
length of the button press, so...

Cheers,
-Ishaan

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2004\06\21@113443 by David VanHorn

flavicon
face
At 10:51 AM 6/21/2004 +0200, Lindy Mayfield wrote:

>> On Friday 18 June 2004 19:59, Bob Axtell wrote:
>>
>> What happens with key bounce? Isn't it possible that bouncing
>> during release
>> of the key would produce the pattern b'11101000'?
>>
>
>Does the bounce occur only during button press, or during release, too?

Both. Some switches are less noisy than others, but both edges are subject to mechanical bounce.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2004\06\22@194836 by Andrew Warren

flavicon
face
Scott Dattalo <.....PICLISTKILLspamspam.....mitvma.mit.edu> wrote:

> Since Bob said he looks for the  pattern 11110000, then this
> pattern will get ignored. Using Bob's technique, I think it'd be
> more appropriate to look for an all 1 or 0 pattern (or for
> n-consecutive 1's or 0's). Perhaps he meant to say that he looks
> for 1111XXXX?

Scott:

In Bob's email, he said that he uses "11110000" because he acts on a
key only after it's been pressed AND RELEASED... So "1111xxxx"
wouldn't work for him.

If it were me, though, I'd probably use "11111110" (or "xxx11110", if
four consecutive "1" samples were enough to guarantee a debounced
keypress), in order to lower the latency between the key-release and
the action.

-Andy

=== Andrew Warren -- EraseMEaiwspam_OUTspamTakeThisOuTcypress.com
=== Principal Design Engineer
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\22@195248 by Andrew Warren

flavicon
face
Bah, hit SEND too soon.

As I was saying...

I'd probably use "11111110" (or "xxx11110", if four consecutive "1"
samples were enough to guarantee a debounced keypress), in order to
lower the latency between the key-release and the action.

One other large advantage of matching on a series of 1's followed by
a single 0 is that the routine is more reliable; if the key bounces
on RELEASE, matching on "11110000" will fail.

-Andy

=== Andrew Warren -- aiwspamspam_OUTcypress.com
=== Principal Design Engineer
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\22@205831 by William Chops Westfield

face picon face
On Jun 22, 2004, at 4:54 PM, Andrew Warren wrote:

> if the key bounces on RELEASE, matching on "11110000" will fail.
>
If the key bounces on release, it MIGHT fail.  Remember he's only
sampling ever 10ms.  Any key that bounces for less than 10ms shouldn't
show any bounce at all.  Keys that bounce for more than 10mS might or
might not show bouncing, depending on whether the key is "up" when the
sample is actually taken.

BillW

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\22@235643 by Bob Axtell

face picon face
Lindy Mayfield wrote:

>>On Friday 18 June 2004 19:59, Bob Axtell wrote:
>>
>>What happens with key bounce? Isn't it possible that bouncing
>>during release
>>of the key would produce the pattern b'11101000'?
>>

certainly. Happens all the time. Doesn't match, so is ignored.

--Bob
{Quote hidden}

--

Replier: Most attachments rejected
      --------------
        Bob Axtell
PIC Hardware & Firmware Dev
  http://beam.to/baxtell
      1-520-219-2363

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\06\28@155026 by Andrew Warren
flavicon
face
William Chops Westfield <@spam@PICLISTKILLspamspammitvma.mit.edu> wrote:

> > if the key bounces on RELEASE, matching on "11110000" will fail.
>
> If the key bounces on release, it MIGHT fail.  Remember he's only
> sampling ever 10ms.  Any key that bounces for less than 10ms
> shouldn't show any bounce at all.

   Sorry, I should have been more explicit.  What I meant was that
   the algorithm fails, not that the actual comparison to "11110000"
   always would.

   -Andy

=== Andrew Warren -- KILLspamaiwKILLspamspamcypress.com
=== Principal Design Engineer
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

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

2004\06\28@162109 by Andrew Warren

flavicon
face
Bob Axtell <spamBeGonePICLISTspamBeGonespammitvma.mit.edu> wrote:

> > What happens with key bounce? Isn't it possible that bouncing
> > during release of the key would produce the pattern b'11101000'?
>
> certainly. Happens all the time. Doesn't match, so is ignored.

   But that means that the entire press-and-release sequence will
   be ignored, so your user will have to press the key over and over
   until there's no bounce on release.

   What you want is this:

       1.  Wait for key to be pressed for 40 msec.
       2.  Wait for key to be released for 40 msec.
       3.  Signal "key pressed and released".

   What you have is this:

       1.  Wait for key to be pressed for 40 msec.
       2.  Wait for key to be released.
       3.  Watch the key for 40 msec; if it bounces, go back to 1.
       4.  Signal "key pressed and released".

   As I said earlier... If I had to do it this way (shifting samples
   into a register instead of just using a counter), I'd probably
   match on "xxx11110" to avoid that problem.

   If you really do need to debounce the key-release, maybe you
   could shift 1s in from the right and 0s in from the left:  Wait
   for "11111111" (or "xxxx1111") for the keypress, then wait for
   "00000000" (or "0000xxxx")for the release.

   But if your algorithm seems to work for you, great.

   -Andy

=== Andrew Warren -- TakeThisOuTaiwEraseMEspamspam_OUTcypress.com
=== Principal Design Engineer
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

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

2004\06\28@170739 by Bob Axtell

face picon face
Hi, Andy!

Andrew Warren wrote:

{Quote hidden}

Thats EXACTLY what I have.

>
>     What you have is this:
>
>         1.  Wait for key to be pressed for 40 msec.
>         2.  Wait for key to be released.
>         3.  Watch the key for 40 msec; if it bounces, go back to 1.
>         4.  Signal "key pressed and released".

hmmm

>
>     As I said earlier... If I had to do it this way (shifting samples
>     into a register instead of just using a counter), I'd probably
>     match on "xxx11110" to avoid that problem.
>
ah! But what if it is just a single '0' noise glitch...? This would be a
problem. We just set off WWIII because of noise...

>     If you really do need to debounce the key-release, maybe you
>     could shift 1s in from the right and 0s in from the left:  Wait
>     for "11111111" (or "xxxx1111") for the keypress, then wait for
>     "00000000" (or "0000xxxx")for the release.

Actually, from time to time I HAVE changed it slightly. For example, I
could apply a don't care mask so that 11110000 could be interpreted as
111xx000 and might solve things.


>     But if your algorithm seems to work for you, great.

Actually, it works perfectly, and doesn't tie up the main loop.

--Bob



Replier: Most attachments rejected
      --------------
        Bob Axtell
PIC Hardware & Firmware Dev
  http://beam.to/baxtell
      1-520-219-2363

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

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