Hello,
if I have an unsigned int with the value 255 and I <<8 I was expecting to get 65280. If I then | ('bitwise or') it with say 127, I am expecting to get serialdata=65407.
unsigned int serialdata=0;/* the 16 bits of serial data to go out to the analog board - flush it so its clean */
unsigned int shift_out_bit=0;
int m=1;
int SCOUNT=0;
printf("serialdata 1 %u\n\r",serialdata);
serialdata = (control | inputrelay);
printf("serialdata 2 = %u\n\r",serialdata);
However, what I get at the second printf is 4294967134.
It looks like this is somehow converting to an unsigned long, but the value is still garbage. I tried quite a few things, but no luck. Any pointers here?
Thanks
Hello,
if I have an unsigned int with the value 255 and I <<8 I was expecting to get 65280. If I then | ('bitwise or') it with say 127, I am expecting to get serialdata=65407.
unsigned int serialdata=0;/* the 16 bits of serial data to go out to the analog board - flush it so its clean */
unsigned int shift_out_bit=0;
int m=1;
int SCOUNT=0;
printf("serialdata 1 %u\n\r",serialdata);
serialdata = (control | inputrelay);
printf("serialdata 2 = %u\n\r",serialdata);
However, what I get at the second printf is 4294967134.
It looks like this is somehow converting to an unsigned long, but the value is still garbage. I tried quite a few things, but no luck. Any pointers here?
Thanks