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

Unsigned long problem

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



Joined: 19 Feb 2004
Posts: 14

View user's profile Send private message

Unsigned long problem
PostPosted: Fri Oct 22, 2004 10:42 am     Reply with quote

Hello I have a problem
Why if I write :

unsigned long appoggio;

T2cal = 8291;

appoggio = T2cal * 180L ;
printf ("X %08lu ", appoggio ) ;

in serial I read 00052568

What is the problem?
Thank in advance..
Chas
Guest







PostPosted: Fri Oct 22, 2004 11:46 am     Reply with quote

Longs in CCS C are 16 bits which limits them to 65535. So you are experiencing some sort of truncation in the arithematic. You will need to use int32 for you variables.
Francesco



Joined: 19 Feb 2004
Posts: 14

View user's profile Send private message

PostPosted: Mon Oct 25, 2004 12:44 am     Reply with quote

Thank you now I try.
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