Hi,
Can somebody please explain to me why the following works using DEV-C++:
And the result is WHOLE = 100
But when I run it in C18 all I get is 0? Even tried changing the long to an int and the char to unsigned etc, just returns 0!
prints WHOLE = 0 to the UART!
And, if I have a function like this:
I get WHOLE = 8
Anybody see anything wrong with what I am doing?
Regards
Wilksey
Can somebody please explain to me why the following works using DEV-C++:
Code:
char bit1=0x01;
long whole = bit1 << 8;
printf("WHOLE = %x\r\n",whole);
And the result is WHOLE = 100
But when I run it in C18 all I get is 0? Even tried changing the long to an int and the char to unsigned etc, just returns 0!
Code:
whole = (0x01 << 8);
printf("WHOLE = %x\r\n",whole);
And, if I have a function like this:
Code:
void get_val(char *sp)
//assume that (sp[0] = 0x68 and sp[1] = 0x01)
whole = (sp[1] << 8);
printf("WHOLE = %x\r\n",whole);
Anybody see anything wrong with what I am doing?
Regards
Wilksey