LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Software debouncing DI

Using LV7.1 + Win XP +  PCI 6229

I have 20 digital inputs that are read inside a 50ms timed loop  and stored in a 1-D array  for use by rest of the sub VIs.

I want to debounce each of these DIs by atleast 150ms. ( Thus each input must  remain in a stable state for atleast  3 scans before I  acknowledge thier new state and do something based on that ...)

My proposal is this :

INIT:
- Create a 20 X  by  3 Y array ( 2D) and initialize it .
- Read  the DI values into this array for three scans.
- At the end of three scans , transpose the array to 3 X by 20 Y.
- Now check each of the 20 rows to see if all the three  bits are 1 ; if yes then that DI bit is high. Else it is low.
- Start all over from INIT.

Idea looks OK to me as each input has to remain high for atleast three seconds before I accept it as a real high. But how to implement is the question.

Any suggestions most welcome.

Thanks

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 7
(5,005 Views)
Hello Raghunathan,

It looks like you are performing software timed digital input (although the DAQmx read is inside a timed loop).  Your suggestion should work.  I would recommend that instead of creating an array 20x3 simply perform three multichannel, single sample  DAQmx Reads.  Once you have these three arrays you can perform some simple digital logic in your software.  I have attached a simple example that demonstrates the digital logic to determine when a sample is valid given 3 arrays.

I hope this helps,

Jesse O.
Applications Engineering
National Instruments
Jesse O. | National Instruments R&D
Message 2 of 7
(4,979 Views)
Yes that was a simpler idea. I have further worked on it  to make it suitable for machine control codes.  Attaching the VI . (LV7.1)

Thanks

Raghunathan.R


Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 3 of 7
(4,959 Views)
You can use shift registers to debounce boolean signals too.
 
See the attached examble.  To increase the number of samples, expand the shift registers node.
 
Paul
0 Kudos
Message 4 of 7
(4,946 Views)

This is an excellent wave to remove static and random noise from a digital signal.  However, traditional "bounce" is from switch contacts which arc repeatedly before fully closing (or opening) and the signal amplitude is characterized by a decaying sinusoid.  The algorithm described here may interpret subsequence "bounces" as valid signals because they are the same duration as the first signal, merely lower in amplitude.

0 Kudos
Message 5 of 7
(3,894 Views)

@wildcatherder wrote:

This is an excellent wave to remove static and random noise from a digital signal.  However, traditional "bounce" is from switch contacts which arc repeatedly before fully closing (or opening) and the signal amplitude is characterized by a decaying sinusoid.  The algorithm described here may interpret subsequence "bounces" as valid signals because they are the same duration as the first signal, merely lower in amplitude.


That is why you should really clean up the signal as much as possible with hardware filters.  Not to mention that transient spikes could damage your equipment.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 7
(3,879 Views)

The point was that "bounce" is misused in the title of this thread.

0 Kudos
Message 7 of 7
(3,863 Views)