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

Negative input

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



Joined: 17 Feb 2006
Posts: 59
Location: Argentina

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

Negative input
PostPosted: Wed Jun 13, 2007 12:55 pm     Reply with quote

Hi everyone:
One question what would I read if a digital input i aplly -5v ?
the second one would I be able to read negative values with ADC ?

Thanks a lot, sorry for the questions but I am still learning...
SherpaDoug



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

View user's profile Send private message

PostPosted: Wed Jun 13, 2007 1:40 pm     Reply with quote

If you REALLY pull the PIC pin down to -5V you will probably destroy the PIC. Fortunately the PIC pins have protection diodes to make this difficult. Read about "Input Protection" or "Protection Diodes" on the datasheet. Also read Microchip application note AN521 to see what can be done with these diodes.

To read negative voltages on an A/D pin you need to convert the voltage to positive. Often this is done cheaply by connecting two equal resistors (maybe 1K) in series from the negative signal to the A/D +5V supply. Then a -5V signal gives 0V to the A/D, a 0V signal gives +2.5V, and +5V gives +5V.
_________________
The search for better is endless. Instead simply find very good and get the job done.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Jun 14, 2007 4:24 pm     Reply with quote

Check out the electrical specifications for the part you are using. Most of them state that an input LOW can be VSS-0.3V. You can't measure a negative voltage, directly, with the ADC. If you're not sure about something, read the specification sheet first!

Ronald
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