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
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