Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

debounce for switch expalantion

Status
Not open for further replies.

hodahussein

Full Member level 2
Joined
Apr 17, 2007
Messages
144
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,276
dear all

i have virtex 2pro30 kit so i configured one switch for reset if i pressed on it
but i did not make any debounce code just simple check on state of switch
is the debounce necessary or not?
aslo about debounce code if i designed it using FSM "showed in image ' can i know how many flip flop is used?

wait your help
regards

 

lucbra

Advanced Member level 2
Joined
Oct 30, 2003
Messages
514
Helped
73
Reputation
146
Reaction score
63
Trophy points
1,308
Location
Belgium
Activity points
3,251
Depends - if you want to be 100% certain that you capture the state change of the switch, I would certainly recommend a debounce mechanism. If it's just for a test, maybe you could go without the debouncer.

Remember you will need some clock ticks (4..) over a 100ms time span to design a good debouncer. Just check over this period if the state is stable (0 or 1)

When a clock is available with 20ms period, then it takes 5 FFs.

Regards
 

mrflibble

Advanced Member level 5
Joined
Apr 19, 2010
Messages
2,724
Helped
679
Reputation
1,360
Reaction score
651
Trophy points
1,393
Activity points
19,551
I vote yes on the debounce. Flipflops are cheap. Your time debugging weird stuff due to glitchy inputs is not.
 

std_match

Advanced Member level 4
Joined
Jul 9, 2010
Messages
1,187
Helped
444
Reputation
888
Reaction score
409
Trophy points
1,363
Location
Sweden
Activity points
9,155
Debouncing and noise/disturbance filtering are two different things.

If you only need debouncing, the simplest way is just to sample the switches with a time period longer than the "bouncing" time.
I have successfully used 20 ms as the time period.
A longer time is ok, but if the time is too long, the user will notice a delay.

It doesn't matter if you sample in the middle of the bouncing noise
and get a random value, since that only happens when the switch is operated.
The previous and the next value will be stable (and different),
so whatever the random value is, the edge will be clean.
 

yanzixuan

Member level 3
Joined
Feb 26, 2009
Messages
65
Helped
10
Reputation
20
Reaction score
6
Trophy points
1,288
Activity points
1,573
dear all

i have virtex 2pro30 kit so i configured one switch for reset if i pressed on it
but i did not make any debounce code just simple check on state of switch
is the debounce necessary or not?
aslo about debounce code if i designed it using FSM "showed in image ' can i know how many flip flop is used?

wait your help
regards

at least 8 FF
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top