代码如下:
#pragma pack(1)
#define STX 0x02
#define STX2 0x68
typedef struct
{
uint8_t stx;
uint16_t PkgLen;
uint16_t Sn;
uint8_t prData[64];
uint16_t Crc16;
} Req_Command;
__UART_H_EXT uint8_t TxBuffer[TX1LEN],RxBuffer[RX1LEN];
Req_Command = (Req_Command*)TxBuffer;
运行*(uint16_t *)prAns_Command->prData = 0x0000;时,,发生DEFAULT
测试*(uint16_t *)&TxBuffer[11] = 0x0000; 时,,发生DEFAULT
测试*(uint16_t *)&TxBuffer[10] = 0x0000; 时,正常执行
关于对齐问题请指教,,有哪些针对这种情况的好方法,请赐教.
|