short int bug

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wrote a very simple program to figure out some problems I was having with short int operations.

I did something like this --
short count = 3200;
count++;

and then I looked at the value of count as it incremented. The weird thing is that the high byte of count goes to 0x0c and then back to 0x0a and then to 0x0e. somehow it outputs 0x0a instead of 0x0d. Has anybody seen this problem before?

Thanks,
Jasmeet

P.S. note that this happens only in case of shorts, and char are ok.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please ignore this post. I had a problem with my uart reading code and that's why 0x0d s were showing up as 0x0a s.

Thanks
Jasmeet

admin's test signature