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

using ADC to determine low battery ?

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



Joined: 30 Apr 2011
Posts: 9

View user's profile Send private message

using ADC to determine low battery ?
PostPosted: Sat May 07, 2011 3:02 pm     Reply with quote

Hello,

I want to detect the battery voltage and give a signal when it falls bellow a certain value. I know how to do this using a comparator, but is it possible to do it using the ADC of the PIC16f877 ?

note: the battery is the power source of the PIC.

thanks is advance
temtronic



Joined: 01 Jul 2010
Posts: 9205
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat May 07, 2011 4:06 pm     Reply with quote

Very easy.

Use a voltage divider to reduce the battery max to 5 volts.

Read the ADC, compare the reading to a lookup table of 'Ok, low, dead battery voltages.

Display on LCD or send to PC.

Done.
M11



Joined: 30 Apr 2011
Posts: 9

View user's profile Send private message

PostPosted: Sat May 07, 2011 4:23 pm     Reply with quote

but doesn't the reference voltage of the ADC changes when the voltage of the battery changes ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat May 07, 2011 4:56 pm     Reply with quote

Read these previous threads on the topic:

How to design low battery indicator?
http://www.ccsinfo.com/forum/viewtopic.php?t=24560

How to monitor battery level that is running the PIC itself?
http://www.ccsinfo.com/forum/viewtopic.php?t=27096

Low Voltage Detect interrupt
http://www.ccsinfo.com/forum/viewtopic.php?t=24577

newbee - battery level
http://www.ccsinfo.com/forum/viewtopic.php?t=23186

Checking battery voltage with A/D
http://www.ccsinfo.com/forum/viewtopic.php?t=24842
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