[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Re: USART - Interrupt - problem -Similar
From: |
Steve |
Subject: |
[avr-gcc-list] Re: USART - Interrupt - problem -Similar |
Date: |
Wed, 26 May 2004 18:32:57 +0200 |
Matthew, Christian,
Thanks for the advice.
>Jolly good (I assume "constantly" means no more often than it should).
Constantly means every time that a character has been sent :)
I would of course use bit masks in an application, the purpose of the
code was just to understand the UART interrupts. However I was not aware
of the _BV macro for this. Therefore thanks for pointing me to this.
Steve
On Monday 24 May 2004 7:53 pm, Steve wrote:
> Matthew,
>
> I followed your advise and now have the transmit complete interrupt
> firing constantly.
Jolly good (I assume "constantly" means no more often than it should).
>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.
Cheers,
Matthew.
------------------------------
Date: Tue, 25 May 2004 00:14:48 +0100
From: Christian Ludlam <address@hidden>
To: address@hidden
Subject: Re: [avr-gcc-list] Re: Re: USART - Interrupt - problem -Similar
(SOLVED)
Message-ID: <address@hidden>
In-Reply-To: <address@hidden>
References: <address@hidden>
Content-Type: text/plain; charset=us-ascii
MIME-Version: 1.0
Precedence: list
Message: 5
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
------------------------------
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list
End of avr-gcc-list Digest, Vol 16, Issue 20
********************************************
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.689 / Virus Database: 450 - Release Date: 21.05.2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.689 / Virus Database: 450 - Release Date: 21.05.2004