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 CCS Technical Support

Program flow control and constants

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



Joined: 17 Nov 2003
Posts: 12
Location: Australia

View user's profile Send private message Visit poster's website

Program flow control and constants
PostPosted: Tue Jan 06, 2004 9:06 pm     Reply with quote

Hi,
I'm having a problem with an if statement. The evaluation of the if condition is incorrect. The code is below

long int egt;
#define START_TEMP_MAX 80L

egt = read_adc();
if( egt > START_TEMP_MAX ) {
para[ TURBINE_STATUS ] = ERROR_MODE;
para[ ERROR_CODE ] = TOO_HOT_FOR_START;
break;
}

When simulation the if condition is always false as the statement code is never executed.

The code will work if the constant START_TEMP_MAX is assinged to an integer then tested in the if statement. This is a little confusing?

Thanks

Adam Sad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 06, 2004 10:05 pm     Reply with quote

It works for me with a 16F877 and PCM vs. 3.178 (in simulation).
What PIC and version are you using ?
astus



Joined: 17 Nov 2003
Posts: 12
Location: Australia

View user's profile Send private message Visit poster's website

PostPosted: Tue Jan 06, 2004 10:08 pm     Reply with quote

I'm using pic16f877 and pcm 2.734
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