本帖最后由 LiangZen 于 2019-2-26 11:11 编辑
详细请参考附件,附件是完整的工程,问题描述也main.c中有描述: //CRC校验
const unsigned int crc16L[] = \
{
0x0000, 0xC0C1, 0xC181, 0x0140,
0xC301, 0x03C0, 0x0280, 0xC241,
0xC601, 0x06C0, 0x0780, 0xC741,
0x0500, 0xC5C1, 0xC481, 0x0440,
};
const unsigned int crc16H[] = \
{
0x0000, 0xCC01, 0xD801, 0x1400,
0xF001, 0x3C00, 0x2800, 0xE401,
0xA001, 0x6C00, 0x7800, 0xB401,
0x5000, 0x9C01, 0x8801, 0x4400,
};
unsigned int i_a;
unsigned int i_b;
while (1)
{
// Add your application code
i_a = crc16L[3];
if(i_a == 0x0140){
i_b = 1;
NOP();
} else {
NOP();
i_b = 0;
}
// The problem is :The variable crc16L cannot be assigned to i_a, Why?
NOP();
NOP();
}
|
被编译器优化了