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

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

Re: [avr-gcc-list] strange c


From: Christian Ludlam
Subject: Re: [avr-gcc-list] strange c
Date: Tue, 18 Dec 2001 13:45:57 +0000
User-agent: POPstar/2.02

On 18 Dec Torsten Hahn wrote:

> Hi,
> 
> im a bit new to low-level c, but what does e.g 1<<TOIE1 do ?
> From the languege reference i know the shift operator to use like value<<1 
> but not the other way around.

It converts a bit /number/ into a bit /mask/. TOIE1 is defined as 7 (for an
AVR 2313), but to set bit 7 in the TIMSK register you need to OR it with the
value 0x80, or 1<<7. So you have

    TIMSK |= (1<<TOIE1)

to enable the Timer1 interrupt.


C
-- 
Christian Ludlam
address@hidden



reply via email to

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