MOV TMOD,#20H
MOV TH1,#0faH
MOV SCON,#050H
SETB TR1
START: MOV A,#'M'
ACALL F1
MOV A,#'e'
ACALL F1
MOV A,#'s'
ACALL F1
MOV A,#'s'
ACALL F1
MOV A,#'a'
ACALL F1
MOV A,#'g'
ACALL F1
MOV A,#'e'
ACALL F1
SJMP START
F1: MOV SBUF,A
HERE:JNB TI,HERE
CLR TI
RET
Saturday, 8 October 2016
To perform MESSAGE PASSING in 8051 Programming
Check if 5AH is located is located in any one of the locations.If yes load acc. by 5AH.
START: MOV R0,#5FH
MOV R7,#10H
COMPIT: CJNE @R0,#5AH,NEXT
MOV A,#5AH
SJMP FOUND
NEXT: DEC R0
DJNZ R7,COMPIT
NOMATCH : MOV A,#00H
FOUND : SJMP FOUND
Copy a block of 20bytes of data from 60h to 73h to the location starting from 40h.
START: MOV R0,#60H
MOV R1,#40H
MOV R7,#14H
COPYIT: MOV A,@R0
MOV @R1,A
INC R0
INC R1
DJNZ R7,COPYIT
OVER: SJMP OVER
Program to shift a block of 8 bytes data,from 50h to 57h,1 byte up data is available from 51H to 58H
START: MOV R0,#57H
MOV R1,#58H
MOV R7,#08H
SHIFT: MOV A,@R0
MOV @R1,A
DEC R0
DEC R1
DJNZ R7,SHIFT
OVER :SJMP OVER
Subscribe to:
Posts (Atom)