proteus simulation: serial communication using two 8051

You can post your problem related to Proteus Projects here. We will try our best to help you out.
Post Reply
Josephine
Posts:10
Joined:Sat Feb 25, 2017 8:24 am
proteus simulation: serial communication using two 8051

Post by Josephine » Sat Feb 25, 2017 11:33 am

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 ???

Junaid_Shahid
Posts:110
Joined:Tue Feb 14, 2017 9:00 am

Re: proteus simulation: serial communication using two 8051

Post by Junaid_Shahid » Sat Feb 25, 2017 11:34 am

Josephine wrote:
Sat Feb 25, 2017 11:33 am
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 ???

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.
Recommended: Serial Communication with 8051 Microcontroller in Proteus ISIS

Post Reply