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

PIC16f877a two ADC Voltage Reference Problem

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



Joined: 15 Jan 2009
Posts: 60

View user's profile Send private message Visit poster's website

PIC16f877a two ADC Voltage Reference Problem
PostPosted: Mon Mar 15, 2010 12:17 am     Reply with quote

Hai,

I am in need to use two ADCs of the PIC16f877a. For one A/D Conversion i need to give reference value as 2.15V as minimum and 2.80V as maximum. I have given the min Voltage to Vref- pin and max voltage to Vref+pin. Its working fine.

But my problem is with the other A/D Conversion. Its min voltage is 0V and Maximum is +3V. How can i use the reference values?

I am using RA0,RA1- ANALOG
RA2,RA3- VREF

Can anyone help me to rectify this problem?
_________________
embedding innovation in engineers
rafique4m



Joined: 15 Mar 2010
Posts: 2
Location: Pakistan

View user's profile Send private message

Re: PIC16f877a two ADC Voltage Reference Problem
PostPosted: Mon Mar 15, 2010 3:19 am     Reply with quote

Quote:
I am in need to use two ADCs of the PIC16f877a.


PIC16F877A has only one adc.

It is only possible by using a mux and two reference voltage for your application.
You have max 3V for your 2nd channel. If you can use 5V then it is possible by changing Vref to Vdd.
evaradharaj



Joined: 15 Jan 2009
Posts: 60

View user's profile Send private message Visit poster's website

Thanks
PostPosted: Mon Mar 15, 2010 3:42 am     Reply with quote

Thanks for your reply....

I am Sorry.... The problem is, I am using 2 ADC channels.. How can we use different VREF voltages for two channels?
_________________
embedding innovation in engineers
Ttelmah



Joined: 11 Mar 2010
Posts: 19348

View user's profile Send private message

PostPosted: Mon Mar 15, 2010 3:48 am     Reply with quote

You can't.
One ADC, one set of references.
Oly way would be to add external FET switching to control the Vref signals.

Also, you may well be outside the spec of the ADC with your first 'channel', and will get inaccurate results.
Specification A20, Table 17-14. The _miimum_ voltage difference between Vref+, and Vref-, is 2V, for 10bit accuracy...
So you won't be getting 10 bit accuracy over your 0.65v range, and might as well use a higher Vref span.

Best Wishes
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Mar 15, 2010 5:32 am     Reply with quote

One way to accomplish this is to design each channel's 'front end' to level shift and amplify the signal to maximize the ADC.

channel one input 2.1-2.8 volts -> 0-5.0 volts
channel two input 0.0-3.0 volts -> 0-5.0 volts

This allows you to get 10 bits from the ADC for each channel. Obviously some math is required after reading the channels depending on what you need to do with the result.

The fun parts is the front end opamp selection and gain resistors.
Nowadays there's probably a 'fill in the blank' application on line, old school ,we used paper,pencil,and 4 function calculator.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19348

View user's profile Send private message

PostPosted: Mon Mar 15, 2010 7:49 am     Reply with quote

Yes.
Though probably the 'best' solution, would be to use a 3v reference, removing the need for any amplification for the second channel (and given that you probably need some voltage drop to run the reference), and then just subtract the 2.1v, already generated, and multiply by perhaps 4*, for the first channel.
Given that buffer amplification, is commonly needed for the inputs to a PIC ADC, 'pre-processing' like this is common.

Best Wishes
mbradley



Joined: 11 Jul 2009
Posts: 118
Location: California, USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Mar 18, 2010 5:45 pm     Reply with quote

Just a thought, do you realy need 10bit resolution in the 2.1 to 2.8v range? or is this an application min/max?

set ref to 3v, and use software to adjust the range.

2.1v = 716
2.8v = 955

239 span,

results = (adc - 716);
you can get .003volts resolution

just my 2 cents
_________________
Michael Bradley
www.mculabs.com
Open Drivers and Projects
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