Hi Bob!

Hmm, I agree that this would definitely cause problems, and am glad I
now know to watch out for it, but I don't believe this is happening
here. I only read the timer value inside the interrupt.

I've tried now compiling the exact same source code on my windows
computer running AVR Studio, and the hex file produced by that
compilation works exactly as expected. rand() produces a sequence which
doesn't repeat after only seven calls, and it is not halting or showing
any other odd behavior.

I wonder if this could be caused by Ubuntu 8.10 itself. I downgraded the
compiler and avr-libc to the Ubuntu 8.04 versions, which worked before,
but I am still running on Ubuntu 8.10. I wonder if there is something
more sinister wrong with the base Ubuntu system...

-Brian

On Tue, 2008-11-11 at 14:58 -0500, Bob Paddock wrote:
> > while(TCNT3<(uint16_t)benc_period*224UL/255);
> 
> One can never have to many parenthesise when
> writing something like the above.
> 
> I did not look at your code so the following may not be relevant.
> 
> If you are having issues with 16-bit register values,
> make sure that you are not accessing the same timer
> from both inside *and* outside of the interrupt
> concurrently.  Nor should you nest interrupts of the
> same 16-bit timer (not likely you are doing this).
> You will get corrupted values at very random intervals.
> The problem is explained here:
> 
> http://www.atmel.com/dyn/resources/prod_documents/doc1493.pdf



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

Reply via email to