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

how to set ADC reference voltage

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



Joined: 04 May 2009
Posts: 35
Location: India

View user's profile Send private message

how to set ADC reference voltage
PostPosted: Sun Jul 01, 2012 8:59 am     Reply with quote

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.
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Sun Jul 01, 2012 9:21 am     Reply with quote

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
bharatwalia



Joined: 04 May 2009
Posts: 35
Location: India

View user's profile Send private message

PostPosted: Sun Jul 01, 2012 10:31 am     Reply with quote

Hi Ttelmah,
Thanks
Smile
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