Re: [avr-gcc-list] Should this code work? 4.1.1

2007-03-05 Thread Dave Hansen
From: "Graham Davies" <[EMAIL PROTECTED]> Bob Paddock wrote: [...] I don't see while(true){} being any different than for(;;){} in this context, and while(true){} causes the Lint error of "evaluation of constant value boolean". [...] I can't see why Lint would consider this an error and for

Re: [avr-gcc-list] Should this code work? 4.1.1

2007-03-05 Thread Bob Paddock
On Sunday 04 March 2007 14:21, Gavin Jackson wrote: > Another thing you may want to take a look at is the SPIF > flag on page 174 of the datasheet. It states that: > >From what the datasheet says, your SPIF bit is never cleared > so you'll be overwriting the SPI data register contents before > the

RE: [avr-gcc-list] Should this code work? 4.1.1

2007-03-04 Thread Gavin Jackson
Another thing you may want to take a look at is the SPIF flag on page 174 of the datasheet. It states that: When a serial transfer is complete, the SPIF flag is set. An interrupt is generated if SPIF in SPCR is set and global interrupts are enabled... SPIF is cleared by hardware when executing the

Re: [avr-gcc-list] Should this code work? 4.1.1

2007-03-03 Thread Graham Davies
Bob Paddock wrote: The "falls out" is the issue with me, as I see the {} as being "contained within", the "}" was never crossed, so to me it was still the same {} block. Let's look at it another way. Is there anything inside the braces that says "let's do all this over and over". There isn'

Re: [avr-gcc-list] Should this code work? 4.1.1

2007-03-03 Thread Francesco Sacchi
Bob Paddock ha scritto: The "falls out" is the issue with me, as I see the {} as being "contained within", the "}" was never crossed, so to me it was still the same {} block. I could not find this "reinitialize" issue in my old K&R book? The condition of the loop must me somehow checked. When

Re: [avr-gcc-list] Should this code work? 4.1.1

2007-03-03 Thread Bob Paddock
On Friday 02 March 2007 21:29, Graham Davies wrote: > Bob Paddock wrote: > < for(;;){} is a endless loop, how is "until execution of that > > block ends in any way." being fulfilled here? > > The block begins with the open brace and ends with the close brace. The > block ends when control falls

Re: [avr-gcc-list] Should this code work? 4.1.1

2007-03-02 Thread Graham Davies
Bob Paddock wrote: < for(;;){} is a endless loop, how is "until execution of that block ends in any way." being fulfilled here? The block begins with the open brace and ends with the close brace. The block ends when control falls out of the bottom and for ( ; ; ) takes over for the next iter

Re: [avr-gcc-list] Should this code work? 4.1.1

2007-03-02 Thread Bob Paddock
On Friday 02 March 2007 18:42, Francesco Sacchi wrote: > Bob Paddock ha scritto: > > you see that the last rjmp is jumping to the point where shift > > is reinitialized with '1' (r18/r19). > > > > Moving 'uint16_t shift = 1;' out of the for(;;){} and into > > the top of main(){} makes the code wor

Re: [avr-gcc-list] Should this code work? 4.1.1

2007-03-02 Thread Francesco Sacchi
Bob Paddock ha scritto: you see that the last rjmp is jumping to the point where shift is reinitialized with '1' (r18/r19). Moving 'uint16_t shift = 1;' out of the for(;;){} and into the top of main(){} makes the code work ok. Is it my understanding, or the compiler that is broken here? Nothi

RE: [avr-gcc-list] Should this code work? 4.1.1

2007-03-02 Thread James L. Evans
Shouldn't the declaration of shift be OUTSIDE the for block (or in the for expression). Otherwize, shift is always 1 and the if (0 == shift) can be optimized away. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bob Paddock Sent: Friday, March 02, 2007 3: