OK, I think I see the real problem. Microchip specifies max -.3V on any input, and my circuit gets about -0.7 - 0.2 = -0.5 To solve that we need to connect the base of the transistor via a Si diode to ground :-)
Aside from implied switching thresholds, consider what happens if/when the input (connected to the outside world) exceeds the 5V to -12V range on a transient basis.
Best regards, Spehro Pefhany
--
"it\'s the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
Nice! Simply reverse this idea (flip the diodes and swap com & Vdd) and you can use a regular dual diode and get better noise margins to boot. Provided you don't mind sinking current rather than sourcing it, and it being high with open input rather than low.
Best regards, Spehro Pefhany
--
"it\'s the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
My main consideration was application of the external signals when the PIC was powered down. Latch susceptibility usually occurs on power up under that circumstance. If the 5V for the externals is from the same source as the PIC Vdd, then he only needs the one diode and he can drop the pull-up 100K in the original. View in a fixed-width font such as Courier.
I think it will work without all those $*&#$ capacitors too.. anyone know for sure?
Best regards, Spehro Pefhany
--
"it\'s the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
Right. Couple weeks ago: Client moved to larger digs. Rigged up the testers, some of which driven by gear that seems to be designed by scientists rather than engineers. The janitor plugs in his vacuum, flicks the switch ... bzzzt ... BADABANG!
Yes. I have now decided it is better to use this circuit:
+5 | R whatever |-----------------> PIC c in >-- R-------- b NPN 10k |k e D | |a | /// ///
In fact I will probably use this in an other ciruit I am putting together. I do not like to interface PICs directly to the outside world. A bit of protection is always nice. I know it means extra components, but transistors are cheap.
Yes. You might consider whether it's a good idea to add another resistor to ground on the input (or B-E).
Depends on the swing you need, accuracy etc. If you have to swing close to (or slightly beyond) the rails, have very low leakage (to preserve accuracy) it gets a bit challenging. If you can throw away the last couple hundred mV of swing (often more on the high side if you're using a proper reference) it's not so bad-- a bunch of inexpensive discretes will do it.
Best regards, Spehro Pefhany
--
"it\'s the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
I do this all the time with uCs. Ok, not PICs because I don't use PICs. The 10K or similar, then a BAV99 instead of your single diode (one side goes to VCC, then another 499ohm or so to the uC pin. No transistor.
Same as described above but the diodes need to go to something beyond the rails. Often I give them an extra local rail a few 100mV beyond VCC and below GND. Else you'll have non-linearities. This takes care of even the nastier spikes.
With a mast amp for shortwave I had as a kid all this didn't help because lightning can toast nearly anything. There I used a little tube. Never had a problem again, ever.
On a sunny day (Fri, 14 Dec 2007 09:24:11 -0800) it happened Joerg wrote in :
Yes nice to have 2 diodes in one package. I see it drops 1V @50mA and 1.25 V@ 150mA.
In an other project I use something like this (not exact values have to look it up)
in ---- R1 ------- R2 -------- analog in | Z1 zener 5V6 | ///
The left part limits at +5.6 and -.7 (or higher), the rest is for the diodes in the chip, with current limit by R2. In that case it is driven from a low impedance, so not a big problem to\\ have some leakage.
Yes, this needs some more thought, 2 extra supply lines makes things complicated.
Yes, lightning is different. I had a TV in for repair that had a lightning strike. Everything in the tuner module looked normal, except there were no traces left on the board.
You have to select the 2nd resistor so the difference between the 2V or so under maximum zing and the substrate diode doesn't produce more than a certain amount of substrate current.
it up)
I do not trust zeners.
complicated.
Not really. In the simplest form it's just a voltage divider and 1uF ceramic per "helper rail". Sometimes I use a diode for the lower resistor.
That only leaves the diode solution and a _very_ weak current into it. You don't need to come much off the rail so even if you only make 400mV or so it's usually fine.
I agree. The flow of even small amounts of continuos current in internal 'protection' diode structures can make adjacent inputs perform out of spec, or not as anticipated for even simple characteristics like input z.
On a uC? C'mon. Ok, I wouldn't necessarily do it if there was something like a 16-bit SAR on board but even then I'd be tempted. I'm always tempted ...
At least you'd probably check it out thoroughly. I don't really mind fixing the kind of mess that results when others yield to such temptations, but it's not cheap.
Best regards, Spehro Pefhany
--
"it\'s the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.