??? 05/19/06 16:59 Read: times |
#116687 - 8051 UART trouble.... |
Hello, I'm doing a final year project involving an Atmel 89S53 8051. I'd like to send some logged data over the UART but I can't get the damn thing going.
I've tried flashing a simple echo program with a variety of different baud rates but I'm getting nothing from the TxD. The byte I'm sending from my PC is definitely arriving on the RxD pin as i've checked it with an oscilloscope, however I belive that the processor isn't recognizing its arrival? I appreciate your time, and realize it's difficult to diagnose these things over the web. Here's the code: (of course it simulates fine) ----------------------------------------------------------------- #include "reg_c51.h" char uart_data; /** * FUNCTION_PURPOSE: This file set up uart in mode 1 (8 bits uart) with * timer 1 in mode 2 (8 bits auto reload timer). */ void main (void) { SCON = 0x50; /* uart in mode 1 (8 bit), REN=1 */ TMOD = TMOD | 0x20 ; /* Timer 1 in mode 2 */ TH1 = 0xF3; /*2400 @ 12mhz */ TL1 = 0xF3; /*2400 Bds at 12MHz */ ES = 1; /* Enable serial interrupt*/ EA = 1; /* Enable global interrupt */ TR1 = 1; /* Timer 1 run */ while(1); /* endless */ } /** * FUNCTION_PURPOSE: serial interrupt, echo received data. * FUNCTION_INPUTS: P3.0(RXD) serial input * FUNCTION_OUTPUTS: P3.1(TXD) serial output */ void serial_IT(void) interrupt 4 { if (RI == 1) { /* if reception occur */ RI = 0; /* clear reception flag for next reception */ uart_data = SBUF; /* Read receive data */ SBUF = uart_data; /* Send back same data on uart*/ } else TI = 0; /* if emission occur */ /* clear emission flag for next emission*/ } |
Topic | Author | Date |
8051 UART trouble.... | 01/01/70 00:00 | |
of course you don't | 01/01/70 00:00 | |
Sorry | 01/01/70 00:00 | |
what? | 01/01/70 00:00 | |
He's not being facetious ... | 01/01/70 00:00 | |
I understand | 01/01/70 00:00 | |
Post the other code you tried | 01/01/70 00:00 | |
me stupid too | 01/01/70 00:00 | |
My guess | 01/01/70 00:00 | |
Introduction | 01/01/70 00:00 | |
Another link | 01/01/70 00:00 | |
Jon, some small errors/oversights | 01/01/70 00:00 | |
Note taken | 01/01/70 00:00 | |
A Suggestion | 01/01/70 00:00 | |
Even eaiser | 01/01/70 00:00 | |
try this | 01/01/70 00:00 | |
location, location, location | 01/01/70 00:00 | |
I saw you logged in a few minutes ago![]() | 01/01/70 00:00 |