[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Problem with delay loop
From: |
David Kelly |
Subject: |
Re: [avr-gcc-list] Problem with delay loop |
Date: |
Fri, 28 Sep 2007 09:12:26 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, Sep 28, 2007 at 09:05:40AM -0500, David Kelly wrote:
>
> For finer delays don't forget the OCR functions on the timers. Is pretty
> easy to write and create very accurate delays with:
>
> void delay( uint8_t delay );
> {
> OCR2A = TCNT2 + delay;
> TIFR2 = (1<<OCF2A); // clear possible pending
>
> // wait until TCNT2 matches OCR2A
> while( ( TIFR2 && (1<<OCF2A) ) == 0 )
^^ arrgh!
> ;
> }
Above should be while( ( TIFR2 & (1<<OCF2A) ) == 0 ), bitwise and, not
logical and.
--
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.
Re: [avr-gcc-list] Problem with delay loop, David Kelly, 2007/09/28
- Re: [avr-gcc-list] Problem with delay loop,
David Kelly <=