文章目录
#define uint8 unsigned char
#define uint16 unsigned int
方法一:强制类型转换
uint8 byte8_arry[2] = { 0xAA,0xBB};
uint16 word16 = *(uint16 *)byte8_arry;
方法二:联合体
typedef union{
uint16 word16;
uint8 byte8_arry[2];
}word_bytes;
word_bytes a;
a = 0xAABB;
方法三:移位
uint8 byte8_arry[2]={ 0xAA,0xBB};
uint16 word16 = byte8_arry[0]<<8 + byte8_arry[1];