> 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