proteus simulation: serial communication using two 8051

Thread Starter

deenaa619

Joined Oct 28, 2013
2
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 ???
 

Attachments

absf

Joined Dec 29, 2010
1,968
Rich (BB code):
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
  end
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
 

Attachments

Last edited:
Top