View previous topic :: View next topic |
Author |
Message |
Jody
Joined: 08 Sep 2006 Posts: 182
|
Compare negative value is not working??? |
Posted: Fri Apr 16, 2010 8:08 am |
|
|
Hello,
I am trying to compare a variable with a negative.
But in MPLAB, when debugging, I see a value which is really big. But when I display this on my display it shows something like '-60.0' which is correct.
a do-while with this value is not working.....
Code: |
do{
temperatuur = lees_adc_temperatuur(11);
lcd_gotoxy(21,2);
printf(lcd_putc, "T1=%3.0f C",(temperatuur));
}while(temperatuur < -60.0);
|
In MPLAB I see value like 2293758852.
temperatuur is a float.
Compiler version 4.049
What am I doing wrong????
Thanks in advance,
Jody |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Fri Apr 16, 2010 9:11 am |
|
|
You have got the watch setup wrong in MPLAB. It is displaying the number as if it is stored as an INT32, not as MicroChip float32, which is the required format.
-62.92923 - in Microchip float format,
is 88B7FB84 -> 2293758852 in int32
Best Wishes |
|
|
|