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

How to convert power consumption value.

Not open for further replies.


My chip brings me power consumption value.
It has a calibrated value Y (3 hexa bytes), that represents X WAT, and each time it sends me a value Z (3 hexa bytes)
Meaning, when i recieve Y from the Chip, i know that the power consumption is X WAT.
And when i receive Z from the chip, i know that the power consumption is
Z / Y * X.

The problem with Z / Y * X is that when i read the result of it in hexa, i'm getting an integer, and therefore losing accuracy.
All numbers i read are in hexa, meaning i cant receive a number in decimal (double type).

How can I be more accurate?

Thank you!
Last edited:


Well-Known Member
Multiply the variables x100 so integer math is all you need. Then just put the decimal back in the right place. Or load a floating point library.
Not open for further replies.

Latest threads

EE World Online Articles