avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] timer on mega128


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] timer on mega128
Date: Thu, 3 Jul 2003 13:48:27 +0200 (MET DST)

"Ezio Balbo" <address@hidden> wrote:

> Messaggio in formato MIME composto da piy parti.

(Please don't post HTML.)

> Why in header file <timer.h> the enumeration=20
> 
> enum {
>   STOP             =3D 0,
>   CK               =3D 1,
>   CK8              =3D 2,
>   CK64             =3D 3,
>   CK256            =3D 4,
>   CK1024           =3D 5,
>   T0_FALLING_EDGE  =3D 6,
>   T0_RISING_EDGE   =3D 7
> }
> 
> doesn't fit to clock select register TCCR0 of atmega128?

Because enums are (by definition) of type `int' but your register is
of type `unsigned char'.

However, beware that the above definition only applies to early AVRs.
We should probably deprecate the use of <avr/timer.h> alltogether.
timer_stop()/timer_start() are complete nonsense (you cannot
start/stop a timer by writing to the TCNTx register).  This header
file can at best serve as a simple example.
-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/


reply via email to

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