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

multimeter for positive and negative

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



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

multimeter for positive and negative
PostPosted: Sat Sep 20, 2008 1:49 pm     Reply with quote

Hi

I made a power supply for my lab and now I like to add a display 2x16 for viewing but I don't know how I can meter negative voltage with a PIC18F452.

Now I have positive voltage working but I don't know how to make this for negative.

This is the ADC part of my circuit so I can meter 0V-25V:


Someone can help me?
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun Sep 21, 2008 12:38 am     Reply with quote

A straigthforward solution is by using an operational amplifier in an inverting circuit. A single supply or rail-to-rail type can do without needing additional supply voltages. The non-inverting input is connected to ground,
the inverting input is at the midpoint of two resistors to the negative voltage input and the OP output. The resistor ratio defines the input scaling.

As another remark, you should not use a variable resistor divider feeding high voltages directly to the PIC without a current limiting resistor. You easily damage the chip by turning the adjustment too far. You can better calculate a fixed divider according to the input range and do the adjustment in the software - or use a fixed divider with a small variable part.
filjoa



Joined: 04 May 2008
Posts: 260

View user's profile Send private message

PostPosted: Sun Sep 21, 2008 5:01 am     Reply with quote

Hi

I know the problem with regulators but I adjust before put the PIC for max value of power supply.

I continue understand how I can obtain with PIC negative part. you have same example?

regards
SherpaDoug



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

View user's profile Send private message

PostPosted: Sun Sep 21, 2008 6:20 pm     Reply with quote

To measure a negative voltage with a PIC A/D I would use a pull-up resistor from the A/D to your +A/D reference voltage, and a resistor from the A/D to the negative voltage. Find values so that the A/D pin sees near 0V with full negative input voltage, and a positive voltage as the input approaches zero. Also make sure the negative resistor is high enough that the clamp diodes can handle the current if the + reference voltage fails.

To use the full span of the A/D requires something more sophisticated. But I think this will serve you well.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Tue Sep 23, 2008 11:24 pm     Reply with quote

SherpaDoug, thats an interesting way to measure negative voltages :-) Never really though of that.

Its not VERY accurate, but its a super-cheap way to do something that you'd normally use an opamp based level shifter or inv amp to do.

Cheers! :-)

Rohit
SherpaDoug



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

View user's profile Send private message

PostPosted: Wed Sep 24, 2008 7:33 am     Reply with quote

If for example you are measuring 0V to -5V and have an A/D with a range of 0V to +5V, you can use equal up and down resistors to get 0V to 2.5V at the A/D. The accuracy is only limited by the accuracy of the resistors and the fact that you lose 1 bit of resolution due to using only half the A/D range. Also this method does not require a negative power supply.

Using the usual inverting opamp requires a negative supply and also introduces all the possible errors from the opamp.
_________________
The search for better is endless. Instead simply find very good and get the job done.
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