dear sir or madam
i have made the following code to test uart1 for at89s52 with 12mhz crystal.
i program the 8051-ready card but the pc receive's not the right string. Instead of "12345678" string i receive unknown characters. The baud rate is 9600 at the program and at the pc receiver. I believe that something is wrong with the crystal declaration or with the uart_init command at the microc for 8051 compiler. I do not have this problem with the pic compiler in similar applications.
what can i do? any suggestions?
char uart_rd;
void main() {
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text("Start UART test");
while (1) // Endless loop
{
UART1_write_text("12345678");
delay_ms(1000);
}
}
8051-ready witn 89s52 uart problem
Re: 8051-ready witn 89s52 uart problem
Hi,
Did you set appropriate crystal value in the project ?
Could you try changing baud rate to see if you can receive good characters ?
Regards,
Filip.
Did you set appropriate crystal value in the project ?
Could you try changing baud rate to see if you can receive good characters ?
Regards,
Filip.
Re: 8051-ready witn 89s52 uart problem
i have tried several baud rates from 1200 to 9600 and several crystals 10 - 11,0592 - 12Mhz.
i received some good characters only with 10Mhz crystal.
i was receiving back about 7 to 10 good characters.not all of them.
i received some good characters only with 10Mhz crystal.
i was receiving back about 7 to 10 good characters.not all of them.
Re: 8051-ready witn 89s52 uart problem
Hi,
Do you any other MCU that you can try ?
Could you attach here this project ?
Regards,
Filip.
Do you any other MCU that you can try ?
Could you attach here this project ?
Regards,
Filip.
Re: 8051-ready witn 89s52 uart problem
Hi,
I am facing identical problem as xyar2003.
I have tried various crystals & again @ 10.0 Mhz I receive some characters correctly.
I even tried the UART example itself but still no luck.
I am facing identical problem as xyar2003.
I have tried various crystals & again @ 10.0 Mhz I receive some characters correctly.
I even tried the UART example itself but still no luck.
Re: 8051-ready witn 89s52 uart problem
Hi,
Which development system are you using ?
Could you attach here the project that you are using ?
Regards,
Filip.
Which development system are you using ?
Could you attach here the project that you are using ?
Regards,
Filip.
Re: 8051-ready witn 89s52 uart problem
I had the same problem and do not know why, but bautrate is double the programmed. I programmed my AT89S52 for 4800 and I left the pc in 9600, worked perfectly, did several tests on other speeds and is always double.
Re: 8051-ready witn 89s52 uart problem
At89c52 never worked but i used other MCUs such as at89s2051 and everything works correctly.
Re: 8051-ready witn 89s52 uart problem
Hi,
Please, try the MCL library file from the attachment with the AT89S52, place it in the ..\mikroC PRO for 8051\Uses\ATMEL\ folder instead of the existing (backup just in case) and inform me of the results.
Regards,
Filip.
Please, try the MCL library file from the attachment with the AT89S52, place it in the ..\mikroC PRO for 8051\Uses\ATMEL\ folder instead of the existing (backup just in case) and inform me of the results.
Regards,
Filip.
- Attachments
-
- __Lib_UART_Timer1.rar
- (2.89 KiB) Downloaded 390 times
-
- Posts: 1
- Joined: 21 Nov 2015 12:35
Re: 8051-ready witn 89s52 uart problem
i have same problem.
when i used 11.0592 crystal this problem is solved
please refer data sheet .
when i used 11.0592 crystal this problem is solved
please refer data sheet .
Re: 8051-ready witn 89s52 uart problem
It work fine with baudrate 9600, but not in 19200 or upper.filip wrote:Hi,
Please, try the MCL library file from the attachment with the AT89S52, place it in the ..\mikroC PRO for 8051\Uses\ATMEL\ folder instead of the existing (backup just in case) and inform me of the results.
Regards,
Filip.