View previous topic :: View next topic |
Author |
Message |
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
How to select Vref? |
Posted: Mon Sep 24, 2012 7:13 am |
|
|
Hi,
I'm using PIC18F4520 for my project. My input for ADC is 200mV to 1.2V.
Now I want to give vref to my microcontroller. It has to pin RA3/AN3/
VREF+ and RA2/AN2/VREF-/CVREF pins.
So how do I give Vref? Should I apply 1.5v to only VREF+ and keep open VREF- or should I ground the Vref- pin??
Please help.
Rgds,
Sid |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Mon Sep 24, 2012 7:58 am |
|
|
The data sheet shows how to do it.
You have to set the code and hardware to match.
To get maximum resolution you could connect a source of a little over 1.2V to Vref+, and one of just under 200mV to Vref-.
Mike |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Sep 24, 2012 8:04 am |
|
|
First read the data sheet.
What is the _minimum_ Vref the ADC can use (Table 26-24 Parameter A20).
So, your 1.5v Vref, won't work.
Then understand that the Vref output on the PIC, is _not_ suitable to drive the ADC Vref input. Note the Vref Input current (A50 in the same table). Then look at the Vref output, and how it is generated (resistor tree). To use this to drive the Vref input, you must buffer it.
The internal reference is also derived directly by division from the power supply. No better accuracy.
This is why the internal reference module is called the _comparator_ voltage reference, not a generic voltage reference....
For best accuracy, use an external 3v bandgap reference to drive the ADC Vref, and an op-amp buffer to feed your voltage source into the chip. You can perform the operation (Vin-0.2)*3, with an op-amp, and a feed from the same reference voltage.
Normally feed Vref-, from the connection at the bottom of your reference source. Using the processor 'ground', may be perfectly adequate, depending on what noise sources are present, and how good the system 'ground' is.
Best Wishes
Best Wishes |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Sep 24, 2012 8:06 am |
|
|
Mike Walne wrote: | The data sheet shows how to do it.
You have to set the code and hardware to match.
To get maximum resolution you could connect a source of a little over 1.2V to Vref+, and one of just under 200mV to Vref-.
Mike |
Not with this chip.
Most PIC ADC's require 2.5v span for the ADC, a few less, but this one needs 3v, if running off a 5v supply. A pity.
Best Wishes |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Mon Sep 24, 2012 9:56 am |
|
|
Quote: | Not with this chip. Most PIC ADC's require 2.5v span for the ADC, a few less, but this one needs 3v, if running off a 5v supply. A pity. |
Sorry, I'd only looked at the connection diagram. Does not help that, in the 18F4520 data sheet, Vref+ changes its name to VrefH in the DC / AC characteristics section.
Mike |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Sep 24, 2012 1:27 pm |
|
|
Yes, it's the highest span requirement I've seen on a PIC.
However, given a low level signal like this probably won't meet the impedance requirements of the ADC, it makes a buffer amplifier the 'way to go'.
Best Wishes |
|
|
|