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 CCS Technical Support

What will happen if adc channel exceed Vref?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jani20



Joined: 14 Nov 2006
Posts: 14

View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number

What will happen if adc channel exceed Vref?
PostPosted: Tue May 15, 2007 11:08 am     Reply with quote

What will happen if adc channel exceed Vref?
What value will the adc read return?
Thank you!
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Tue May 15, 2007 11:50 am     Reply with quote

If your PIC is set to 10 bit resolution then the value will be 1023 (max value). If the input goes too far above VCC then the magic smoke could escape and the part will become a dead bug.

Ronald
jani20



Joined: 14 Nov 2006
Posts: 14

View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number

PostPosted: Tue May 15, 2007 12:10 pm     Reply with quote

Thank you!
The Vref will be divided from the Vcc:)
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Tue May 15, 2007 7:13 pm     Reply with quote

jani20 wrote:
The Vref will be divided from the Vcc:)

That will work for a ratiometric signal. Also, check if you need a unity-gain buffer between the voltage divider and the Vref pin on the PIC.
_________________
Read the label, before opening a can of worms.
Ttelmah
Guest







PostPosted: Wed May 16, 2007 3:55 am     Reply with quote

Some comments.
The 'Vref will be divided from Vcc'. Look at the data sheet. Note the figure for 'Iref'. Note that it changes when the ADC conversion is made (typically between 5uA to 150uA). Now if (for instance), you make Vref using (say) a 1K impedance 'divider' from Vcc, then this represents a potential change of voltage of up to 0.145v... Not good for accuracy. You need to consider a buffer amplifier on the Vref signal. The maximum recommended impedance of this source, varies with different chip models, but is typically 250R.
Now the maximum input 'range' on the analog pins, is the same as for any other normal pin (one diode drop below Vss, to one diode drop above Vdd). The 'range' for the full range of output numeric values (0 to 1023), is VrefL to VrefH, but there is no physical connection between the Vref pins, and the input pins, so provided the voltages don't go outside the legal input range, no 'magic smoke', need be involved!. However there is a caveat. You need to think carefully, if driving the signal(s) from reasonably low impedance sources, and they go outside the range of the supply rails, as to whether an external clamp should be used (if you rely on the internal clamp diodes, it can result in the supply rail being raised!...).
Beware also, to not get caught by the commonly made mistake here, of dividing by 1023, when converting to a 'value'. The divisor with the PIC ADC, is 1024 (it depends where the switching 'points' for the values are, whether the levels need to be treated like the 'fence posts', or like the panels between). The PIC ADC, switches to the top value, 1/1024th of the range below the Vref+ point, and doesn't switch from '0', till you are 1/1024th of the Vref range 'above' the 0v point (in 10 bit mode). Effectively Vref+, is already beyond the 'range' of the ADC (it would nominally mark the point at which the converter would switch to outputting 1024, if it could!). Have a look at AN546 (for one of the older PIC's), where figure1, shows the actual transfer function on the typical PIC ADC (in 8bit mode).
This is a large caveat, since many other ADC's in use, use the alternate transfer function, and should therefore use the 1023 divider. For accuracy, it is vital to check the data sheet, and know which type of ADC you are dealing with...

Best Wishes
jani20



Joined: 14 Nov 2006
Posts: 14

View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number

PostPosted: Thu May 17, 2007 7:22 am     Reply with quote

Thank you for your detailed answer!
Can I make a unity gain buffer from a transistor?
Or I must use an OPA?
Ttelmah
Guest







PostPosted: Thu May 17, 2007 8:19 am     Reply with quote

The problem with a transistor, is the voltage drop. In emitter follower mode, the emitter will be basically 0.6v below the base, with this drop changing a little with load.
Look at AN546 which I mentioned. Consider just using a zener diode. For a simple application, this is the cheapest route to getting a pretty stable output with the change in load.

Best Wishes
jani20



Joined: 14 Nov 2006
Posts: 14

View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number

PostPosted: Sat May 19, 2007 1:17 am     Reply with quote

And if I add some CAPs (exp:3x100nF) to the Vref pin after the voltage divider, can I get a low impedance source for the Vref pin?

The AN546 contains a table which shows the Vref sampling time
with various source impedance. But in the comment says: Assumes no external capacitors.

And the AN546 also says at the begin:
When using the external reference voltage, keep in mind that any analog input voltage must not exceed VREF.

So now what?
Ttelmah
Guest







PostPosted: Sat May 19, 2007 3:55 am     Reply with quote

You need to distinguish between the concepts, of what is 'safe', and what can be 'used'.
The maximum that can be _used_ by the ADC, is always Vref+ (to Vref-).
This is the range over which the output value has changes reflecting the changes in the input. However the chip can happily handle as a _safe_ input range, Vss-0.3 to Vdd+0.3. There is no direct connection between the inputs (so no current flow as a result of the input exceeding Vref) - just as applies between two analog inputs being at different voltages. However there _is_ a tendency to slightly elevate Vref. What happens, is that the internal capacitor used for sampling, gets charged to the higher input voltage, and then when the chip switches back to the Vref connection, this higher voltage is discharged through the internal reverse diode, into the Vref pin. The total current is limited by the internal resistances in the ADC (typically to a peak below 5mA worst case, and the total energy involved is tiny - the internal capacitance is very small), but this has the effect of elevating Vref, if this is not properly clamped.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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