Re: Purpose of the cap in this RC Debouncer circuit...
I'm sorry, you're right. They are and have been enabled. I just had it backwards in my head for some reason!
I decided to abandoned William Dillon's debouncer code and just go for a very simply poll the input, when we see a pin go low, register a push, wait 200 ms or so, if the button is still low, loop until it goes back high, and then continue. It's not very advanced and I'm sure there's probably some unforeseen problems that might pop up, but it seems to work my really fast button mashing and everything. I've tested it by making 4 LEDs light up in binary. One button counts up, the other counts down. No matter how fast I push the button, it seems to work just fine.
Purpose of the cap in this RC Debouncer circuit...
Collapse
X
-
Re: Purpose of the cap in this RC Debouncer circuit...
you have it the wrong way around,
pullup resistors keep the input high until you connect them to ground - like with a button.
if your button grounds the input, enable the pullupsLeave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
Yes, I have disabled the pullups because I'm setting the inputs to high and then when the button is pushed, it pulls them to low. Originally, I was doing it the opposite way and had the internal pullups enable. I would have the inputs set to low and when the buttons where pressed, they'd go high. However, people on the MicroChip forums suggested against this and said normally, it's best to have the switches go low and normal inputs high.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
Ooo! I found an inverter. It's an open-collector inverter (SN74LS06N). Maybe I could use this.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
Quick note on this topic: everything has its place. You must look at the application to see which approach is likely to work best. Unfortunately these circuits don't exist in a vacuum. Maybe TTL is a better choice when used in an automotive environment, for example (due to its lower impedance = less likely to be affected by EMI).
You might look up the massive literature available on switch debouncing and see that there are a variety of ways to do it. I don't care for the particular example shown but it will work in non-critical circuits. A quick look at a typical data sheet for CMOS will tell you the maximum rise time for an input. Slower rise times will cause the chip to oscillate, negating the purpose of the debouncer circuit. Adding a little positive feedback or the use of a Schmidt trigger will stabilize a debouncer.
You are over-teching the time constant aspect. RxC gives you some information about how many input events your circuit can handle per unit time, but exact calculation is rarely important. Knowing what type of IC is significant for 2 reasons: because the input impedance of the IC directly affects the time constant in a simple circuit as above, and also that the defined logic threshold voltage is different for TTL than for CMOS. (the voltage which the chip considers to be a 0 or a 1). So for a TTL chip, that point is about 1.8volts, while for a 5 volt CMOS chip it will be around 2.5 volts.
Why not throw this circuit together on a board and observe the results with various parts values?
I want to build the circuit because I'm struggling very much implementing a software debouncing routine. I've seen a bunch of source codes but they all seem to involve using interrupts and I didn't want to use an interrupt right now. I've found some that don't use interrupt. I thought right now, it'd be best using someone elses code instead of mine, just to get the debouncer stuff taken care of. William Dillion had some debouncing code that I tried using. I can get the LEDs to turn on just fine, but when I try to turn them off, I end up with the bouncing problem again. I think maybe I need a delay or something in there before turning off the LEDs. I can share the code if you're interested.
As for building the circuit, I don't have the 74AHCT14 inverter. I do have some older chips from the late 90's / very early 2000's that I bought at Radio Shack, back when they carried a bunch of ICs. I'm wondering if I could use some of them. I believe my CD74HCT74E might have an inverter built into it but it's been so long since I've played with digital logic that I'm gonna have to study it a good deal. These are the ICs I currently have:
CD74HCT74E ( High Speed CMOS Logic Dual Positive-Edge-Triggered D Flip-Flops with Set and Reset )
74HCT74N ( Dual D-type flip-flop with set and
reset; positive-edge trigger )
CD4027BCN ( Dual J-K Master/Slave Flip-Flop with Set and Reset )
SIL 4516BE ( Binary up / down counter )
CD74HCT138E (High Speed CMOS Logic 3-to-8 Line Decoder/Demultiplexer Inverting and Non-Inverting )
MC14017BCP ( Decade Counter)
BA10324A ( Ground Sense Operational Amplifiers )
BA546 ( 6V/330mW single-channel power amplifier )
There's a few ICs in this kit I got when Radio Shack was going out of business, a Make: Electronics Pro kit, one and two. I'll check to see if an inverter is in there...Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
it's worh pointing out that there may be an internal pullup/down resistor on the input on some chips.
pic's have switchable internal pullups for example.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
You might look up the massive literature available on switch debouncing and see that there are a variety of ways to do it. I don't care for the particular example shown but it will work in non-critical circuits. A quick look at a typical data sheet for CMOS will tell you the maximum rise time for an input. Slower rise times will cause the chip to oscillate, negating the purpose of the debouncer circuit. Adding a little positive feedback or the use of a Schmidt trigger will stabilize a debouncer.
You are over-teching the time constant aspect. RxC gives you some information about how many input events your circuit can handle per unit time, but exact calculation is rarely important. Knowing what type of IC is significant for 2 reasons: because the input impedance of the IC directly affects the time constant in a simple circuit as above, and also that the defined logic threshold voltage is different for TTL than for CMOS. (the voltage which the chip considers to be a 0 or a 1). So for a TTL chip, that point is about 1.8volts, while for a 5 volt CMOS chip it will be around 2.5 volts.
Why not throw this circuit together on a board and observe the results with various parts values?Last edited by Longbow; 12-22-2015, 09:14 AM.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
Wow, that was a great help! I remember valance electrons some how from high school chemistry! What you said made a lot of sense and it answers so many questions. Thank you Keeney123!!! I'll reread your post again tomorrow and I'll finish reading that article you linked me to. I kept on reading and got to some math and felt that it was a good time to stop for the night. I was reading how ohms x farads = time. They had some weird greek symbols I think in some of the formulas. I think one is called a Tau (au = ou as in pout). I took up to pre-calc in college. My major didn't require calc or diffy q's or anything so some of these symbols used in these formulas are foreign to me. Thanks for helping me understand!Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
The short version is the charges of the plate hold each other together because the characteristics of the make up of the plates and the dielectric.
Long version:This is how I look at it; With Direct Current you will have valance electrons from one atom bumping into valance electrons of another atom in a copper wire. The potential that creates this a batteries Voltage. A battery terminal has say on one side a +5VDC on the other side a -5VDC to make a 10 DC Volt battery, which when you measure across the battery and observe the polarity a +10 Volts. What creates this voltage are the components inside the battery. This is a chemical reaction within the battery. Now, if you go back to what I said about Direct Current and the valance electrons bumping into each other this happens from the positive terminal to the negative terminal in one direction. Because a capacitor has a dielectric which is an insulating material and plates that are conductive it presents a condition that when you connect a battery to it you will have an instantaneously full amount of current flow from one valance electron to another in the copper wire( with copper wire resistance) then to the plates(set at a specific distance to each other) of the capacitor through the insulator(made of certain types of materials and of specific resistance) continuing on the the other plate and back to the other terminal through the chemical reaction of the battery( which is the internal resistance of the battery). So the condition of the capacitor is the plate builds up a charge(coulombs) because the gap between the plates with the dielectric resist the flow of electrons in such a way that the opposing plates in a capacitor hold the charge from one plate to another. So the current in a capacitor is controlled by the resistance of the circuit including the internal resistance of the battery it is logarithmic in nature and starts out at maximum and reduces to near "0" but never attains "0". At the same time the Voltage starts out at "0" and attains near the voltage of the battery but never reaches that point. As the current runs through the plates charges accumulate on the plates positive and negative holding each other together. The short version is the charges of the plate hold each other together because the characteristics of the make up of the plate. I guess this is the best I can explain this.Last edited by keeney123; 12-21-2015, 11:50 PM.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
Thank you Keeney123. I've tried in the past to understand capacitors but have failed. I think I'll understand this time around but I'm going to need to ask some questions for clarification, if that's alright.
I've started reading the PDF you linked to and I had a question already. This is what the PDF says:
Code:...the battery will drive charges around the circuit as an electric current. When the charges reach the plates they can't go any further because of the insulating gap so they collect on the plates, one plate becoming positively charged and the other negatively charged. This slow buildup of electric charge actually begins to resist the addition of more charge as a voltage begins to build across the plates, thus opposing the action of the battery....
I don't understand why they collect on the plates and why one becomes positively charged and the other negatively charged though. Why is it a slow buildup? Is the reason it resists the addition of more charge because it's saturated with electrons? How is this creating the voltage across the plates?
I have more questions but I figured that's enough right now! Maybe if the first one gets answered, the other ones would just start making sense to me.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
I'm going to sit down and read this early Christmas gift my wonderful wife got me. C Programming - A Modern Approach, 2nd Edition by K.N. King. It's a great book on C. I understand what bouncing is and I understand a few ways to detect it and the workarounds. It's just implementing the functions that I'm having trouble with. Instead of writing my own function, I've decided to use William Dillon's debouncing function. Just gotta figure out how it works and everything.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
So here is a good explanation of RC t with natural log.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
it's the "T" in HCT that makes it compatable - ish.
there are rare instances where they dont work as ttl replacements though.
dont ask - it's down to trial and error.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
I see the 74AHCT14 is a CMOS inverter that provides pin compatibility with TTL logic. That's kind of nice. We can finally move away from TTL logic and stick with mainly CMOS type ICs now. I know it's really easy to damage CMOS with ESD but I think the less power they consume could really benefit the world. Make it more green, you know?Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
I think maybe Vth might be the Logical Threshold, where the input and output voltages are equal. Just gotta find where this information is located in the datasheet. I found an old article saying you could calculate it by hooking the output of the inverter up to the input of the inverter and measure it.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
Thanks Stj. I was thinking of going with the CMOS ones.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
dont mix up ttl and cmos chips - the input specifics are different.Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
I'm looking at a formula, here: http://www.ganssle.com/debouncing-pt2.htm
that shows the formula on how to calculate how long it takes to discharge a cap. They rearrange the formula so we can calculate what resistor value I need to do away with the bounce. The formula, rearranged is:
Code:[FONT="Courier New"] R = -t ----- C(ln(Vth/Vinitial)) [/FONT]
C is the value of the capacitor, in farads. They use 0.1 uF, or 0.0000001 farads. Vth, they say, is the input hysteresis I think. I'm having trouble finding out how to find this number. In their example, they say the 7414 hex inverter has a Vth, worst case, of 1.7V. Vinitial is the voltage we supply to the circuit, in this case, 5V. Solving the equation, we get:
Code:[FONT="Courier New"] R = -0.02 ----- 0.0000001(ln(1.7/5)) R = -0.02 ----- 0.0000001*ln(0.34) R = -0.02 ----- 0.0000001*-1.07880966137193 R = -0.02 ----- -0.000000107880966137193 R = 185389.515093569483385678265672 or roughly 185K. [/FONT]
Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
Okay, thank you eccerr0r. So the point of R1 is just so VCC isn't connected directly to ground when the flip is switched? It's just a load that drops the voltage before hitting ground? R2 and the value of the cap is what determines how long the inverter stays high? Longer bounce, different values, right?Leave a comment:
-
Re: Purpose of the cap in this RC Debouncer circuit...
Uh...
Analyze this way: Treat the inverter's input as mostly an open circuit, so basically ignore the inverter for now (not exactly the right model, but close enough). The voltage across the cap is what is fed in the inverter.
The key to this is that the voltage across a cap cannot change instantaneously, unless it is a BAD CAP.
Now case 1: switch is open (not pressed). Basically you end up with two resistors in series and capacitor. The capacitor will eventually charge up to VCC, no questions about that. When the cap voltage rises above the flip point of the inverter, the output goes low.
Case 2: the switch is pressed. In this case R1 is shorted to ground and does nothing except eat power. R2 is now parallel with the capacitor, so it also starts discharging the capacitor. Capacitor voltage will go down and eventually hit GND. When the voltage drops below the trip point of the inverter, the inverter will flip high.
The reason for the cap? The cap is there to make sure the amount of time that the switch is bouncing is shorter than the amount of time to charge/discharge the cap so that it's hidden in the scheme of things.Last edited by eccerr0r; 12-21-2015, 01:54 PM.Leave a comment:
Related Topics
Collapse
-
Hi Everyone. First official post so fingers crossed I conform and also manage to get photos to work.
So I am requesting some help from anyone who happens to have one of these motherboards to hand and perhaps a multimeter.
My board has a single row of header pins for all the front panel stuff (have seen others where they are grouped together differently so thats no help) and the two pins for the power on switch had been previously repaired and I am trying to make a better repair. There looks to be pad and trace damage and im happy to relocate the header pin/pins to...13 Photos06-24-2024, 01:24 PM -
This specification for the Acer Switch Switch V 10 SW5-017P Hybrid (2-in-1) can be useful for upgrading or repairing a laptop that is not working. As a community we are working through our specifications to add valuable data like the Switch V 10 SW5-017P boardview and Switch V 10 SW5-017P schematic. Our users have donated over 1 million documents which are being added to the site. This page will be updated soon with additional information. Alternatively you can request additional help from our users directly on the relevant badcaps forum. Please note that we offer no warranties that any specification,...09-06-2024, 05:30 AM
-
by fab13Hello everyone
Small technical problem on a Nintendo Switch lite
Here's what I noticed: the USB port has been damaged internally, with a short circuit on the power supply line to the small fuse.
After replacing the USB connector, the short circuit went away and I can't see any other short circuit in the whole motherboard.
When I charge the console, it seems to be charging: I get 15 volts and an amperage of 0.450 A.
Then, after a while, the amperage increases to 1.1 A and the BQ24193 charging chip starts to heat up, as evidenced... -
by ktmmotocrossHello.
Have this GB 2080 Super that crash on load. When half load i see instability on one of two switched 12V rails. I dont know its purpose and dont have BV or Schema for this board.
Can anybody explain me what is purpose of this two switched 12V lines?... -
by grimacelordHello,
I've been working on a NEC TurboExpress and I accidentally got the plastic inside the power ON/OFF switch too hot while doing other repairs and melted it. At first, it would still power on when sliding the switch, but you had to really press inward while sliding to get it to work.
I removed the switch component and tried to gently melt the plastic back so it would work more reliably and all I managed to do was make it worse.
I need to find a replacement On/OFF switch for this, but having some trouble figuring out which kind of switch I need.... - Loading...
- No more items.
Leave a comment: