proteus simulation: serial communication using two 8051

Discussion in 'Embedded Systems and Microcontrollers' started by deenaa619, Oct 28, 2013.

  1. deenaa619

    Thread Starter New Member

    Oct 28, 2013
    2
    0
    hi i am trying to do a proteus simulation of serial communication of two microcontrollers as shown in the attachment but unable to do it..as the optocoupler connected to it does not work and there is no sign of signal in the TxD pin and the led glows automatically in simulation.
    the logic i want to do is i want to send a letter say 'D' serially from microcontroller 1 and if i receive the same in the microcontroller 2 i want the led to glow.
    the coding i used is
    micro 1:
    org 0000h
    mov a,#00h
    mov p1,a
    mov p3,a
    halt:
    jb p1.0,abb
    sjmp halt
    abb:
    mov TMOD,#20h
    mov TH1,#-3
    mov SCON,#50h
    setb TR1
    mov SBUF,#'D'
    here: jnb TI,here
    ret

    micro2:
    org 0000h
    mov a,00h
    mov p1,a
    mov p3,a
    mov TMOD,#20h
    mov TH1,#-3
    mov SCON,#50h
    setb TR1
    clr RI
    rpt:jnb RI,rpt
    mov a,SBUF
    cjne a,44h,next
    next:setb p3.1
    end
    could not find where wrong ???
     
  2. absf

    Senior Member

    Dec 29, 2010
    1,493
    372
    Code ( (Unknown Language)):
    1. micro 1:
    2.   org 0000h
    3.   mov a,#00h
    4.   mov p1,a
    5.   mov p3,a
    6. halt:
    7.   jb p1.0,abb
    8.   sjmp halt
    9. abb:
    10.   mov TMOD,#20h
    11.   mov TH1,#-3
    12.   mov SCON,#50h
    13.   setb TR1
    14.   mov SBUF,#'D'
    15. here: jnb TI,here
    16.   ret
    17.   end
    18.  
    If I remember correctly, you have to put a logic high on the port pin to make it an input. But you're setting both ports to output, so that's why your button switch is not detected.

    On the hardware, I think you also have to pull high the switch input using a 10K resistor. Why don't you use the Virtual Terminal from ISIS to monitor the ASCII sent from micro1. It would be much easier to debug one micro at a time so you know which one is not working properly.

    Allen
     
    Last edited: Oct 29, 2013
  3. deenaa619

    Thread Starter New Member

    Oct 28, 2013
    2
    0
    how to get this virtual terminal..
     
  4. absf

    Senior Member

    Dec 29, 2010
    1,493
    372
    It's under the "INSTRUMENT" icon where you get your oscilloscope and voltmeters.

    Allen
     
Loading...