avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Compile problem


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Compile problem
Date: Fri, 7 Oct 2005 22:29:38 +0200 (MET DST)

Razvan Turiac <address@hidden> wrote:

> Attached are a simple C source (I have isolated the
> problem), and the generated assembeler file.

> The problem is in function "wait".

You should have explained what you think the problem is...  But my
crystal ball told me you might mean this:

.L4:
        in r24,88-0x20
        rjmp .L4

Looks a bit surprising at the first glance, indeed.  But only until
you see the source code for it:

                while(!(TIFR & TOV0));

TOV0 is number 0.  You told the compiler to read TIFR (which it does),
mask all bits out, and then compare it against 0 (the negation).  As
masking all bits out is guaranteed to generate value 0, the
comparision will be always true.

I think you meant

                while(!(TIFR & (1 << TOV0)));

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]