Hello,
I am working with EngineControl_AN4907 demo. Basically, I am concentrating on the FUEL (etpuc_fuel.c) function and I want to learn how can we get angle from the time by the below calculation.
tmp: the value of the total injection pulse time in TCR1
Why we are shifting trr right by 6? And then, why we are shifting the result of the divison left by 3?
Thank you for your help!
Regards,
Mert KİREMİTCİ
已解决! 转到解答。
The TRR (tick rate) register has 9 fractional bits, hence the total shift by 9 bits to get the correct units. The breakdown of the needed 9 bit shift into components of 6 and 3 is an attempt to maximize precision while keeping the calculation simple and preventing any overflow issues, I believe. I've developed a slightly more complicated algorithm to enhance precision, see below. Other options exist.
The TRR (tick rate) register has 9 fractional bits, hence the total shift by 9 bits to get the correct units. The breakdown of the needed 9 bit shift into components of 6 and 3 is an attempt to maximize precision while keeping the calculation simple and preventing any overflow issues, I believe. I've developed a slightly more complicated algorithm to enhance precision, see below. Other options exist.