[Top][All Lists]

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

Re: [avr-gcc-list] 32-bits time

From: Dmitry K.
Subject: Re: [avr-gcc-list] 32-bits time
Date: Thu, 13 Oct 2005 13:45:08 +1100
User-agent: KMail/1.5

On Thursday 13 October 2005 09:06, Eric wrote:
> Between the first TCNT1L read and the second, the counter is going to be
> incremented, so the comparison will failed each time, isn't it ?
> > I have implemented a 32-bits time information using the code below.
> > Timer1 is incremented using internal clock, prescaler=1; SIG_OVERFLOW
> > interrupt is used to increment a variable used to complete the 16-bits

Sorry, I have miss that prescaler is 1.
More exactly:

#define __SFR_OFFSET  0
        in      r0, TCNT1L      ; TEMP loading
1:      in      r0, TCNT1H
        lds     r24, hiword_time
        lds     r25, hiword_time + 1
        in      r22, TCNT1L
        in      r23, TCNT1H
        cp      r23, r0
        brne    1b

Loop length is optimized.
(SREG.I always 1 is implied.)


reply via email to

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