4 ms·
But then you are in base 100 fixed point. Converting it back to base 10 is what requires a division (but it's still by a constant though).
by bonzini 6y ago
But then you are in base 100 fixed point. Converting it back to base 10 is what requires a division (but it's still by a constant though).
- phire 6y agoOp is already in base 100 fixed point. I guess because that's what the sensor returns? Though it might be smart to convert it to another format. Four nibbles of BCD would be ideal and the MCS-48 looks to have native support for it. Thought you would need a custom version of shift by 4 that handles BCD. Or simplify the equation to just adds: C2 = C + C C4 = C2 + C2 C8 = C4 + C4 C16 = C8 + C8 Res = C16 + C2
- bonzini 6y agoIf he's in base 100 and you multiply by 18 it's the same story: you are now in base 1000 and need a division to go back. Converting from binary to BCD also needs division by constants, so again it's more or less the same.
- phire 6y agoOh, right. I'm an idiot who forgot about the fixed point divide. And yes, at some point you are going to need to do a divide by constant 10. It's unavoidable if you want a base 10 display. The option of using BCD to do calculations just lets you do that divide upfront, rather than at the end.