1,在mcu程序中,例如我要做以下事情
unsigned long value;
unsigned char byte1;
unsigned char byte2;
unsigned char byte3;
value = byte1 * 10000 + byte2 * 100 + byte3;
如果这样写的话结果会出错,具体原因未知。
改成这样就可以了:
value = (unsigned long)(byte1) * 10000 + (unsigned long)(byte2) * 100 + (unsigned long)(byte3);