CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

ADC input protection ??
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lsimaster



Joined: 19 Mar 2009
Posts: 25

View user's profile Send private message

al lttle more
PostPosted: Sun Jan 24, 2010 1:20 pm     Reply with quote

I see this discussion has taken a positive turn. Thanks.

The reason I have used schottky since I first came across this design in 1987 is because the forward drop is about half of a junction diode. This means that a similar package can handle roughly 2x the current of a junction diode in the same package. This also eliminates the need for a 2nd resistor although there is certainly no harm in it. The overall goal is to prevent current injection into the substrate tub of the IC which can result in parasitic SCR latchup or destruction. The selection of component values is determined by the series resistor value and the power capability of the diode in use.

In situations where this approach is not adequate I have been using another resistor in conjunction with a transzorb and a capacitor. This will handle large induced problems such as from lightning or contactor coils. The capacitor lowers the impedance looking into the A/D so you can use a higher protective resistance.

Regarding some erroneous cost information: we buy the BAT54S (dual schottky in series SOT23 pkg) for .0224. With a 1206 resistor this puts the point cost at about $0.03. To help with impedance into the A/D I usually include at least a .1uF cap (or more depending on design parameters) on the processor side of the resistor.

We have had tens of thousands of products deployed for over 20 years, in the most demanding industrial conditions, with complete success.
rovtech



Joined: 24 Sep 2006
Posts: 262

View user's profile Send private message AIM Address

Using the PIC protection diodes for the ADC
PostPosted: Mon Sep 28, 2015 1:38 pm     Reply with quote

I have been searching this forum and Microchip for simple answers to input protection of PIC ADCs.

Somewhere I saw a suggestion of using the internal protection diodes of the PIC. However I cannot find anything in the PIC data sheet that specifies the maximum current of these diodes. 20mA was mentioned in this forum. Also a recommended input impedance of 2.5k for the ADC was mentioned but I cannot find the thread again.

A 2.5k resistor sounds like the solution but where do I find these specifications (diode current and ADC input impedance recommendation)? Microchips AN246 talks about the ADC input impedance but does not really cover the PIC16F1938 that I am using.

I am driving the ADC input with an AD623A instrumentation amplifier powered by +/- 5v and with 2.5v on the ref pin so the output will be 0 to 5v over the design range. However there is nothing to stop the output going negative given an excessive input. The AD623A is a simple solution to interfacing a bipolar current shunt to a unipolar PIC ADC.
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

PostPosted: Mon Sep 28, 2015 2:54 pm     Reply with quote

If your hardware isn't set in stone, insert a rail-to-rail input/output opamp between your instrumentation amp and the PIC in a simple voltage follower configuration. My 'go-to' opamp family is the TLV237x.
rovtech



Joined: 24 Sep 2006
Posts: 262

View user's profile Send private message AIM Address

PostPosted: Mon Sep 28, 2015 4:25 pm     Reply with quote

The single resistor is a much simpler solution.

The AD623A is already rail to rail input and output, it is an instrument amplifier, it runs on 5v or +/- 5v, a single resistor sets the gain, and it has an output offset set by a voltage. A second one could be used with a gain of 1 requiring no resistors. Yes, I like the TLV series and do use them.

That is not the point. I am looking for information on where to find the current rating for the internal protection diodes, and the specification or app note on the recommended value of an input resistor for the ADC on a PIC16F1938. Perhaps I should be on the Microchip Forum but I did see some of the information on this one.
rovtech



Joined: 24 Sep 2006
Posts: 262

View user's profile Send private message AIM Address

PostPosted: Mon Sep 28, 2015 4:56 pm     Reply with quote

I found one reference, search on:
How big is internal resistance of AD convertor in 18F4520?

The maximum recommended impedance for analog sources connected to AD converter pin is 2.5K
Microchip DS39631 -Section 19.1- A/D Acquisition Requirements
Humberto

And, the internal resistance, is also in the sheet. 1K, for the MUX, and interconnection, and between 1K, and 4K, for the ADC FET switch, depending on the supply voltage. Ttelmah

Not quite the same for the 16F1938, section 15.4 on the data sheet:
The maximum recommended impedance for analog sources is 10 k.
I did look but not far enough.
I still cannot find the rating for the diodes. 20mA sound like the max current for a logic pin. rovtech

Ok, in electrical specifications I see:
Clamp current, IK (VPIN < 0 or VPIN > VDD)..............20 mA
which I guess is the max current for the diodes. However I also see the diode voltage shown elsewhere as 0.6v on the data sheet but the max voltage on any pin is 0.3v.

Does this mean I must use schottky diodes externally as the first posts suggest? rovtech
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 28, 2015 5:36 pm     Reply with quote

The PIC data sheet says 10K. (See TABLE 30-8, spec AD08).
Why do you think it is anything less than this ?

For the clamp diodes, the PIC data sheet says +/- 20ma.
(See 30.0 ELECTRICAL SPECIFICATIONS - table on first page)
It seems that you think the A/D input circuit has a separate set of clamp
diodes, that are in addition to the main i/o pin diodes. I doubt this.
rovtech



Joined: 24 Sep 2006
Posts: 262

View user's profile Send private message AIM Address

PostPosted: Mon Sep 28, 2015 5:57 pm     Reply with quote

I just did not know where to look for this information. The max impedance varies between chips. Max implies maximum. It slows down the ADC if max is used. Minimum would be where the protection diodes get blown on an overload. 2.5k would be 2mA at 5v beyond the rail voltage so would be safe.
What do you make of the discrepancy between the 0.6v of the diodes and the max -0.3v on the pin?
Ttelmah



Joined: 11 Mar 2010
Posts: 19236

View user's profile Send private message

PostPosted: Tue Sep 29, 2015 12:55 am     Reply with quote

Nothing...

The specified input range, is the range that the input can go to, without any erroneous effects - including extra current flowing into the internal protection diodes. Though the 'knee' of a silicon diode is specified at around 0.6v, tiny currents do start to flow before this. The input leakage current specification on the pin is no longer met once you go more than 0.3v beyond the rails.
Between 0.3v, and 0.6v outside the rails, the current starts to rise.

One thing that hasn't been mentioned is to use a fuse as well as, or instead of a resistor.
Thing is that if you use a lower resistor value, it gives better accuracy, and faster settling on an analog signal. However too low, and when you get an extreme current, the maximum that can be handled by the protection (whether external diodes, or the internal ones in the PIC), gets exceeded.
Now you can get tiny PCB mount self resetting thermal fuses. Years ago, I did a design that had such a fuse feeding a transorb, then after the transorb, a normal resistor and clamp diodes. Since the maximum that could appear at the input of the resistor was the transorb rated voltage, a smaller resistor could be used, than would otherwise be acceptable. However if a really nasty spike appeared the fuse would 'blow', and disconnect the circuit for a while.
It proved itself when after a nearby lightning strike, the circuit was happily still running....

Thing you have to remember is that FET's themselves act as a diode, when reverse biased. The FET's in the ADC circuitry will do this, just as the drive FET's on a normal pin do. The ADC itself connects internally to the ADC Vref, and if an ADC input goes above it's Vref, then current will start to flow into the Vref connection. Trying to pull this up. This is not a 'protection', but just an inherent part of the ADC design. Hence the ADC input voltage, should not go more than 0.3v above the Vref.
rovtech



Joined: 24 Sep 2006
Posts: 262

View user's profile Send private message AIM Address

PostPosted: Tue Sep 29, 2015 6:44 am     Reply with quote

Thanks Ttelmah, that makes sense.
I have to use the AD623A with +/- 5v power supplies so could not connect it directly to the ADC input. A 3 to 5 k resistor will provide the protection required.
My design SHOULD not drive the output negative below 0v but stuff happens.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group