Why do floating-point variables in MPLAB IDE have the wrong value?
MPLAB IDE’s Watch window interprets all floating-point variables (whether defined as ‘float’ or ‘double’) as 32-bit values unless you manually change the properties for each one. Since the HI-TECH C compilers for PIC10/12/16 and for PIC18 allocate 24 bits for ‘float’ and ‘double’ types, unless you explicitly specify otherwise, this means all floating-point values displayed in the Watch view will be incorrect. This does not affect the operation of code, merely what values are displayed when debugging. To correct the display, right-click on the variable name in the Watch window and select Properties. Change the Size field to 24 bits. Also ensure that the Format field is set to IEEE Float (as opposed to MCHP Float) — this is the only format used in HI-TECH C. You will need to do this for each floating-point variable added to the Watch view. Incidentally, if you meant to use 32-bit floating point types in your project, adjust the Size of Double and/or the Size of Float fields in the Globa