This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Serial communication issue with AT89S52

Hi,
I am trying to perform serial communication with two AT89S52 MCs. Now the problem is that sometime everything works fine, but sometimes not.
------ Hardware Config--------
---> RC reset circuit
---> 11.0592 MHz crystal
---> Mode 1 for serial communication with 9600 baudrate
---> Port 2 as output port at receiver side

Hardware is working fine with simple programs like LED blinking, but when it comes to serial communication, nah ..........behaves randomly....
Any suggestion will be valuable for me.

Parents
  • my mistake...
    extremely sorry about that

    ; Written in assembly using keil
    ; Codes for transmitter
    org 00h
    mov tmod,#20h ; timer 1 in auto reload mode
    mov th1,#0fdh ; for baudrate 9600
    mov scon,#50h ; for selection of mode 1 with REN set to 1
    setb tr1
    start: mov sbuf,#0fh ; as leds are connected at port 2 with pins 0,2,4,6
    next: jnb ti,next
    clr ti
    sjmp start
    end
    
    ; Codes for transmitter
    org 00h
    mov tmod,#20h ; timer 1 in auto reload mode
    mov th1,#0fdh ; for baudrate 9600
    mov scon,#50h ; for selection of mode 1 with REN set to 1
    setb tr1
    mov p2,#00h
    start: jnb ri,start
    mov a,sbuf
    mov p2,a
    clr ri
    sjmp start
    end
    
    

Reply
  • my mistake...
    extremely sorry about that

    ; Written in assembly using keil
    ; Codes for transmitter
    org 00h
    mov tmod,#20h ; timer 1 in auto reload mode
    mov th1,#0fdh ; for baudrate 9600
    mov scon,#50h ; for selection of mode 1 with REN set to 1
    setb tr1
    start: mov sbuf,#0fh ; as leds are connected at port 2 with pins 0,2,4,6
    next: jnb ti,next
    clr ti
    sjmp start
    end
    
    ; Codes for transmitter
    org 00h
    mov tmod,#20h ; timer 1 in auto reload mode
    mov th1,#0fdh ; for baudrate 9600
    mov scon,#50h ; for selection of mode 1 with REN set to 1
    setb tr1
    mov p2,#00h
    start: jnb ri,start
    mov a,sbuf
    mov p2,a
    clr ri
    sjmp start
    end
    
    

Children