-
1. Re: Debouncing multiple inputs
rola_264706 Aug 16, 2016 10:24 AM (in response to rigac_1490111)Please post your program so we can check it. Also what device are you using?
-
2. Re: Debouncing multiple inputs
rigac_1490111 Aug 16, 2016 11:03 AM (in response to rola_264706)Here you go.
I am using PSOC 4100 series. (CY8C4124PVI-432)
Rick
-
3. Re: Debouncing multiple inputs
JoMe_264151 Aug 16, 2016 11:20 AM (in response to rigac_1490111)At first: missing
isr_PortZero_StartEx(PortZeroISR);
Keep in mind: All global variables that are changed in an interrupt handler must be declared as "volatile"!!! Explanation here.
I had best experiences with a different approach: I used a timer and checked for a defined number of consecutive states of a pin before it was considered debounced.
Bob
-
4. Re: Debouncing multiple inputs
rigac_1490111 Aug 16, 2016 11:40 AM (in response to rigac_1490111)If I use a timer interrupt can I ready frequencies within the range of .3hz-1khz?
Rick
-
5. Re: Debouncing multiple inputs
JoMe_264151 Aug 16, 2016 11:56 AM (in response to rigac_1490111)Probably not. Debouncing usually needed for mechanical switches only, not for frequencies in the kHz range.
Can you tell us a bit more about your signals and what you want to perform.
Bob
-
6. Re: Debouncing multiple inputs
rigac_1490111 Aug 16, 2016 12:02 PM (in response to rigac_1490111)I have 3 input signals. 2 signals are water flow meters and the other signal is a pulse input signal for measuring rain. I don't need to measure at 1KHz but it would be nice to get around 700 to 1KHz range.
Rick
-
7. Re: Debouncing multiple inputs
JoMe_264151 Aug 16, 2016 12:37 PM (in response to rigac_1490111)Did you check with a scope or logic analyzer if and how long the signals bounce?
Bob
-
8. Re: Debouncing multiple inputs
rigac_1490111 Aug 16, 2016 12:48 PM (in response to rigac_1490111)I dont see the noise on the flow sensors only the rain sensor. Rain sensor noise ranges from 1-2ms.
Rick
-
9. Re: Debouncing multiple inputs
rola_264706 Aug 16, 2016 1:33 PM (in response to rigac_1490111)Are you using the Rain sensors that they use for lawns with the micro switch? You should use CapSense to measure the rain. You can also make a pattern of lines on a pc board and check for a change in resistance.
-
-
11. Re: Debouncing multiple inputs
rola_264706 Aug 16, 2016 1:58 PM (in response to rigac_1490111)Here is the CapSense design guide.
-
12. Re: Debouncing multiple inputs
rigac_1490111 Aug 16, 2016 4:22 PM (in response to rigac_1490111)Hi Bobgear,
Thanks for the advice but I am already using a tipping bucket. The bucket tips and sends out a pulse to the micro but there is some noise involved. I want to debounce this using a timer interrupt.
Rick
-
13. Re: Debouncing multiple inputs
JoMe_264151 Aug 17, 2016 12:41 AM (in response to rigac_1490111)There is a difference between "noise" and "bouncing" which require different actions.
Digital noise can be canceled using a comparator with hysteresis, analog noise by using a (software) filter (averaging).
Bouncing is for digital signals only and describes the switching between two states for a given time until a steady state is reached.
De-bouncing can be made only by waiting for the bouncing time to expire and re-read the digital state. Since bouncing appears at switching on and switching off, both actions have to be solved by the algorithm.
So what are your "noise" and "bouncing" signals?
Bob
-