CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Compare negative value is not working???

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Jody



Joined: 08 Sep 2006
Posts: 182

View user's profile Send private message Send e-mail

Compare negative value is not working???
PostPosted: Fri Apr 16, 2010 8:08 am     Reply with quote

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: 19330

View user's profile Send private message

PostPosted: Fri Apr 16, 2010 9:11 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group