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

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

Re: [avr-gcc-list] Re: Re: USART - Interrupt - problem -Similar (SOLVED)


From: Christian Ludlam
Subject: Re: [avr-gcc-list] Re: Re: USART - Interrupt - problem -Similar (SOLVED)
Date: Tue, 25 May 2004 00:14:48 +0100
User-agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.06) POPstar/2.05

On 24 May Matthew Arcus wrote:

> On Monday 24 May 2004 7:53 pm, Steve wrote:
> >Just quickly incase it helps someone else; I changed the interrupt code to
> >the following:
> >
> > /*UDRE data register empty*/
> > SIGNAL(SIG_UART_DATA)
> > {
> >     UCR = 0xD8; //disable this int
> > }
> 
> It's a really good idea to use the _BV macro and the predefined bits for
> this  sort of thing (and it's probably not a good idea to set all the bits,
> you  would be better off using a mask) ie:
> 
> UCR &= ~_BV(UDRIE);
> 
> It's clearer, and also not all AVRs have the same bits in the same places.

In this case it's more efficient too, since the compiler can use the cbi
instruction (saving a register and a cycle).

-- 
Christian Ludlam
address@hidden


reply via email to

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