Searching \ for '[EE]: About keyboard or matrix keypad programming' 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/devprogs.htm?key=programming
Search entire site for: 'About keyboard or matrix keypad programming'.

Exact match. Not showing close matches.
PICList Thread
'[EE]: About keyboard or matrix keypad programming'
2000\11\08@202928 by William

flavicon
face
Dear All Forum Members,

I need help for designing keypad. I doubt about my software that scaned
my 4 x 4 keypad.

I need to know when we, human press the keypad or keyboard button,
the must be some mechanical noise occurs, before the proper signal, like

                  -------
                  |     |
                  |     |
                  |     |
--------------^/\/      |------------

               ^
               |
               +------ mechanical noise



Can anyone tell me if using software to obmit this mechanical noise,
how long time delay is needed before reading the proper keying?
Ans also how long is a valid key (single key) press, for determine a
valid key!

Or any web page giving this kind of info or design and programming.

Thanks


--
Regards,

William Tan

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




2000\11\08@203738 by ckchan

flavicon
face
Greetings,

Most of the debouncing need 15ms to 25 ms of delay. i think the valid key press
period depend on the respond sensitivity that you want to achieve. Good luck in your
project.


regards,
ckchan



{Quote hidden}

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




2000\11\08@205830 by Mark Willis

flavicon
face
In part, it depends on the speed you expect the keyboard to be used at
(You'll have different timing on a professionally built ergonomic
keyboard specifically designed for say Dvorak fast touch typing at 80+
WPM, than on a security system keypad where they have to carefully type
in a 4-digit code at say 1 digit a second.)

Somewhere in 5-25mS or so should usually "do it", but that's assuming a
lot about your switch <G>

One good thing to do:  Set up an O-Scope and see what that switch bounce
looks like in average use of your switch (This way you can use an old
"knife switch" or a little tactile switch or a "dome" switch and know
the right answer from seeing the results.)  A despiking capacitor,
assuming your switch is not diode matrixed, will reduce the switching
noise a LOT, BTW.

Better: Scott Dattalo has code on debouncing and vertical counters at
http://www.dattalo.com/technical/software/pic/debounce.html and
http://www.dattalo.com/technical/software/pic/vertcnt.html, good info.
His code repeatedly scans the switch, when it's the same state "often
enough" it calls it switched (Works pretty well.)  15 cycles means it's
QUITE fast (Scott D's a good coder, FYI <G>)

How to "best" do this depends on your application - if you use a really
slow processor and need really low power usage, drop caps across those
switches, scan less often, and you should do fine.  If you need more
speed, scan more often.  (THINK, always <G>)

 Mark

William wrote:
{Quote hidden}

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




2000\11\08@214817 by Bob Ammerman

picon face
Right. This is called keybounce.

For most forms of switches, if you see the same state for 20 to 40
millieconds or so you can assume that the key is done bouncing.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)


{Original Message removed}

2000\11\09@040411 by o-8859-1?Q?K=FCbek_Tony?=
flavicon
face
Hi,

William wrote:

>Can anyone tell me if using software to obmit this mechanical noise,
>how long time delay is needed before reading the proper keying?
>Ans also how long is a valid key (single key) press, for determine a
>valid key!

Well as other has stated, normally 10-20ms should be enough, but
it is dependant on the quality of the switch, i.e. I've found
that very cheap swithces has long settling times and higher
quality has shorter settling time, but don't regard this as a rule.
( depends also on the mechanical configuration od the switch ).

Mark Willis replyed:

<snip>
>One good thing to do:  Set up an O-Scope and see what that switch
bounce
>looks like in average use of your switch (This way you can use an old
>"knife switch" or a little tactile switch or a "dome" switch and know
>the right answer from seeing the results.)  A despiking capacitor,
<snip>

Good advice, as I stated above not two switches are alike.

>Better: Scott Dattalo has code on debouncing and vertical counters at
>http://www.dattalo.com/technical/software/pic/debounce.html and
>http://www.dattalo.com/technical/software/pic/vertcnt.html, good info.
>His code repeatedly scans the switch, when it's the same state "often
>enough" it calls it switched (Works pretty well.)  15 cycles means it's
>QUITE fast (Scott D's a good coder, FYI <G>)
<snip>

Very good suggestion, I've used these vertical counter for an pic-pc
keyboard emulator with very good results. ( PicBoard located at the
piclist site
at 204.210.50.240/techref/default.asp?url=microchip/picboard.htm
).
Here are some pseudo code from it (note many parts ommitted to save
space ):


In main loop I read the switches, 4 by 4, assemble them into one byte
called kbColumnVal and call the routine KB_DEBOUNCE.
There I jump to column specific debounce routine (  sw adresses
8 columns by 4 keys, I assemble these into 4 columns(bytes) by 8
keys(bits) ).

For example for comlumn 1&2 something like this is executed:

       ; debounce columns 1 & 2
       DEBOUNCE_BYTE
kbColumnVal,kbColumn12_New,kbColumn12Cnt,kbColumn12State

       MOVF    kbColumn12_New,W        ; get debounced sample
       XORWF   kbColumn12_Old,W        ; get changed bits
       
       BTFSC   STATUS,Z        ; check if zero = no change
       RETURN                  ; no change. return
       
       ; key/s has been changed, w contains which key/s that has been
changed in column 1 & 2
       ; Note ! Not the actual state of the key, only 'change has
occured' = '1'

       ..
       ..
       <some handling of the pressed/released key>
       ..
       ..
KB_12_DONE:
       ; and update our 'last known' status for the column
       MOVF    kbColumn12_New,W ; get new status
       MOVWF   kbColumn12_Old  ; and store it..
       RETURN  


Then I return into the main loop, I read the next column, and
perform the same debouncing for that column.
Between each 4 keys reading I have an delay of 1 ms, which gives
and delay of 2 ms per/loop. AS I have 4 columns ( logically )
that would give me about 8 ms between each sample/comlumn, then
using the debounce routine it will 'only' pass through the change
after an key value has been the same state for 4 consecutive
'debounces', which give an total time of (roughfly) 32 ms for
a key to be detected either '0' or '1'.

The very nice thing about Scott's code is that no delay's are needed
in the actual debouncing, ofcource you need to space the sampling
out in time so that the 4 consecutive values are having atleast
something around 20-30 ms in total between them. But your code is
free to do other stuff while waiting for the next sample.


/Tony












Tony Kübek, Flintab AB            
²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
E-mail: spam_OUTtony.kubekTakeThisOuTspamflintab.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




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