Searching \ for '[PIC]: Analogue pin protection' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=analog
Search entire site for: 'Analogue pin protection'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Analogue pin protection'
2002\07\09@004646 by Jinx

face picon face
I've got this signal

http://home.clear.net.nz/pages/joecolquitt/lv_an.html

going into AN0 of a 16F877. It works but the signal must
have some negative-going components (or possibly a
switch glitch) as the port occassionally latches. How can
I best protect the pin against signals going below Vss-0.6V

According to 20.11 of the Mid-range Manual

"Since the analogue pins are connected to a digital output,
they have reverse biased doides to Vdd and Vss. The
analogue input therefore must be between Vdd and Vss. If
the input voltage deviates from this range by more than 0.6V
in either direction, one of the diodes is forward biased and
latch-up may occur"

'kin oath it occurs, mate, 'kin oath

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@010840 by John Dammeyer

flavicon
face
A schottkey to ground with the cathode on the signal.  This will limit
negative voltages to 0.2V.  I've used 1N5817s to good effect.  Your
source is such low impedance that the diode leakage shouldn't affect the
signal.  I'd add an RC network for this circuit.

John Dammeyer


Wireless CAN with the CANRF module.
www.autoartisans.com/documents/canrf_prod_announcement.pdf
Automation Artisans Inc.
Ph. 1 250 544 4950


> {Original Message removed}

2002\07\09@011616 by lexandre_Guimar=E3es?=

flavicon
face
Hi,

> I've got this signal
>
> http://home.clear.net.nz/pages/joecolquitt/lv_an.html
>
> going into AN0 of a 16F877. It works but the signal must
> have some negative-going components (or possibly a
> switch glitch) as the port occassionally latches. How can
> I best protect the pin against signals going below Vss-0.6V


   I would put a resistor in series with the signal, a cap after the
resistor to ground and to be on the safe region use a schockty diode reverse
biased to ground. That should clear any problems you might be having
directly. Should be easy to test. The values will depend on the response you
need but basically 100 ohms and 10 nf should leave fast glitches out and
should not affect your circuit operation.

best regards,
Alexandre Guimaraes

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@012042 by Brent Brown

picon face
Hi Jinz,

You could add a series resistor into AN0, not too big & not too
small, say 470R. This will reduce the current flowing into the PIC
diodes from glitches. Also a diode across your current sensing
resistor to limit negative spikes, best would be a schottky as it
will keep it under 0.6V. If you don't need full range on your input
put another diode in the other direction to limit positive peaks as
they could cause latchup too.

--
Brent Brown, Electronic Design Solutions
16 English Street, Hamilton, New Zealand
Ph/fax: +64 7 849 0069
Mobile/txt: 025 334 069
eMail:  brent.brownspamKILLspamclear.net.nz

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@013321 by Jinx

face picon face
Cheers for replies - along the lines of what I was thinking but
as one PIC's AN0 is already frizzed thought I'd wimp out and
ask before making another one suffer

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@044214 by Roman Black

flavicon
face
Hi Jinx, I just checked your circuit, there are a
couple of potential probs. First, you sould add a
series R before the AN0 pin, about 220 ohms, and
a C to gnd on the pin, about 1uF. You might also put
a 0.1uF cap across your 0.47 ohm current sense resistor,
as you will get motor commutation spikes there, probably
what killed your PIC. :o)

Secondly, you are using relays and limit switches
direct on the motor, so keep in mind what happens when
the motor coil is fully powered and a switch opens...
Maybe try 2 zeners (series reversed) across the motor,
rated 1v above your supply current. It might be a fairly
serious voltage that got to your poor PIC, not just
latchup.
-Roman

Jinx wrote:
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@051812 by Jinx

face picon face
Some good points Roman. You know what battery-powered
electric motor circuits can be like - crap everywhere. And this
is a particularly noisy motor too

I've added a 470R series resistor into AN0 and a 1N5819 +
10n from AN0 to ground and it's at least stopped latching, so
maybe this PIC will have a long and happy life. For "belt and
braces" sake though I think I will add those zeners, it's cheap
insurance. After some similar experiences with solenoid
drivers I've found that giving each relay its own diode-isolated
energising cap is a big help, makes far less of a mess of the
PSU when the relay switches as the coil can draw on the cap

If that warning about sub-Vss voltages was in the F877 manual
instead of the Mid-range manual maybe I wouldn't have lost a
PIC pin. Lesson - read damn everything

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@052434 by Roman Black

flavicon
face
Jinx wrote:
>
> Some good points Roman. You know what battery-powered
> electric motor circuits can be like - crap everywhere. And this
> is a particularly noisy motor too
>
> I've added a 470R series resistor into AN0 and a 1N5819 +
> 10n from AN0 to ground and it's at least stopped latching, so
> maybe this PIC will have a long and happy life.


I'd go at least 100n on that cap, if not 330n.
The time delay will still be minimal. :o)
-Roman

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@053722 by Roman Black

flavicon
face
Jinx wrote:
>
> Some good points Roman. You know what battery-powered
> electric motor circuits can be like - crap everywhere. And this
> is a particularly noisy motor too
>
> I've added a 470R series resistor into AN0 and a 1N5819 +
> 10n from AN0 to ground and it's at least stopped latching,

Whoops! I forgot to mention that you won't need
that expensive schottky diode if you use a bigger
cap like 330n etc. Even 470ohm and 330n will
respond within 100uS or so. :o)
-Roman

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@060925 by Jinx

face picon face
> Whoops! I forgot to mention that you won't need
> that expensive schottky diode if you use a bigger
> cap like 330n etc. Even 470ohm and 330n will
> respond within 100uS or so. :o)
> -Roman

Possibly so, but hang the expense. Hang it I say, I'll add the
15c to the bill

Actually I did try RC to start with on the previous board but
it didn't seem to work as I thought it should have and there
was intermittent latching. AFAICT the rest of the PIC with
the wonky AN0 pin still works so it's not a total write-off. I'll
just mark it as "pre-loved"

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistservspamBeGonespammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@084632 by Olin Lathrop

face picon face
part 1 2910 bytes content-type:text/plain; (decoded 7bit)

> I've got this signal
>
> http://home.clear.net.nz/pages/joecolquitt/lv_an.html

It looks like this is from a 470mOhm current sense resistor to measure the
current thru a motor.  That's going to be noisy despite all the capacitors
already on the schematic.  You also have to be real careful with the ground
topology, else the ground wires will act as current sense resistors too.

The first thing I would do with this signal is throw a two pole low pass
filter at it a bit above the highest frequency of interest.  Since you're
signal is only about 150mV, you might want to amplify it also.  The amplify
and filtering can be combined into one opamp stage.

> going into AN0 of a 16F877. It works but the signal must
> have some negative-going components (or possibly a
> switch glitch) as the port occassionally latches. How can
> I best protect the pin against signals going below Vss-0.6V

A two pole filter alone would probably eliminate the spikes, because your
average motor current can't be negative (unless it's a DC motor and can be
driven to act like a generator).  You definitely want something between a
noisy 1/2 ohm signal with spikes on it and a PIC.  I like a two pole LPF,
some gain so that the highest expected useful signal is a bit under 5V, and
an impedence of about 4.7Kohms.  If you still need to worry about spikes,
you can clamp the signal to power and ground with shottky diodes.

When possible, I like to measure external voltages by first providing a
small amount of hardware filtering, then sample the A/D much faster than you
need new values, then low pass filter that in software.  I've done this sort
of thing many times.  Of course it depends on the response time you need
from the resulting signal and how much processing time is available.  Since
the majority of filtering is now done in software, it is easier to change
when the inevitable external changes to the design happen.

For example, let's say you only need about 50mS response time in measuring
the average motor current and that you can spare a few percent of the PIC's
cycles for filtering.  I would initiate a new A/D conversion based on a 1mS
interrupt clock (which is probably useful for lots of other stuff anyway).
The external analog filter should ideally eliminate frequencies above 500Hz.
Two single pole low pass filters at 250Hz should be just fine.

Next you want the software filter to have a reasonable step response in
50mS.  Two poles with 4 bits of shifting each (filter fraction = 1/16) gets
you about a 83% step response in 50mS (see attached plot).  You update the
internal filtered value after every A/D conversion, and the software that
looks at the motor current just picks off this live value whenever it needs
it.  Note that this no longer requires the A/D conversions to be
synchronized with the motor current analisys algorithm.


part 2 8012 bytes content-type:image/gif; (decode)


part 3 310 bytes

*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email TakeThisOuTlistservEraseMEspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@143431 by Peter L. Peres

picon face
On Tue, 9 Jul 2002, Jinx wrote:

>I've got this signal
>
>http://home.clear.net.nz/pages/joecolquitt/lv_an.html
>
>going into AN0 of a 16F877. It works but the signal must
>have some negative-going components (or possibly a
>switch glitch) as the port occassionally latches. How can
>I best protect the pin against signals going below Vss-0.6V
>
>According to 20.11 of the Mid-range Manual
>
>"Since the analogue pins are connected to a digital output,
>they have reverse biased doides to Vdd and Vss. The
>analogue input therefore must be between Vdd and Vss. If
>the input voltage deviates from this range by more than 0.6V
>in either direction, one of the diodes is forward biased and
>latch-up may occur"
>
>'kin oath it occurs, mate, 'kin oath

I don't know about kin and oaths but your problems are very narrow (VHF or
UHF) glitches in the input. Add a RLC lowpass filter and check what the
grounds are doing. A resistor in series with AN0 is the very least required.

Peter

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@174956 by Jinx

face picon face
> >'kin oath it occurs, mate, 'kin oath
>
> I don't know about kin and oaths

" 'kin " is short for a very rude word.  " 'kin oath " is like swearing^2

> but your problems are very narrow (VHF or UHF) glitches in the
> input. Add a RLC lowpass filter and check what the grounds are
> doing. A resistor in series with AN0 is the very least required

Yup, I've updated the circuit and page with list suggestions and
it's working fine now

http://home.clear.net.nz/pages/joecolquitt/lv_an.html

BTW, FB in the circuit are ferrite beads, and caps are ceramics

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservEraseMEspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@191715 by Dwayne Reid

flavicon
face
At 09:48 AM 7/10/02 +1200, Jinx wrote:

>Yup, I've updated the circuit and page with list suggestions and
>it's working fine now
>
>http://home.clear.net.nz/pages/joecolquitt/lv_an.html

If I can add one more suggestion to those already made: move the zeners to
right across the motor.  That allows them to clamp those nasty spikes that
occur when the limit switches open.

Do you have diodes across the limit switches?  If not, how do you move the
motor when a limit switch opens?

dwayne

--
Dwayne Reid   <EraseMEdwaynerspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservEraseMEspamEraseMEmitvma.mit.edu with SET PICList DIGEST in the body


2002\07\09@194456 by Jinx

face picon face
> If I can add one more suggestion to those already made: move
> the zeners to right across the motor.  That allows them to clamp
> those nasty spikes that occur when the limit switches open

Okeydoke

> Do you have diodes across the limit switches?  If not, how do
> you move the motor when a limit switch opens?
>
> dwayne

You don't, not by the PIC anyway. There's a manual switch (not
shown in the diagram). The voltage across the sense resistor is
detected by the PIC and then sent to the LCD to show the state
of the motor wires. By inspection the operator knows whether to
use the manual switch

=================================================

> >" 'kin " is short for a very rude word.  " 'kin oath " is like swearing^2

> And we're supposed to figure that one out even with 5 letters
> missing?? :=)

Sure. Use your 'kin imagination

5 ? What word were you thinking of ?

You didn't count down instead of up did you ?

http://www.beyondroswell.com/roswell/multi-digits.html

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspam_OUTspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\10@004756 by Jinx

face picon face
Olin, thank you very much for your considered response. For this
case I need only to know whether either of the limit switches is
open, so generally a <> 00 at the ADC is sufficient, although in
practice I'm testing for > 20d and that seems to be reliable so far

Your answer IS applicable to another job I'm looking at, which is
a more complex control system based around a FET H-bridge
and I can see how much of what you said can be put to use there

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspamspammitvma.mit.edu


2002\07\11@061422 by Alan B. Pearce

face picon face
>going into AN0 of a 16F877. It works but the
>signal must have some negative-going components
>(or possibly a switch glitch) as the port
>occassionally latches. How can I best protect
>the pin against signals going below Vss-0.6V

I would put a schotkky diode across the zener diode - check RS for a BAT64
or similar diode.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@062252 by Alan B. Pearce

face picon face
Disregard my previous posting on this thread, it looks like I saw your
modified circuit after everybody's postings - just what happens after having
three days leave :)

>If that warning about sub-Vss voltages was in the F877 manual
>instead of the Mid-range manual maybe I wouldn't have lost a
>PIC pin. Lesson - read damn everything

To be fair Jinx, I have always taken this as being gospel for all mos parts,
be they pic's, intel family, motorola family, ordinary cmos, etc. I take
precautions against this sort of thing as standard requirement, without
reading it in the manual. I get more interested in comments that
specifically state pins can go outside the Gnd-Vcc range, and these
typically are given in the "features" bit on the first page bold print.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\07\11@073659 by Jinx

face picon face
> >If that warning about sub-Vss voltages was in the F877 manual
> >instead of the Mid-range manual maybe I wouldn't have lost a
> >PIC pin. Lesson - read damn everything
>
> To be fair Jinx, I have always taken this as being gospel for
> all mos parts,

Yeah, you're right. I'm just buck-passing cos I've got the hump ;)

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...