Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

display 0-12v battery voltage on LCD

Status
Not open for further replies.

hhhsssmmm

New Member
hello guys

i just want to know the math equations that will be needed to go into my C18 code to display the battery voltage from 0-12V on LCD.

Of course the battery voltage is scaled from 0-5 volts and im using a 10bit adc on PIC18F2420 with VDD as the ref.

MY head has worked out following to put in my C code for the necessary scaling factor conversion.

1 / [(R1+R2)/R2] .... lets say this inverse results of value X

ADC voltage at PIC pin (0- 5V) = X * ADRES .... lets say this product results of value Y.

Now Y is the actual voltage from 0 to 5V on the ADC pin. This of course represents the scaled 0 - 12V via the potential divider.

Now what is the next step after this to get the value of Y to represent the value from 0 - 12V for the battery voltage so i can display
on LCD??

what must i multiply or divide to get my desired result?....

im lost...plz help

Thanks

Haseeb
 
Voltage = (VDD*ADCreading)/(VoltageDividerRatio*1024) where:

1. VoltageDividerRatio = 5/12 = R2/(R1+R2) or whatever your voltage divider resistors are. Note that the source impedance looking back at the voltage divider from the ADC input should be ≤ 10KΩ, and that the AC source impedance should be lowered by bypassing the tap on the voltage divider to VSS with ~1uF capacitor.

2. VDD is the actual PIC supply voltage, to three significant figures.

3. 0≤ADCreading≤1023
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top