CMOS
Advanced Member level 3
- Joined
- Jan 6, 2004
- Messages
- 862
- Helped
- 94
- Reputation
- 186
- Reaction score
- 50
- Trophy points
- 1,308
- Location
- USA
- Activity points
- 5,673
Hi,
I am using AT89S8252 for my project which uses serial port @ 19.2kbps. The problem I am facing with this uC is that every character I send from uC to serial port is sent twice. No matter what baud rate or configuration I set. For example if I send 'x' it sends 'xx' to PC.
However if I put same code on AT89S52, it works just fine without any problems. Can anyone please help me?
Here is my code.
I am using AS31 assembler available at www.pjrc.com
I tried the same code in C using K*EIL demo but result is same.
Is there any architecture fault in 89S8252? Please help.
Thanks.
I am using AT89S8252 for my project which uses serial port @ 19.2kbps. The problem I am facing with this uC is that every character I send from uC to serial port is sent twice. No matter what baud rate or configuration I set. For example if I send 'x' it sends 'xx' to PC.
However if I put same code on AT89S52, it works just fine without any problems. Can anyone please help me?
Here is my code.
Code:
ORL PCON, #0x80 ; SET DOUBLE BAUD RATE
ANL TMOD, #0x0F ; CLEAR ALL TIMER1 BITS IN TMOD
ORL TMOD, #0x20 ; TIMER1 = 8 BIT AUTO RELOAD
CLR TR1 ; MAKE SURE TIMER1 ISN'T RUNNING
CLR TF1
MOV A, #253
MOV TH1, A ; SET TIMER1 RATE
MOV TL1, A
MOV SCON, #0x50 ; CONFIG SERIAL PORT
SETB TR1 ; START TIMER1
MOV A,#'x'
LCALL COUT
SJMP *
;**************************************************************
; PRINTS CHARACTER IN ACC TO SERIAL PORT
;**************************************************************
COUT: MOV SBUF, A
JNB TI, *
CLR TI ;CLR TI AFTER SENDING
RET
I tried the same code in C using K*EIL demo but result is same.
Is there any architecture fault in 89S8252? Please help.
Thanks.