![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
bharatwalia
Joined: 04 May 2009 Posts: 35 Location: India
|
how to set ADC reference voltage |
Posted: Sun Jul 01, 2012 8:59 am |
|
|
Hi,
I am using PIC16F886 which has 10-bit ADC resolution.
Currently the PIC's internal Vref is set to 5.0V, which reads 0-5V as 0-1023.
But i need to set Vref to 2.5V so that it reads 0-2.5V as 0-1023 bit resolution.
How to do that?
Thanks and Regards. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19368
|
|
Posted: Sun Jul 01, 2012 9:21 am |
|
|
You have to apply an external 2.5v reference to pin 5, and select: "VSS_VREF" in setup_adc_ports (together with the pin(s) you are using). The ADC then uses the Vss (GND) as it's zero point, and the voltage on Vref+ as it's top point.
There is no 'internal Vref'. It is currently using the _supply_ as it's reference, with all the noise etc., this introduces.....
The _comparator_ module has an fixed internal reference, but it is only 0.6v. It also has available a resistance 'tree' allowing the comparator to be operated from a fraction of the supply, but the impedance of this is too high to feed the ADC. What you can do is read the voltage 'on' this line, or on the fixed reference line with the ADC, and taking a reading from the fixed voltage reference, then allows you potentially to work out what voltage is feeding the ADC - can be useful for battery operation. However neither allow you to operate the ADC from them.
If you look at the ADC BLOCK DIAGRAM in the data sheet (Fig 9.1), you will see that the reference for the ADC, comes either from pin AN3, or AVdd only. Note also that the _minimum_ voltage that can be used for Vref, is 2.2v (AD06 in the data sheet).
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
bharatwalia
Joined: 04 May 2009 Posts: 35 Location: India
|
|
Posted: Sun Jul 01, 2012 10:31 am |
|
|
Hi Ttelmah,
Thanks
![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|