8051-ready witn 89s52 uart problem

General discussion on mikroC PRO for 8051.
Post Reply
Author
Message
xyar2003
Posts: 18
Joined: 02 Oct 2012 06:57

8051-ready witn 89s52 uart problem

#1 Post by xyar2003 » 04 Sep 2013 20:19

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);
}
}

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: 8051-ready witn 89s52 uart problem

#2 Post by filip » 05 Sep 2013 08:28

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.

xyar2003
Posts: 18
Joined: 02 Oct 2012 06:57

Re: 8051-ready witn 89s52 uart problem

#3 Post by xyar2003 » 08 Sep 2013 19:27

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.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: 8051-ready witn 89s52 uart problem

#4 Post by filip » 09 Sep 2013 12:30

Hi,

Do you any other MCU that you can try ?
Could you attach here this project ?

Regards,
Filip.

omjani
Posts: 1
Joined: 19 Nov 2013 05:51

Re: 8051-ready witn 89s52 uart problem

#5 Post by omjani » 19 Nov 2013 05:56

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.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: 8051-ready witn 89s52 uart problem

#6 Post by filip » 19 Nov 2013 09:46

Hi,

Which development system are you using ?
Could you attach here the project that you are using ?

Regards,
Filip.

Dino2090
Posts: 1
Joined: 29 Jan 2014 14:45

Re: 8051-ready witn 89s52 uart problem

#7 Post by Dino2090 » 29 Jan 2014 14:58

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.

xyar2003
Posts: 18
Joined: 02 Oct 2012 06:57

Re: 8051-ready witn 89s52 uart problem

#8 Post by xyar2003 » 07 Feb 2014 14:46

At89c52 never worked but i used other MCUs such as at89s2051 and everything works correctly.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: 8051-ready witn 89s52 uart problem

#9 Post by filip » 10 Feb 2014 14:55

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.
Attachments
__Lib_UART_Timer1.rar
(2.89 KiB) Downloaded 389 times

e4emerging@gmail.com
Posts: 1
Joined: 21 Nov 2015 12:35

Re: 8051-ready witn 89s52 uart problem

#10 Post by e4emerging@gmail.com » 21 Nov 2015 12:38

i have same problem.
when i used 11.0592 crystal this problem is solved
please refer data sheet .

JohnnyDam
Posts: 1
Joined: 03 Dec 2015 10:14

Re: 8051-ready witn 89s52 uart problem

#11 Post by JohnnyDam » 03 Dec 2015 10:18

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.
It work fine with baudrate 9600, but not in 19200 or upper.

Post Reply

Return to “mikroC PRO for 8051 General”