标题:
中微MCU SC8F6770程序调试问题
[打印本页]
作者:
longchi31
时间:
2023-4-3 01:27
标题:
中微MCU SC8F6770程序调试问题
各位大神,我崩溃了
,请教一下,我下面这段代码
tmp=0x81;//receive_byte[4];
///if(Crc8_table[tmp-0x08]==0xA8&&tmp==receive_byte[4])/*OK*/
if(Crc8_table[receive_byte[4]-0x08]==0xA8)//
{
send_buf[0]=receive_byte[0];//Crc8_table[signature];
send_buf[1]=receive_byte[1];
send_buf[2]=receive_byte[2];
send_buf[3]=receive_byte[3];
send_buf[4]=receive_byte[4];
send_buf[5]=Check_Receive_CRC();
}
其中变量类型
const BYTE Crc8_table[256] = {……};
unsigned char tmp=0;
那个变量tmp是我添加的来测试的, 如果我用
if(Crc8_table[tmp-0x08]==0xA8&&tmp==receive_byte[4]),它的结果为真,
但是我改成
if(Crc8_table[receive_byte[4]-0x08]==0xA8),它的结果为假。
我也尝试过 tmp=receive_byte[4];这样Crc8_table[tmp-0x08]也是假,为什么这样?
这是为什么?因为我没有调试工具,程序是什么跑的。按理两个条件结果应该一样的。请大神指教
作者:
人工置顶员
时间:
2023-4-3 22:21
顶一下
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1