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

How to select Vref?

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



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

How to select Vref?
PostPosted: Mon Sep 24, 2012 7:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 7:58 am     Reply with quote

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: 19326

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 8:04 am     Reply with quote

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: 19326

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 8:06 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 9:56 am     Reply with quote

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: 19326

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 1:27 pm     Reply with quote

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