I downloaded AT89C51ED2 UART source code from ATMEL web. when I connected from PC COM1 to AT89C51ED2 and sended a byte data, it sended a wrong byte data back. Have some solutions about this @@?
check the connections to your MAX232(equivalent) and the signals there with a scope. Also verify the baudrate both ways. Erik
I am sure the connections is right. because it is a development kit board. The board use the same port which is RS232 DB9 connector to download the hex file(use FLIP). The C source file was downloaded from ATMEL. I don't modify it. The SPI example(ATMEL) is work, and the UART example cant...>_< I had search the internet, someone says that maybe the UART use 9bit or else. It makes the PC COM1 can't read correct. PS. I dont have oscilloscope, I just a student. >_<
what baudrate, how is it set? Erik
you can find the source code in following link http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3420 I use C51 UART Mode1 Timer1 (24 KB, updated 06/04) 9600bps Regard.
I use C51 UART Mode1 Timer1 (24 KB, updated 06/04) 9600bps what are the SFRs (SCON, TCON, TMOD, TH1, TL1, IE set to) Erik
hi erik the same with the source code. SCON = 0x50; /* uart in mode 1 (8 bit), REN=1 */ TMOD = TMOD | 0x20 ; /* Timer 1 in mode 2 */ TH1 = 0xFD; /* 9600 Bds at 11.059MHz */ TL1 = 0xFD; /* 9600 Bds at 11.059MHz */ ES = 1; /* Enable serial interrupt */ EA = 1; /* Enable global interrupt */ TR1 = 1; /* Timer 1 run */ I didn't modify it. Regard, Yuhung
PCON? what are you using in the other end
PCON? It is not setting in source code. Should I set it a value? the other end.... I use PC COM1 with Windows hyperTerminal (C:\Program Files\Windows NT\hypertrm.exe) the setting is 9600 / 8 / N / 1 / N(flow control?) PS. I use the windowsXP which is Non-English version. so, I am not sure it is "flow control". Regasrd.
View all questions in Keil forum