I have a Uint variable: A_UINT
I have a multiplier that gets values from 1000d - 65535d: GAIN
I have a floating point variable: A_FLP
I have a string type variable: A_STR
I use the following calculation:
Code: Select all
A_FLP = (A_UINT * GAIN * 0.001) / 32768
Code: Select all
A_STR = FloatToString$ (A_FLP,3)
On the actual LCD of application is printed correctly for GAIN values from 32768 and above.
For GAIN values from 32767 and below the LCD prints 0.000.
To simplify the calculation:
Code: Select all
A_FLP = A_UINT * 0.001 * (GAIN / 32768)
If "GAIN / 32768" is less than 1 (e.g. 0.999) it prints "0.000"
Why this?
The application micro is P16F18877.
Thanks