[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] ATMega UART question
From: |
Preston Wilson |
Subject: |
Re: [avr-chat] ATMega UART question |
Date: |
Sat, 20 Dec 2008 19:19:03 -0500 |
User-agent: |
Microsoft-Entourage/11.4.0.080122 |
"Sid Price" wrote:
> I am working on a design using the one UART0 on a mega164p and I am having
> an issue with initialization of the UART. I notice that when I enable the TX
> a byte of all zeros is transmitted. I even see this if I assert the TX
> enable bit with the debugger. Is this normal? Is there a way to avoid it?
> Thanks,
> Sid.
I have used UART0 on both the ATmega164P and ATmega324P and never seen the
behavior you describe. My uart init routine does the following:
... initialize head and tail pointers, and set baud rate
// Enable rx, tx, and rx complete interrupt
UCSR0B = (1<<RXCIE0)|(1<<RXEN0)|(1<<TXEN0);
// Set async 8N1
UCSR0C = (1<<UCSZ01)|(1<<UCSZ00);
In the UDRE interrupt routine, I assign the byte to transmit to UDR0.
-Preston