各位好,请教下keil里面两个16进制数据合并成32位高16位被丢弃是什么问题呢?程序如下: 用上面的合并方式,发到串口助手里面高16位被丢弃了,需要用下面的那种合并方式.想了很久也没找到原因,求帮忙分析下,万分感谢! void main() { unsigned long along; unsigned int bu16; unsigned int cu16; bu16 = 0x1000; cu16 = 0x1010; Init_UART(); along = bu16 << 16 | cu16; UART1_Send(along >> 24); UART1_Send(along >> 16); UART1_Send(along >> 8); UART1_Send(along); ((unsigned char *)&along)[0] = bu16 >> 8; ((unsigned char *)&along)[1] = bu16 ; ((unsigned char *)&along)[2] = cu16 >> 8 ; ((unsigned char *)&along)[3] = cu16 ; UART1_Send(along >> 24); UART1_Send(along >> 16); UART1_Send(along >> 8); UART1_Send(along); while(1); }
|