Thanks. It explain compiller behavior and different mask then i set.
Dnia 29-06-2008 o godz. 0:12 Ruud Vlaming napisał(a): > Hi > > If i try (changed your code a bit to make it compile) > #define mbitPatternPowerMode (7<<2) > #define mADCNoiseReduction 0x20 > #define mbitSleepMask 0x04 > > void Test_MCUCR(void) > { > MCUCR=(MCUCR&(~mbitPatternPowerMode))|(mADCNoiseReduction|mbitSleepMask); > } > > I get the same result. If you however try the same with > #define mADCNoiseReduction 0x10 > > You get 0xE3 as expected. The point is, defining mADCNoiseReduction > with bit 5 set, it does not make a difference to the result if you > use 0xC3 or 0xE5. So the compiler "optimized" it for you. > > greetings > Ruud. > > > > > > On Saturday 28 June 2008 12:28, Arkadiusz Krysiak wrote: > > can anyone explain that behavior? > > > > i have: > > #define mbitPatternPowerMode=(7<<2); > > > > MCUCR=(MCUCR&(~mbitPatternPowerMode))|(mADCNoiseReduction|mbitSleepMask); > > > > and i get before compilation: > > > > +00000088: B785 IN R24,0x35 In from I/O location > > +00000089: 7C83 ANDI R24,0xC3 Logical AND with > > immediate > > ; ^^^^ bad value i expect 0xE3 > > instead of 0xC3 :O > > > > +0000008A: 6284 ORI R24,0x24 Logical OR with > > immediate > > +0000008B: BF85 OUT 0x35,R24 Out to I/O location > > > > ---------------------------------------------------- > > Wystartuj z siłą bolidu w wyścigu o kombinezon i czapkę > > ROBERTA KUBICY! Rusza wielka aukcja charytatywna, > > sprawdź więcej: > > http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Faukcje7368578.html&sid=387 > > > > > > > > > > _______________________________________________ > > AVR-GCC-list mailing list > > AVR-GCC-list@nongnu.org > > http://lists.nongnu.org/mailman/listinfo/avr-gcc-list > > ---------------------------------------------------- Uwalniamy 13 mln loginów! Włącz się do akcji - zagraj na stronie: http://klik.wp.pl/?adr=http%3A%2F%2Fpoczta.wp.pl%2Fgra.html%3Faction%3Dpoint&sid=398 _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list