This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

char to unsigned int

Hi all

Here is some code

char prev_ch;
unsigned int chksum_read;

chksum_read += (WORD)prev_ch*256;
chksum_read += (unsigned int)prev_ch<<8;

if prev_ch has a value of 0xDB after one of of the two above statments cheksum_read is 0xDA00 instead of 0xDB00. Can anyone explain where I am going wrong?