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 CCS Technical Support

VREF?

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



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

VREF?
PostPosted: Wed Dec 01, 2004 12:07 pm     Reply with quote

In the ADC setup this is something like this:
#define AN0_AN1_VSS_VREF 5 // A0 A1 Ref=A3

what does VSS_VREF means? if Ref=A3, How should I connecte A3 pin?
Ttelmah
Guest







Re: VREF?
PostPosted: Wed Dec 01, 2004 3:13 pm     Reply with quote

young wrote:
In the ADC setup this is something like this:
#define AN0_AN1_VSS_VREF 5 // A0 A1 Ref=A3

what does VSS_VREF means? if Ref=A3, How should I connecte A3 pin?

I really have to suggest you look at the MicroChip data sheet for the chip. You will find there, a large 'table', giving all the different combinations for the analog connections. If you cross reference this with the numeric values in the CCS defines, you will see what each one means.
If you do this for '5', you will see that this gives Vref- connected to Vss, and Vref+ connected to pin A3. Hence the reference 'range', is Vss to Vref on A3.
You need to connect your reference voltage to A3.

Best Wishes
Guest








PostPosted: Wed Dec 01, 2004 3:44 pm     Reply with quote

Thank you, however, I could not understand what reference voltage means? could you explain it?
Ttelmah
Guest







PostPosted: Wed Dec 01, 2004 3:59 pm     Reply with quote

Anonymous wrote:
Thank you, however, I could not understand what reference voltage means? could you explain it?

The ADC converter, works over the 'range' Vref- to Vref+. If (for instance), Vref- is set to 0v, and Vref+, is set to 5v, then the full scale output of the ADC occurs at the Vref+, and the '0' output occurs at Vref-. The two voltages must be 'legal' for the chip (between Vss, and Vdd basically), and for the full accuracy of the ADC, the difference between the voltages should be at least 2v. A 'classic' example, would be the reading of a 4-20mA input. If you connect Vref+ to 2.5v, and Vref- to 0.5v, then connect the input to a 125 ohm resistor, with it's bottom end connected to 0v, you will get 0.5v for 4mA, and 2.5v for 20mA, and see the full ADC range between these points. There are some 'caveats' (normally such an interface would have to be able to handle/detect both underrange, and overrange conditions).
You really need to look at some of the MicroChip application notes, and perhaps do some basic reading on AD converters.

Best Wishes
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Dec 01, 2004 4:02 pm     Reply with quote

Anonymous wrote:
Thank you, however, I could not understand what reference voltage means? could you explain it?


The processor runs between two voltages, commonly VCC and VSS which may be 5.0V and 0V. The A/D converter can run from the same voltages, but it does not have to. In Ttelmah's message he calls the A/D voltages Vref+ and Vref-. The line
Code:
#define AN0_AN1_VSS_VREF 5 // A0 A1 Ref=A3
runs the A/D from VREF and VSS, where VREF is the voltage on pin A3. This is handy when the whole system uses the same ground, allowing the A/D to use the same VSS as the processor, but the digital power supply VCC is too poorly regulated or noisy to make precision measurements. So instead the A/D uses some nice quiet VREF supplied at A3. In a system I am working on now I take the 5V VCC and further regulate a nice quiet 4V which I give to the A/D at A3. My average conversion noise is well below 1 LSB.
You could just connect A3 to VCC, but you would be wasting the advantage you get from a seperate A/D supply. You could connect it to VCC through a filter to remove digital noise from the VCC line and get more consistant readings. But if the VCC voltage drifts due to temperature or the load to digital devices the A/D reading will drift too.
Read through the datasheet sections on the A/D and you will learn more.
_________________
The search for better is endless. Instead simply find very good and get the job done.
adrian



Joined: 08 Sep 2003
Posts: 92
Location: Glasgow, UK

View user's profile Send private message

PostPosted: Thu Dec 02, 2004 6:41 am     Reply with quote

I am about to put in a voltage reference to do exactly this....
Quote:
In a system I am working on now I take the 5V VCC and further regulate a nice quiet 4V


...because of noise. Any recommendations on which manufacturer to use - or even which to avoid?
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