I made a simple counter with a pic16F84. The circuit is:
RB4 : first counter input
RB5 : second counter input
RB0,1,2,3,6,7 : not connected
RA0,1,2,3 : not connected
RA3 : pull-up resistor to Vcc (10K)
Osc1,Osc2 : 4 Mhz resonator
MCLR# : Reset circuit with 100nF, 10K and 1N4148
(as Microchip datasheet) plus a serial 1N4148 for
in-circuit serial programming.
The input counter are normally high (5V) and drive from external circuit.
RA3 is used for serial print but normally not connected during normal
operation (the printer is connected only during printing). All pin are
programmed as input pin (RA3 as output when print).
The circuit is mount inside a machine that provide power (is used a
switching feed) and counter signal (the main board is a microprocessing
board).
All circuit are mounted in a box with a keyboard and monitor.
The machine must pass a test with a high voltage discharge on the front
panel. The discharge is generated with a electrical ignite gas (normally
used to light a ring).
The circuit seems to work fine but at the first discharge the pic is reset
(not a really problem) and after some seconds it become hot (it seems to be
a short circuit somewhere but where???) and after 20 seconds it break.
To avoid Pic break I must turn off the machine quickly.
> The circuit seems to work fine but at the first discharge the pic is reset
> (not a really problem) and after some seconds it become hot (it seems to be
> a short circuit somewhere but where???) and after 20 seconds it break.
> To avoid Pic break I must turn off the machine quickly.
>
> Where is the error? Someone have a idea?
>
You need ESD protection ... current limiting input resistors to all inputs and
clamp diodes to limit over/under voltages ... the clamp diodes inside the PIC
are not able to absorb big surges, which is what your discharge is generating.
It is also a very bad idea to leave unused input pins floating ... connect
them to 0V or 5V (through a resistor, if you wish) or configure them as
outputs.
>You need ESD protection ... current limiting input resistors to all inputs
and
>clamp diodes to limit over/under voltages ... the clamp diodes inside the PIC
>are not able to absorb big surges, which is what your discharge is
generating.
>It is also a very bad idea to leave unused input pins floating ... connect
>them to 0V or 5V (through a resistor, if you wish) or configure them as
>outputs.
I tryed to insert a resistor (1K) in serial at pin RB4 and RB5. The portB
internal pull up resistors are active.
The circuit continue to seems work fine but at the first discharge the pic
is reset (not a really problem) and after some seconds it become hot (it
seems to be a short circuit somewhere but where???) and after 20 seconds it
break.
I'll try to add a 100 ohm resistor on Vcc pin (in serial) for limit
current. The result is a 47 mA on Vcc pin after a discarge (with about 1,4
Volt on Vcc pin of PIC). With this tension the PIC don't work (obvious) but
it continue to absorb 47mA. Why? It must be in stop mode (or reset).
RB4 : first counter input with 1K serial resistor
RB5 : second counter input with 1K serial resistor
RB0,1,2,3,6,7 : not connected
RA0,1,2,3 : not connected
RA3 : pull-up resistor to Vcc (10K)
Osc1,Osc2 : 4 Mhz resonator
MCLR# : Reset circuit with 100nF, 10K and 1N4148
(as Microchip datasheet) plus a serial 1N4148 for
in-circuit serial programming.
> I'll try to add a 100 ohm resistor on Vcc pin (in serial) for limit
> current. The result is a 47 mA on Vcc pin after a discarge (with about 1,4
> Volt on Vcc pin of PIC). With this tension the PIC don't work (obvious) but
> it continue to absorb 47mA. Why? It must be in stop mode (or reset).
Probably it is in latchup "mode". That is, it connects VDD and GND internally.
If you have a strong power supply, you will fry the chip.
Latchup is a problem of all CMOS devices, and triggered usually by rising
an input pin above VDD. The PIC (and many other CMOS devices) have internal
protection diodes from each pin to VDD and GND. Through those, any input
above VDD+0.7V (or below GND-0.7V) will be shorted to VDD (or GND).
Probably those are not fast enough or do not support the current involved
in your "ESD" test.
You can try to add external circuit with similar functionality. For example,
add a series resistor of 10k to each pin, and pairs of diodes to VDD and
GND on the PICs side of the resistors.
There exist integrated circuits for that purpose, I think SP720 is one
of them.
But actually I suspect that your ESD spike is finding a way into your PIC
which you didn't see yet. Check if your front plate has a galvanic connection
to any part of the circuit other than GND. If no, disconnect GND too and
have the front plate floating just to be sure.
Somewhat related... I thought I'd get comments on recent
experience with a design using a 16c61. From my experience in broadcast,
I usually expect any RF problems to be conducted into a product instead
of radiated. I've been able to run devices at transmitter sites with the
covers removed but had problems when I/O wiring was connected. I
generally then did extensive filtering of all I/O wiring to solve the
problem.
The current project involves using a 16c61 to control a 300 watt
xenon lamp. The manufacturer of the power supply for the lamp very
nicely includes an optically coupled input to turn the lamp on (just
drive it with 5VDC) and an opto coupled open collector output to tell us
the lamp is running (since it may take a little time for the lamp to
fire).
The trick is that when the lamp fires, it generates some pretty
strong EMI (probably equivalent to the ElectroMagnetic Pulse generated by
a nuclear blast) and the PIC resets (thus turning off the lamp).
Experimentation has revealed that adding a steel (aluminum
doesn't work) between the lamp power supply and my circuit keeps the PIC
from crashing. It was not necessary to add filtering on the I/O lines
driving the opto circuits (so much for the conduction idea).
The PIC circuit is powered by an Astrodyne modular switching
power supply (so we could get universal line input without switching).
There is, of course, the possibility of EMI being conducted down the AC
line into the power supply, then on to the PIC. The power supply is not
behind the above mentioned steel shield. However, this did not
immediately appear to be a problem. I suspect the power supply has a
pretty good AC line filter built in, since it complies with FCC part 15
digital device requirements for class B (residential). I ran copper
braid from the ground screw, under the unit, to the negative output
terminal. The braid then makes contact with the chassis when the power
supply is screwed down.
I originally had the AC to the PIC power supply connected across
the AC to the lamp power supply. Incoming AC goes through a line filter,
fuses, then to the power supplies. This worked fine until I put the
cover on the unit. Then, the firing of the lamp would reset the PIC.
I have ended up moving the AC input to the PIC power supply to
before the input line filter. The system now works fine (with the cover
in place).
Lots of trial and error!
___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]
|I tryed to insert a resistor (1K) in serial at pin RB4 and RB5. The portB
|internal pull up resistors are active.
I'd suggest using larger resistors in series with the PIC port pins,
and using external pull-ups (on the input side of those series res-
istors). If signal rise/fall times aren't critical, adding a cap near
the PIC input can help too. Something like this:
VDD
|
R1
PIC --+-R2----+------ Input
|
C
|
Vss
R1 ~ 4.7K-47K [adjust based upon input]
R2 - 47K-470K [adjust based upon desired speed]
C - 0.001uF-0.1uF [adjust based upon desired speed]
Note that in addition to the above, you should also have a 5.1V Zener
between VDD and ground to ensure that any incoming transients don't
raise VDD excessively; this is especially important if R1 is small.
At 16:42 03/11/99 -0600, John Payson wrote:
>I'd suggest using larger resistors in series with the PIC port pins,
>and using external pull-ups (on the input side of those series res-
>istors). If signal rise/fall times aren't critical, adding a cap near
>the PIC input can help too. Something like this:
>
> VDD
> |
> R1
>PIC --+-R2----+------ Input
> |
> C
> |
> Vss
>
>R1 ~ 4.7K-47K [adjust based upon input]
>R2 - 47K-470K [adjust based upon desired speed]
... and upon the chosen r1 (if the input is a contact to Vss): the pic
input should go near Vdd (that is, being more than Vih) when the contact is
open.
BTW, it seems that i cannot read the data sheets. they say that Vih is 2V
for 4.5V<Vdd<5.5V, but they say also that Vih is 0.25*Vdd "for the entire
Vdd range," which should include 5.5V. but 5.5V*0.25=1.4V -- so why's it
spec'd at 2V then for this range?
For now I can't use external pull-UP so I can't use a bigger R1.
The circuit now run and the PIC don't fry.
There is only a last problem. At each discarge the PIC reset.
I use this reset circuit:
I'll try to insert a 5,6 Volt Varistor between Vdd and Vss with no result.
I'll try to use tree Emi Suppression Filter DSS710 D 223S-22 from MURATA
instead the up circuit (to isolate circuit). One on power and the other two
on input pins. The PIC fry! (the gost of latchup came back).
With a digital oscilloscope i found that the ESD frequency is about 24 MHz
(with +/-200 Volt) but I can't watch the signal on input pin because the
probe is a perfect antenna !!
There is another problem. With some discarge the the PIC count a input (the
circuit is a counter). I use big delay with anti-rebound ruotine but the
error remain.
Some idea??
> There is only a last problem. At each discarge the PIC reset.
> I use this reset circuit:
>
> Vdd Vdd
> | |
> D2 10K
> | |
> PIC --+--D1---+----R1---+
> MCLR | | |
> | D3 C1=100nF
> | | |
> | Vss Vss
> |
> In serial prog.input
>
> D1=D2=D3=1N4148
> R1=1K
Skip this circuit in favour of a simple 1k2 pullup resistor
from MCLR to VDD.
I'm currently building a high voltage generator
(30 kV or so and a couple of mA). When I put the
outputs close enough to generate sparks (1-2cm) the
processor was reset.
The circuit is built on vero board. I isolated the
power for the processor from the high voltage drive
circuit and connected the signals from the processor
through optocouplers (only 2 is needed, charge and
discharge). But what helped most was a groundplane
for the processor circuit. I used a .2mm copper sheet
which I soldered to every ground point for the
processor circuit under the veroboard.
This solved my reset problem.
I use a Scenix chip with internal 4MHz RC osc in turbo
mode. MCLR is connected directly to VDD.
I use a IR2112 as a high side driver for a IGBT that
charges a capacitor through an inductor. The IGBT is driven
with 350V (230V rectified) which is doubled (by the inductor)
at the capacitor.
The capacitor is then discharged by a SCR through an ignition coil.
The SCR is driven by the low side driver in the IR2112.
> I'll try to insert a 5,6 Volt Varistor between Vdd and Vss with no result.
>
> I'll try to use tree Emi Suppression Filter DSS710 D 223S-22 from MURATA
> instead the up circuit (to isolate circuit). One on power and the other two
> on input pins. The PIC fry! (the gost of latchup came back).
>
> With a digital oscilloscope i found that the ESD frequency is about 24 MHz
> (with +/-200 Volt) but I can't watch the signal on input pin because the
> probe is a perfect antenna !!
>
> There is another problem. With some discarge the the PIC count a input (the
> circuit is a counter). I use big delay with anti-rebound ruotine but the
> error remain.
> Some idea??
>
> TIA
> Giorgio.
==============================
Ruben Jvnsson
AB Liros Elektronik
Box 9124, 200 39 Malmv, Sweden
TEL INT +4640142078
FAX INT +4640947388 EraseMErubenspam_OUTTakeThisOuT2.sbbs.se
==============================