Searching \ for 'DE-BOUNCE ROUTINE' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=bounce+routine
Search entire site for: 'DE-BOUNCE ROUTINE'.

Truncated match.
PICList Thread
'DE-BOUNCE ROUTINE'
2000\02\15@072602 by Longley, Jason

flavicon
face
Hi,

I'm still a little unsure of how to de-bounce momentary
push button switches please could someone send me some code
so that I can try to follow it.

Please be patient I'm new to this game !!!!!!


----------------------------------------
Longley, Jason
Email: spam_OUTJason.LongleyTakeThisOuTspamuwe.ac.uk
"University of the West of England"

2000\02\15@090005 by Wagner Lipnharski

flavicon
face
One of three options:

1) You don't know how to de-bounce the switch.
2) You don't know how to produce the software to do it.
3) All of the above.

:)
Wagner.

"Longley, Jason" wrote:
{Quote hidden}

2000\02\15@091701 by M. Adam Davis

flavicon
face
The idea is that you need to wait for a little bit after you detect the button
press, then check it again, and use the last check as your value. For instance:

Check if pin is high
If not, go do something else, button is not pressed
If it is high, then button is pressed.
 Do a 'nothing' loop for 30mS  (0.03 seconds, or 30,000 instructions at 4MHz)
 Check pin to see if it is high.
  If not, then there was an error, ignore button press
  If it is, button is pressed, and debounced.  Count it as a button press.

I won't write the code for you, it should be pretty easy to follow if you know
the instruction set of the PIC.  Once this is working you can use a 16 bit timer
instead of the do-nothing loop.

I hope this helps!

-Adam

"Longley, Jason" wrote:
{Quote hidden}

2000\02\15@145541 by Don McKenzie

flavicon
face
"Longley, Jason" wrote:
> I'm still a little unsure of how to de-bounce momentary
> push button switches please could someone send me some code
> so that I can try to follow it.

Need a keyboard debounce routine for PICmicros?

BUTTON pin, port, state, delay, repeat_rate
This routine debounces input from a pushbutton and jumps to an
"action" routine. The pin (0-7), port (0-2 for RA through RC),
action state of the input (0,1) are all specified at run time.
The delay and repeat rate are constants.

Basic Stamp Compatible PIC Source Book/Disk On-Line Version Free!
Now converted to MicroChip Code, still available in Parallax Code.

A collection of ready-to-use assembly language routines
based on the instruction set of the BASIC Stamp ¨ single-board
computer by Scott Edwards Electronics.
                                               
Includes useful schematics.
For MicroChip code:
http://www.dontronics.com/convert.html
For Parallax code:
http://www.dontronics.com/see.html

Don McKenzie    .....donKILLspamspam.....dontronics.com      http://www.dontronics.com

World's Largest Range of Atmel/AVR and  PICmicro Hardware and  Software.
Free Basic Compiler and Programmer http://www.dontronics.com/runavr.html

2000\02\15@171525 by Randy Glenn

picon face
Check out http://www.rentron.com/Myke6.htm

-Randy Glenn
E-Mail: EraseMEPICxpertspam_OUTspamTakeThisOuTyahoo.com
Web: http://i.am/PICxpert

Currently wondering why I can't get in to Safe Mode - where's a Mac when you need it?

{Original Message removed}

2000\02\15@192639 by Erik Reikes

flavicon
face
At 12:25 PM 7/7/99 +0100, you wrote:
>Hi,
>
>I'm still a little unsure of how to de-bounce momentary
>push button switches please could someone send me some code
>so that I can try to follow it.
>

The short answer is :

1. wait until you get a down signal.

2. delay a few tens of ms.

3. check to make sure it is still down.  If it is you have a good input, if
not, go back to one.

Play around with the delay to get the proper hold-off for your switch.  I'd
set this up as a little state machine that gets called every so often from
your main program to ensure decent button response.

You can go more complicated, but it doesn't really buy you anything.  I've
found a good value for your wait is around 50ms.


Erik Reikes
Software Engineer
Xsilogy, Inc.

ereikesspamspam_OUTxsilogy.com
ph : (858) 535-5113
fax : (858) 535-5163
cell : (858) 663-1206

2000\02\16@032342 by Caisson

flavicon
face
> Van: M. Adam Davis <@spam@adavisKILLspamspamUBASICS.COM>
> Aan: KILLspamPICLISTKILLspamspamMITVMA.MIT.EDU
> Onderwerp: Re: DE-BOUNCE ROUTINE
> Datum: dinsdag 15 februari 2000 15:14

Hello Adam,

 Hmm ... I took another approach:

1) Check if (any) pin is Low
     if not, Exit - button(s) not pressed
2) Clear a Hold-off counter
3) Store "Current state" as "Old state"
4) Check if pin(s) is (are) the same as "Old state"
     if not, goto 2)
5) Decrement Hold-off counter
     if *not* zero, goto 4)
6) Check if "Current state" (or "Old state") is Zero
    if so, Exit - some kind of glitch occurred

This will result in a debounce, even if a status-change occurs just before
the Time-out is reached ...  Down-side: It has a variable time to execute,
dependend on the bounce of the button ...

Regards,
 Rudy Wieser

> The idea is that you need to wait for a little bit after you detect the
button
> press, then check it again, and use the last check as your value. For
instance:
>
> Check if pin is high
>  If not, go do something else, button is not pressed
>  If it is high, then button is pressed.
>   Do a 'nothing' loop for 30mS  (0.03 seconds, or 30,000 instructions at
4MHz)
>   Check pin to see if it is high.
>    If not, then there was an error, ignore button press
>    If it is, button is pressed, and debounced.  Count it as a button
press.
>

2000\02\16@123132 by Rich Leggitt

picon face
Hi Jason,

It's a myth that you must have special debounce code in cases where you
control the sample rate.

A typical switch will bounce for 25-35 mS after activation, simply poll it
every 40 mS and debounce is not an issue.

--- Rich

> Hi,
>
> I'm still a little unsure of how to de-bounce momentary
> push button switches please could someone send me some code
> so that I can try to follow it.
>
> Please be patient I'm new to this game !!!!!!

2000\02\16@131946 by Wagner Lipnharski

picon face
Well, if you can afford to waste time, just sense the very first switch
contact closing, start your routine and then wait 500ms... if the user
holds the key down, you would have a "repeatable" key, as the PC
keyboard does.

Rich Leggitt wrote:
{Quote hidden}

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