Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

wanna transmit and receive data serially using two 8051(AT89c51)

Status
Not open for further replies.

deenaa619

Newbie level 2
Newbie level 2
Joined
Oct 28, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
18
hi this is the logic i wanna implement when i press a button 1 in microcontroller 1 is pressed it must send a data serially say 'D' to microconroller 2 and then when it receives makes a check in microcontroller2 and make an led glow i have tried to do this in proteus but not ablr to get the output i have attached the proteus circuit and the coding is
mic2:
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

mic1:
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
here the bug iam facing is neither the optocoupler or the txd pin not showing any response, do help..
 

Attachments

  • Untitled.png
    Untitled.png
    178.2 KB · Views: 93

but iam using no interrupt here, as the interrupt pin is p3.2,p3.3
then how would i receive data? correct me if i am wrong
 

There's no need to use an interrupt.

The code has several errors, however.

For the sender, you must not use ret, instead jmp back to the main loop.

For the receiver, it will set the P3.1 for any received character and never reset it. The code runs into "nirwana", there must be jmp instruction before end.

There might be more software errors, you'll preferably test code execution in a simulator, e.g. Proteus.

Also the hardware doesn't work. A MOC3021 isn't suited as a digital optocoupler. 8051 outputs are only sourcing µA currents in "1" state and can never drive an optocoupler or LED in high state. A 39 pF capacitor can't work as reset generator. #PSEN must be pulled low to activate internal code memory. (I don't know if Proteus will mind the latter errors).
 

Try these .

In the transmitter section You check for a swithch in Port1 and also you made Port1 =00h."To make an 8051 pin input you should make it high".

Remove the following line from transmitter code then it should be working.(Examine the code and understand Where it got stuck)
Code:
mov a,#00h
mov p1,a
mov p3,a

Also remove the same lines from the reciever code and add CLR p3.1 instead.
Yo made a mistake in
Code:
cjne a,44h,next

actually that is
Code:
cjne a,#44h,next
or
Code:
cjne a,#'D',next


There are no other problem with your problem.


note that after the following change P3.1 will be always high,ie code is working .Better use a loop at the reciver side and complement pin for better visual treatment
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top