[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] (no subject)
From: |
Ruud Vlaming |
Subject: |
Re: [avr-gcc-list] (no subject) |
Date: |
Sun, 29 Jun 2008 00:12:22 +0200 |
User-agent: |
KMail/1.9.1 |
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
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>