|
各位大神,我崩潰了 ,請教一下,我下面這段代碼
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]),它的結(jié)果為真,
但是我改成
if(Crc8_table[receive_byte[4]-0x08]==0xA8),它的結(jié)果為假。
我也嘗試過 tmp=receive_byte[4];這樣Crc8_table[tmp-0x08]也是假,為什么這樣?
這是為什么?因為我沒有調(diào)試工具,程序是什么跑的。按理兩個條件結(jié)果應(yīng)該一樣的。請大神指教
|
|