For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Hi,

Just a quick question. If a PIC has 5.02V at Vdd, what value would the 12-bit ADC show if the voltage on the ADC pin is 5.08V?

The problem is that I don't have a constant supply of 5.08V to use as reference on the +Vref pin
Last edited by hyperion007 on Sun Nov 03, 2013 10:09 pm, edited 1 time in total.

kersing
Valued Contributor
Posts: 1907
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 552 times
Been thanked: 1064 times
Contact:

You need to check the device data sheet to see if an input voltage above 5V (or Vdd) is actually allowed. If so, the value would be 4095 (there are 12 bits for values, so 2 ^ 12 values starting at 0, means 2 ^ 12 - 1 is the max)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

VDD + 0.3V
VSS - 0.3V
So I am well within the limits. And for the record, the ADC value does NOT roll over if the voltage read is slightly higher than VDD.
These users thanked the author hyperion007 for the post:
Benj (Fri Nov 22, 2013 4:41 pm)
Rating: 5%

medelec35
Valued Contributor
Posts: 8615
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2480 times
Been thanked: 3564 times
Contact:

hyperion007 wrote:DC value does NOT roll over if the voltage read is slightly higher than VDD.

ADC never rolls over, it only reaches maximum value or 0.

It is anly when variables are used in calculations they can roll over or roll under< Could be a made up word :p

Martin
These users thanked the author medelec35 for the post:
Benj (Thu Dec 05, 2013 10:16 am)
Rating: 5%

Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Brendan
Posts: 223
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 136 times
Been thanked: 115 times
Contact:

Just came across this thread while browsing.

For general future reference, the +0.3V above Vdd and -0.3V below Vss relate to absolute maximum limits governed by protective diode input structures, and has nothing to do with functional performance.

To guard against input spikes and ESD in general, MOS inputs commonly employ two reverse-biased diodes in non-RF applications. Consider the 'upper' diode with cathode to Vdd, the 'lower' diode with anode to ground, and the junction between the two connected to the input in question. To cut a long explanation short, the absolute maximum ratings above Vdd or below Vss relate only to the voltage where the natural forward-voltage characteristics of the protection diodes limits the forward current to within safe boundaries (at the quoted max/min voltage) and avoids diode damage.

At best the ADC range will apply to the available supply voltage, where the diode-based input limitations have no bearing whatsoever on designed input function.

Hope this helps

All the best,

Brendan
These users thanked the author Brendan for the post (total 2):
Benj (Thu Dec 05, 2013 10:16 am) • medelec35 (Thu Dec 05, 2013 10:24 am)
Rating: 10%