volatile unsigned int Wi; Wi= (0x4000*3)/(0x10); //The compliler will make Wi = 0xfc00 !! //The right answere is Wi = 0x0c00!!
A constand of 0xb000, however, is unsigned in 16-bit ANSI C compilers. Getting this right might require the "apply ANSI integer promotions" switch of C51 to be active. Refer to 6.3.1.8 Usual arithmetic conversions in the ANSI spec for what's actually happening in the case mentioned. In this situation, the result being a signed int is correct. Jon
Thank you everybody!!! Thank you very much for your answer!