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.
Hi, I found my bug, but I want to understand why the compiler did that! I use a fonction to clear bits: CLRBIT(BYTE, MASK); The following C code: CLRBIT(aBMCURegisters[REGADDRESS], I2C_SELECT_BIT | DDC_BYPASSN_BIT); Compile this ASM code: ANL aBMCURegisters+01H,#07FH Which is wrong because, the definition of bits are: #define DDC_BYPASSN_BIT bmBIT2 #define I2C_SELECT_BIT bmBIT7 It's like the compiler only check the first bit of the second argument! To compile a right code, I need to put the second argument between (), like this: CLRBIT(aBMCURegisters[REGADDRESS], (I2C_SELECT_BIT | DDC_BYPASSN_BIT)); Compile this ASM code: ANL aBMCURegisters+01H,#07BH Please note that the C code use only one line... (no return between args). Do you know why? Thanks, Denis.
when the compiler support inline function. I beleive that C51 should also support it! it does. That it does it in a crummy way (no debug of C source etc) is another story. Erik