electronicsLearner77
- Jul 2, 2015
- 256
- Joined
- Jul 2, 2015
- Messages
- 256
I want to perform the voltage divider calculations in fixed format, please advise if my calculations are correct.

Vout voltage is given to the microcontroller, and i want to calculate V1.
Vout = V1*R2/(R1+R2)
V1 = (R1+R2)/R2Vout
V1 = 108/8*Vout = 13.5*Vout -> eq1
13.5 constant is in Q4.12 format converting it into Q1.15 format
= 13.5*2^12 = 55296
Q1.15 format = 55296*2^3 = 442368 = 0x6 C000
#define factor (0x6C000)
Let the value of Vout received in Q1.11 format = 657 (657/1024*3.3V = 2.11V)
As per equation1
V1 = 13.5*Vout
int main(void)
{
uint32 Voltage=0;
voltage = factor * adc
voltage = 442368 * 657 = 0x1152 C000 (Q1.31 format);
}
There are some gaps i am not able to proceed after this. Also the constant i highlighted crossed the 16 bit. Can you please advise how to resolve?

Vout voltage is given to the microcontroller, and i want to calculate V1.
Vout = V1*R2/(R1+R2)
V1 = (R1+R2)/R2Vout
V1 = 108/8*Vout = 13.5*Vout -> eq1
13.5 constant is in Q4.12 format converting it into Q1.15 format
= 13.5*2^12 = 55296
Q1.15 format = 55296*2^3 = 442368 = 0x6 C000
#define factor (0x6C000)
Let the value of Vout received in Q1.11 format = 657 (657/1024*3.3V = 2.11V)
As per equation1
V1 = 13.5*Vout
int main(void)
{
uint32 Voltage=0;
voltage = factor * adc
voltage = 442368 * 657 = 0x1152 C000 (Q1.31 format);
}
There are some gaps i am not able to proceed after this. Also the constant i highlighted crossed the 16 bit. Can you please advise how to resolve?