Taylorh140 Posted January 26, 2022 Report Share Posted January 26, 2022 (edited) I debounced a boolean. I feel like it could be better. This should take the initial value as output, and requires consistency for one second to change value. I'm curious what's out there or what has been tried? What i like about this: Simple to understand What I don't like about it: Small periodic blips could prevent state changes from ever occurring. Uses time as a metric (I actually prefer non-time metrics, like voting algorithm as they need less consideration) Uses two feedback nodes. (seems excessive). Takes one call after debounce time to propagate output. Functionally impure. (e.g. has statefulness although seems pretty necessary here) Edited January 26, 2022 by Taylorh140 impure Quote Link to comment
Jordan Kuehn Posted January 26, 2022 Report Share Posted January 26, 2022 I have something like this that I use. Quote Link to comment
Taylorh140 Posted January 27, 2022 Author Report Share Posted January 27, 2022 I do like the count. I was thinking about majority vote but it has the issue of being noisy around the 0 point. I think that this may correct at least periodic noise issue that the last method had: This method counts True +1 and False -1 and sums them until they surpass the count by one, only then does the input pass through. What i like about this: Simple enough Small periodic blips do not prevent state changes from ever occurring. Does not use time as a metric (but still need to be considered based on sampling rate) What I don't like about it: Uses two feedback nodes. (seems excessive). Functionally impure. (e.g. has statefulness although seems pretty necessary here) Looks messy compared to last implementation. Quote Link to comment
Jordan Kuehn Posted January 27, 2022 Report Share Posted January 27, 2022 That certainly fulfills the debounce nature in a more pure manner, debouncing both low and high. Mine is more of a conditional latch with optional single pulse output or latched high output. I think you got my point though about using a counter. As far as it being pretty or not, I don't know that I'd ever look at the BD again after finishing testing. The counts can be adjusted based on where you use it. Certainly sample rate will be a factor, but also expected noise/bounce vs desired responsiveness. Quote Link to comment
Sparkette Posted January 28, 2022 Report Share Posted January 28, 2022 When is this necessary? FPGA I assume? Quote Link to comment
Jordan Kuehn Posted January 28, 2022 Report Share Posted January 28, 2022 4 minutes ago, flarn2006 said: When is this necessary? FPGA I assume? FPGA certainly. I have use for the code I posted when say thresholding a value and wanting to ensure that it has exceeded that threshold for a period. That value could be anything. A plain signal or it’s derivatives, a float switch with a digital input, etc. At high rate in an FPGA you’d normally use it for say a mechanical switch that makes intermittent contact rapidly as the contacts first come into contact with each other. I’m sure there are more examples! Quote Link to comment
Lipko Posted January 28, 2022 Report Share Posted January 28, 2022 I haven't looked into the thread in detail, but for debouncing I usually use an "off delay". It works with a one-cycle spike in the raw measured data too. I haven't implemented it in Labview, I use these off-delay blocks in Siemens Logosoft (PLC). Quote Link to comment
Taylorh140 Posted January 28, 2022 Author Report Share Posted January 28, 2022 Yeah well the thread is labeled debouncing. But this can be used any time you want to be absolutely sure there is a transition in a boolean input. Say in a noisy environment you need to be sure that a transition is actually was that initial input really an edge? How can we be really sure? I did find this reference useful: https://my.eng.utah.edu/~cs5780/debouncing.pdf It shows how different the debounce on switches can be as well. 1 Quote Link to comment
LogMAN Posted January 28, 2022 Report Share Posted January 28, 2022 Here is a video that showcases a logic designed by NI. It counts the number of iterations since the last state change and triggers when a threshold is reached. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.