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

Converting a voltage for use with ADC.

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



Joined: 22 Nov 2003
Posts: 32

View user's profile Send private message

Converting a voltage for use with ADC.
PostPosted: Sat May 01, 2004 5:44 pm     Reply with quote

I am using an inclinometer that gives +/- 60 degrees output. It accepts 5-15vdc and uses the center voltage as zero degrees. However it only uses 40% of the supply voltage for output. When using 5vdc this only gives a voltage of 1.5v to 3.5v a 2.0v range and 16mv/degree. If I used 12v it would give me a 4.0v range and 33mv/degree doubling my resolution. I'm just not sure how to change the DC offset to accurately read with an ADC channel. Has someone else come across this and could help me out?

Bob
SherpaDoug



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

View user's profile Send private message

PostPosted: Mon May 03, 2004 7:07 am     Reply with quote

What you ask is not too hard, but it may not be what you want.
If you use a "differential amp" circuit you can put the inclinometer input into one amp input and a voltage to simulate the minimum valid voltage in the other amp input. The amp has two outputs too. One output goes to A/D ground and the other to the A/D input. The Analog devices AD8131 is probably overkill for your use but it is the first that comes to mind, and the data sheet is good reading:
http://www.analog.com/UploadedFiles/Data_Sheets/413277462AD8131_a.pdf
You can also build your own diff amp from an op amp and a few resistors.

However if your 12V supply drifts relative to your A/D's 5V supply you will get a nasty error. I would suggest you run the inclinometer from the same 5V supply as the A/D and use an op amp to expand the output voltage. That way if the 5V supply drifts both the inclinometer and the A/D will drift together and cancell each other's drift out.
_________________
The search for better is endless. Instead simply find very good and get the job done.
SteveS



Joined: 27 Oct 2003
Posts: 126

View user's profile Send private message

PostPosted: Mon May 03, 2004 7:34 am     Reply with quote

I assume you want to use the built-in ADC. If you use a part with REF+ and REF- inputs you can set the min/max range that way. Example: The PIC18C reference book states (assume 5V supply) VREF+ can be 3.0 to 5.0 V, VREF- can be 0- 2V and VREF+ - VREF- must be 3.0V min. so you can set VREF- to 1.0V and VREF+ to 4.0. VREF in can be as high as 1mA so if you use a resistor divider to set the voltages be aware of that need. YMMV; Check the data sheet for your particular specs.

- SteveS
bcs99



Joined: 22 Nov 2003
Posts: 32

View user's profile Send private message

Thanks
PostPosted: Mon May 03, 2004 11:37 pm     Reply with quote

Thanks for the tips. I also am leaning towards using 5v and expanding the voltage.

Bob
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