This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bit operation

Hello. I use nRF52 , PCA10040 , S132 , SDK 11 & Keil5.

I want nrf to do bit operation. The code about bit operation is following.

unsigned char tmp[2]; unsigned short us; tmp[0] = 0xf8; tmp[1] = 0x59; us = (tmp[0] << 8) | tmp[1]; printf("%d\r\n",us);

I thought the printf("%d\r\n",us); should output 63577, but it output another number. What is my code wrong?

Please help me.

Thanks,

Related