PDA

View Full Version : A question about ADC (using Pic16f876)



mimmmis
- 19th March 2007, 21:53
Many thanks for this beautiful site!This my first writing here.

I have the following problem:
I want to measure the voltage of a battery(it starts from 24 volt and mustn't go below 3 volt because it will be destroyed!) with portA from pic16f876.

Can i connect porta.1 of thw pic directly with battery (24 volt) and make adc or will i have a problem.I know that pic can function between 0-5 volt.But to make it more specific my question is if i connect pic with 24volt will the adc show the maximum value (connect 24 volt will show 5 volt) or will
i show pic in flame?Will i need an external ic between pic and battery? Which one?

Thanks in advance

Pic_User
- 20th March 2007, 00:20
Hi mimmmis,

Welcome to the forum.

If I read your question correctly, you want the PIC16F876’s A/D input to read a 24 V battery. You are not concerned with the battery’s high end voltage. You want to monitor the low end voltage. Say from 0 to 5 Volts. To make sure it does not drop below three Volts.

Looking at the PIC data sheet:

PIC16F87X Data Sheet
15.0 ELECTRICAL CHARACTERISTICS
Absolute Maximum Ratings
Voltage on any pin with respect to VSS -0.3 V to (VDD + 0.3 V)
(except VDD, MCLR. and RA4)
Voltage on VDD with respect to Vss -0.3 to +7.5 V
Voltage on RA4 with respect to Vss 0 to +8.5 V

That Voltage [ 24 volts or more ] may be just a little too high for the PIC to handle directly.

You could make a simple voltage divider but the “low end” voltage resolution would suffer.

As long as the A/D is just measuring slow changing battery voltage, you could use a low voltage Zener Diode to protect the input.

Note: any voltage above the Zener voltage would be clamped and not show up as an increase on the PIC A/D pin.

mimmmis
- 2nd April 2007, 16:26
really thanks!!