ADC on 16F877 to measure voltage

Status
Not open for further replies.

blackened69

New Member
hi

i was wondering how would i go about measuring the voltage of a battery powering a PIC 16f877 via the pic's ADC? i need to keep track of the battery's power and need to detect when the battery goes bellow a certainlevel (eg under 3 volts). from what i understand the 16f877's integrated ADC can be used. can i set thins up so no other power source is needed to keep a reference voltage. I just wanna have one battery and wanna detect when its below a ceratin level.......


thnk you all
 
I think this might be a problem...

The pic requires a reference voltage for it's ADC, these negative and positive references will be used to compare against the measured signal.

so you need a stable voltage to be used as a reference for the adc, if you want to measure the battery powering the pic, then the reference voltage will drop along with the measured voltage... The ADC will report a full battery every time...
 
Do you need to measure the voltage level (e.g.: 4.8V) or is it enough just to know when a voltage level reaches a certain treshold (e.g.: falls below a certain level)? If that is the case, then you can use a comparator that would output HIGH when voltage falls low enough...
 
just wanna know when a treshold is reached. will i need to use another IC (voltage comparator) or does the pic have such capabilities?
 
You may setup the F877's internal A/D converter to use VCC as reference. However, it is only as accurate as the VCC's value. That is, if the VCC has a tolerance of 10% (4.5V-5.5V), then the error of measuring @ 3V threashold is +/- 0.3V.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…