AW: [En-Nut-Discussion] Just a minor patch...

Harald Kipp harald.kipp at egnite.de
Tue Sep 21 16:21:13 CEST 2004


Radek,

from C:\icc\include\iom128.h

/* TCCR0 Timer/Counter 0 Control Register */
#define FOC0    7
#define WGM00   6
#define COM01   5
#define COM00   4
#define WGM01   3
#define    CS02         2
#define    CS01         1
#define    CS00         0

For example CS2 is not available with ICCAVR.

 From avr-libc, iom128.h

/* Timer/Counter Control Register (generic) */
#define    FOC          7
#define    WGM0         6
#define    COM1         5
#define    COM0         4
#define    WGM1         3
#define    CS2          2
#define    CS1          1
#define    CS0          0

/* Timer/Counter 0 Control Register - TCCR0 */
#define    FOC0         7
#define    WGM00        6
#define    COM01        5
#define    COM00        4
#define    WGM01        3
#define    CS02         2
#define    CS01         1
#define    CS00         0

Both are available here. Which compiler, library and PC-OS
are you using?

Harald


At 16:13 21.09.2004 +0200, you wrote:
>Hi,
>
>it's the line just after the #ifdef. Somehow, it doesn't compile when we use
>the two-digit notation:
>
>bad: outp(BV(CS00) | BV(CS02) | BV(WGM01), TCCR0);
>good: outp(BV(CS0) | BV(CS2) | BV(WGM1), TCCR0);
>
>I have practicaly no experience with avr and related stuff, this is just what
>i found by experimenting...
>
>Radek Podgorny
>
>
> > Radek,
> >
> > your patch was
> >
> > --- timer.c.orig        2004-03-05 21:38:41.000000000 +0100
> > +++ timer.c     2004-08-04 15:32:42.000000000 +0200
> > @@ -634,7 +634,7 @@
> >        *   register, so we'll get a compare match interrupt every
> > millisecond. */
> >   #ifdef __AVR_ATmega128__
> > -    outp(BV(CS00) | BV(CS20) | BV(WGM01), TCCR0);
> > +    outp(BV(CS0) | BV(CS2) | BV(WGM1), TCCR0);
> >   #else
> >       outp(BV(CS00) | BV(CS02) | BV(CTC0), TCCR0);
> >   #endif
> >
> > os/arch/avr_timer.c in HEAD (and 3.9.1) is
> >
> > #ifdef __AVR_ATmega128__
> >      outp(BV(CS00) | BV(CS02) | BV(WGM01), TCCR0);
> > #else
> >      outp(BV(CS00) | BV(CS02) | BV(CTC0), TCCR0);
> > #endif
> >
> > Where is the difference between your patch and the current
> > release?
> >
> > Harald
> >
> > _______________________________________________
> > En-Nut-Discussion mailing list
> > En-Nut-Discussion at egnite.de
> > http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
>--
>GnuPG key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x98E56D84
>_______________________________________________
>En-Nut-Discussion mailing list
>En-Nut-Discussion at egnite.de
>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion




More information about the En-Nut-Discussion mailing list