recklessrog
- Joined May 23, 2013
- 985
Do it in software. Caps fail. Code never does. And code is free.
Had to comment a bit off topic, "caps fail, code never does" anyone who's ever owned a P.C may disagree, I think code sometimes has moods ha ha
Do it in software. Caps fail. Code never does. And code is free.
Hadn't heard about a problem with cost only software debounce. So please do finish up your circuit.At $3.41 a pop? Too rich for my blood.
Thanks, Joey. You mentioned that your circuit is meant to be used for buttons, exclusively. Question: could it be used to transmit a digital signal at less than 100 kHz, say, from an encoder that's a few meters away from the MCU?... assuming that a resistor is placed in the line to the transistor's base to limit its current, of course.Good points, @AnalogKid, except that I made clear that the circuit is for implementing a contact-closure input -- not a high speed data interface. I also made it clear that it did not provide any debouncing whatsoever -- I do that in software.
Your analysis about 'low amplitude interference' is not applicable in the contact-closure case, IMHO (there is no closed loop switch-open, and there is low-impedance ground everywhere for switch-closed). If I am wrong about this, please illustrate a realistic case where such interference will be problematic.
Aside from that, I've no issue using either an NPN or darlington (save that a darlington won't pull as low as NPN -- important for low-voltage digital inputs -- check the input low voltage range!).
Just FYI, I've used this circuit as a contact-closure front end for many years on many different designs in high-interference installations with long cable lengths. Zero failures or false activation.
Also, important: These circuits provide no isolation at all! If actual isolation is required, other methods must be used.
Cost is not a real issue here, since I'm not designing a commercial product... software development, on the other hand, would be far costlier than the chip.Hadn't heard about a problem with cost only software debounce. So please do finish up your circuit.
Maybe your code......I think code sometimes has moods ha ha
A mechanical encoder? If so, take care collector the rise time is adequate.Thanks, Joey. You mentioned that your circuit is meant to be used for buttons, exclusively. Question: could it be used to transmit a digital signal at less than 100 kHz, say, from an encoder that's a few meters away from the MCU?... assuming that a resistor is placed in the line to the transistor's base to limit its current, of course.
Actually, it's a magnetic encoder with 5V push-pull outputsA mechanical encoder? If so, take care collector the rise time is adequate.
An optical encoder? No.
more like microsofts!Maybe your code...
I agree... but we're talking about MCU code here... assembly, in my casemore like microsofts!
That's a color of another horse.Actually, it's a magnetic encoder with 5V push-pull outputs
Start a new thread. Include the datasheet in the post. Make it a new discussion.Actually, it's a magnetic encoder with 5V push-pull outputs
You're right (again)... I'll do that in a few hours... gotta get to work.Start a new thread. Include the datasheet in the post. Make it a new discussion.
Thank you, Joeyd. I stand wholly and enthusiastically corrected. Very well thought out and well said. I'll remember those points and your circuit (and the reference!).Much better. I'd be happy to provide an explanation.
...
Twisted pair is what I'd go for, if its likely to be *VERY* long, I'd use constant current and clamp the input voltage before it gets to the MCU input.Oh, and you won't need the shielded wire. Twisted pair will be fine.
It is clamped to +/- 0.7V.Twisted pair is what I'd go for, if its likely to be *VERY* long, I'd use constant current and clamp the input voltage before it gets to the MCU input.
If you're referring to the inbuilt clamp diodes, they're only intended to discourage buildup of static on the pins, typically they can rarely handle any more than about 10mA or so without failing.It is clamped to +/- 0.7V.
I thought you were referring to my circuit -- which is what the post you were replying to was referring to.If you're referring to the inbuilt clamp diodes...
The bugs in code usually lie in wait for some specific event that never occurred to the programmer.Had to comment a bit off topic, "caps fail, code never does" anyone who's ever owned a P.C may disagree, I think code sometimes has moods ha ha
I agree... but we're talking about MCU code here... assembly, in my case