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

Adding 2 16 bit numbers together

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







Adding 2 16 bit numbers together
PostPosted: Mon Mar 06, 2006 7:03 am     Reply with quote

Hey,

I'm trying to copy one int16 number to another int16 number. But they are only copying 8 bits of the 16. Any ideas?

Code:
Days[Day+1].Sensor[Node].On1 = Days[Day].Sensor[Node].On1;

the numbers are defined here:
Code:

struct SensorInfo
{
   unsigned char Temp;
   
   unsigned int16 On1;
   unsigned int16 Off1;

   unsigned int16 On2;
   unsigned int16 Off2;

   unsigned int16 On3;
   unsigned int16 Off3;
};


Cheers
uhoh-robbo
Guest







PostPosted: Mon Mar 06, 2006 7:05 am     Reply with quote

I know I'm accessing these numbers correctly. Just incase you were wonding I missed this bit of code out before.

Code:

struct Week
{
   struct SensorInfo Sensor[MAX_NUMBER_OF_SENSORS];
} Days[7];
mpfj



Joined: 09 Sep 2003
Posts: 95
Location: UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Mar 06, 2006 7:30 am     Reply with quote

Could you post the listing file so we can see what is apparently going wrong ?

I've compiled some test code and it looks like it should work !!
uhoh-robbo
Guest







PostPosted: Mon Mar 06, 2006 7:39 am     Reply with quote

Yes your completely right. Its does work. the problem was in a different place.

Sorry to waste your time.
Thanks anyway
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