[Top][All Lists]

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

RE: [avr-gcc-list] Problems with ATMEGA8 USART

From: Nigel Winterbottom
Subject: RE: [avr-gcc-list] Problems with ATMEGA8 USART
Date: Tue, 16 Aug 2005 08:48:28 +0100

-----Original Message-----

The one clumsy part of code was in my_putchar() which had to reach  
directly into the hardware for the specific port to restart the Tx  
IRQ if the buffer had been empty, which causes my Tx IRQ routine to  
shut itself off. Also there was a possible race condition.

David Kelly N4HHE, address@hidden
Whom computers would destroy, they must first drive mad.

You've missed a trick, restarting USART comms is a simple as re-enabling
the interrupt which is safe to do as many times as you like and whenever
you like.

Example from my mega169 uart.c: (uart_no 1 is for RS232 using USI.
Restarting that isn't so easy)

//Restart COMMS
if (uart_no==0)
        UCSRB |= 1<<UDRIE;                      //Enable Tx buffer empty
IRQ to Restart COMMS

Nigel Winterbottom

reply via email to

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