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

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

RE: [avr-gcc-list] BUG in WINAVR?


From: Trampas
Subject: RE: [avr-gcc-list] BUG in WINAVR?
Date: Fri, 11 Aug 2006 22:30:36 -0400

I went and rewrote the code and it all works now. 

Trampas

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Trampas
Sent: Friday, August 11, 2006 9:03 PM
To: address@hidden
Subject: [avr-gcc-list] BUG in WINAVR?

I think I have found a bug in GCC for the AVR. 

Here is the snip of code

                        
                #define K_IN ((PIND>>2) & 0x01)
                while(K_IN==1)  //spin waiting on sync bit
                {
                        if (TCNT3L>250)
                        {
                                timeMs=timeMs+1;
                                TCNT3L=0;
                        }
                        if (timeMs>time_out_ms )
                        {
                                if (index==0)
                                {
                                        printf("Error: ISO get time
out\n\r");
                                }
                                ENABLE_INTERRUPTS();
                                return index;
                        }

                }

>From stepping though the code it appears that the test for K_IN==1 is done
at the end of the loop, and it appears that compiler thinks the end of the
loop is at the return. Thus the code times out each and every time I run it.


The only way I could debug the code was put a break point on the IN assembly
instruction and it appears to only be called once. 

FYI this is in the April 2006 build of WinAVR.

Trampas 




_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list





reply via email to

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