We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
#include <reg52.h> // Due to these two options, the // program always goes wrong. #pragma NOINTPROMOTE #pragma OPTIMIZE(7, SPEED) unsigned long xdata CommonValue; unsigned char xdata Result; void UseResult(void) { P3=Result; } void Func() { for (;;) { // Surely, Common Value is 100, if (CommonValue > 0L) { // Should come here Result = 0xff; } else { // But it always comes here. Result = 0; } UseResult(); } } void main(void) { CommonValue=100; Func(); }