View previous topic :: View next topic |
Author |
Message |
Javed Shafi
Joined: 15 Mar 2004 Posts: 6
|
ADC using external Reference |
Posted: Tue Oct 04, 2005 9:01 am |
|
|
Just a general question as to how to use an external reference when using a pic with an inbuilt AtoD convertor.
The PIC I am using is a 16LF872 and I cannot use V+ as a reference as it is not constant with temperature. The PIC is run stright off a battery and the battery voltage varies from 3.6V at ambient to 3.9V at 150C. I know that this PIC has an external reference pin any guidance as to the value of reference I should use and how to configure the PIC to use this reference would be great.
Any example code as how to do this would be great.
Best regards
Javed _________________ Javed Shafi
email: JShafi@aberdeen.oilfield.slb.com |
|
|
Felix Althaus
Joined: 09 Sep 2003 Posts: 67 Location: Winterthur, Switzerland
|
|
Posted: Tue Oct 04, 2005 9:55 am |
|
|
Hello
Quote: | to the value of reference I should use |
That depends on your analog input volatage range.
Quote: | how to configure the PIC to use this reference |
Should be in the datasheet or the CCSC manual
mfg
Felix |
|
|
Ttelmah Guest
|
|
Posted: Tue Oct 04, 2005 10:01 am |
|
|
Open the .h file for your PIC. Look for the section entitled 'Constants used in SETUP_ADC_PORTS()'. This has a list of the allowable values, and which pins do what. You will probably want the one 'AN0_AN1_VSS_VREF'. This defines A0, and A1 as analog inputs, with Vref on A3. This is the 'least pins used' configuration for an external Vref (the other using the same number of pins, is 'AN0_VREF_VREF' - this uses A0 as a single input, and A1, as the 'low' reference voltage, with A3 as the 'high' reference).
Then everything behaves as normal. Just select the analog input channel, and convert as normal. There is a 'caveat', that the accuracy of the ADC, falls if the reference gets too low (this happens below about 2v between the low and high reference voltage). The chips work well with a typical 2.5v bandgap reference, and this would seem to suit your supply voltage. The reference source, needs to be able to stably supply up to 1mA of current to cover all situations.
Best Wishes |
|
|
Javed Shafi
Joined: 15 Mar 2004 Posts: 6
|
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Oct 04, 2005 12:03 pm |
|
|
Of course if you are using a ratiometric sensor, such as a potentiometer, a thermistor, or a strain bridge, it doesn't matter if the reference voltage drifts with temperature. If the battery drives both the PIC A/D and the ratiometric sensor then the value of the drive voltage can drift quite a lot without affecting the reading.
Tell us more about your application. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
|