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

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

Re: [avr-gcc-list] more detailed UART Problems


From: Jason Kyle
Subject: Re: [avr-gcc-list] more detailed UART Problems
Date: Fri, 05 Apr 2002 09:42:12 +1200

At 04:17 5/04/2002, Karsten Becker wrote:
Hi everybody,
I found this very interesting piece of code that makes problems.
#include <progmem.h>
#include "uart.h"
u08 newval=0xFF,oldval=0xFF;
int main(void) {
   UART_Init();
   outp(0x00,DDRA);
   for (;;) {
       newval=inp(PINA);
       if (newval!=oldval) {
           oldval=newval;
           PRINT("Dumping memory");
           EOL();
       }
   }
}

SIGNAL(SIG_UART_RECV) {
   UART_RxChar = inp(UDR);
}

Try reading USR first, check FE bit in case there was a framing error. If you don't read USR there are some strange symtoms as you note.

Jason Kyle

PS No warranty on the code below!

if (inp(USR) & BV(FE)) {
        inp(UDR);
        /* Code to handle framing error */
}
else {
        UART_RxChar = inp(UDR);
        /* Do whatever */

}




The symtom is, when you reset the 8535 and press a switch, the Text Dumping memory is send normally. But when you send a char to the µC and then press the switch just the big D is written to the terminal.
Maybe someone has an idea.
Thanks,
Karsten

avr-gcc-list at http://avr1.org



reply via email to

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