View previous topic :: View next topic |
Author |
Message |
evaradharaj
Joined: 15 Jan 2009 Posts: 60
|
PIC16f877a two ADC Voltage Reference Problem |
Posted: Mon Mar 15, 2010 12:17 am |
|
|
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
|
Re: PIC16f877a two ADC Voltage Reference Problem |
Posted: Mon Mar 15, 2010 3:19 am |
|
|
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
|
Thanks |
Posted: Mon Mar 15, 2010 3:42 am |
|
|
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: 19513
|
|
Posted: Mon Mar 15, 2010 3:48 am |
|
|
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
|
|
Posted: Mon Mar 15, 2010 5:32 am |
|
|
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: 19513
|
|
Posted: Mon Mar 15, 2010 7:49 am |
|
|
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
|
|
Posted: Thu Mar 18, 2010 5:45 pm |
|
|
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 |
|
|
|