Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Interfacing two Pc's by using 89c51 microcontroller and MAX232... Need Help

Status
Not open for further replies.

adilaslam

Newbie level 1
Joined
Dec 29, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
I am new in microcontroller world, want to interface two PC's using MAX232 and 89c51 microcontroller for Simplex Serial port communication and Bi-directional communication.

However, Simplex communication is working through microcontroller on hyper terminal, what should be the code to interface Bi-Directionally.

Thanks in advance.
 

naeem.iu

Newbie level 2
Joined
Dec 8, 2012
Messages
2
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,303
I am new in microcontroller world, want to interface two PC's using MAX232 and 89c51 microcontroller for Simplex Serial port communication and Bi-directional communication.

However, Simplex communication is working through microcontroller on hyper terminal, what should be the code to interface Bi-Directionally.

Thanks in advance.


Bi-Directional Code in assembly for 8051 Micro-controller.
I have the Simplex Serial communication code for assembly language...its very simple


Simplex Serial Communication code to receive data from Serial Buffer and send it to Port 2.

Baud-rate:

mov scon,#50h ; Initialize serial communication
mov TMOD,#20h ; Timer 1 Mode 2
mov TH1,#0fdh ; For 9600 baud-rate
setb TR1 ; Start Timer 1
ret


HERE:
JNB RI,HERE ; Wait for char to come in
MOV A,SBUF ; Save incoming byte in Register A
MOV P2,A ; Move the contents of A at P2
CLR RI ; Get ready to receive next byte
SJMP HERE ; Keep getting data

END

This Code is for Other Device that Receive Data from Port 2 and Send it to SBUF


MOV TMOD,#20H ; Timer 1, Mode 2 (Auto-Reload)
MOV TH1,#0FDH ; Baud-Rate = 9600
MOV SCON,#50H ; 8-bit, 1 stop bit, REN enabled
SETB TR1 ; Start Timer 1

AGAIN:
MOV A,P2 ; Receive contents from P2 to A
ACALL TRANS
SJMP AGAIN ; Keep doing it

;-------Serial Data Transfer Subroutine

TRANS:
MOV SBUF,A ; Move contents of A in SBUF

HERE:
JNB TI,HERE ; Wait for last bit to transfer
CLR TI ; Get ready for next byte
RET

END
 

    V

    points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top