From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulating Switch Bounce

Hello ,

 

I want to simulate a BOUNCY switch that can bounce as per my configuration - to test that my software handles (filtersout) all the bounces.

 

Is there a model available or can you help me in pointing to right direction ?

 

thanks in advance!

 

0 Kudos
Message 1 of 2
(5,998 Views)
Hi,

Switch bounce in your program would be visible as a train of pulses. Additional 0 when your switch line goes up an additional 1 when it goes down.

You can simulate that by generating the line signal yourself as a mixture of 1 and 0 with the zeros wanishing in time, leaving the 1s in the signal - button pressed. Or a mixture of 0 and 1 with 1 wanishing in time leaving 0 behind - button released.

You can control number of bounces and probability of bounce (decreasing in time in linear fashion for example) and other parameters. Pregenerate such a signal and feed it to your de-bouncing logic. Sorry for not giving exact solution.
0 Kudos
Message 2 of 2
(5,882 Views)