Serial Communication between 8051 - Assembly Program Code - Proteus Stimulation - Keil
The program is stimulated in proteus, compiled in Keil for 8051 - AT89C51 in assembly language.
Program for serial data transfer between 8051 in assembly language using proteus and uvision,
Flowchart:-
Proteus Stimulation:-
Program:-
TRANSMITTER(U2)
ORG 0000H
SETB P3.0
MOV R0,#00H
WAIT1: MOV TMOD,#20H
MOV SCON,#50H
WAIT:JNB P3.0, WAIT
WAQ: JB P3.0,WAQ
INC R0
MOV A,R0
SETB TR1
AGAIN: MOV SBUF, A
HERE: JNB TI, HERE
CLR TI
SJMP WAIT1
END
RECEIVER PROGRAM(U1)
ORG 0000H
MOV TMOD,#20H
MOV SCON, #50H
MOV A, #38H
ACALL COMNWRT
ACALL DELAY
MOV A, #0EH
ACALL COMNWRT
ACALL DELAY
MOV A,#01H
ACALL COMNWRT
ACALL DELAY
MOV A,#06H
ACALL COMNWRT
ACALL DELAY
MOV A, #80H
ACALL COMNWRT
ACALL DELAY
MOV DPTR,#DATA1N
REQ:CLR A
MOVC A,@A+DPTR
ACALL DATA1
ACALL DELAY
JZ RE11
INC DPTR
SJMP REQ
RE11:SETB TR1
CLR RI
RPT: JNB RI, RPT
MOV A, SBUF
MOV R1,A
NEX: MOV A, R1
MOV B, #0AH
DIV AB
MOV R2,B
MOV B,#0AH
DIV AB
MOV R3, B
MOV R4, A
MOV A,#086H
ACALL COMNWRT
MOV A,#48
ORL A, R4
ACALL DATA1
MOV A, #48
ADD A, R3
ACALL DATA1
MOV A,#48
ADD A,R2
ACALL DATA1
ACALL DELAY
SJMP RE11
COMNWRT: MOV Pl, A
CLR P2.0
SETB P2.1
ACALL DELAY
CLR P2.1
RET
DATA1: MOV P1, A
SETB P2.0
SETB P2.1
ACALL DELAY
CLR P2.1
RET
DELAY: MOV R6, #50
HERE 2: MOV R7, 25
HERE: DJNZ R7, HERE
DJNZ R6, HERE2
RET
ORG 300H
DATA1N: DB "COUNT ",0H
END
For more ASM programs - click here