1.
1 Write a program to
toggle port P0 with some delay;
ORG 000H
BACK: MOV A, #55H
MOV P1, A
LCALL DELAY
MOV A, #0AAH
MOV P1,A
LCALL DELAY
SJMP BACK
1.2 program
ORG 30H
DELAY: MOV R5, #0FFH
AGAIN: DJNZ R5, AGAIN
RET
END
2. Write a program to toggle port 1 with a delay which depends
on the value of a number in R0.
ORG 0
START: MOV A,
#0
MOV P1, A
MOV R0, #30H
ACALL DELAY
CPL A
MOV P1, A
MOV R0, #0FFH
ACALL DELAY
SJMP START
ORG 300H
DELAY: NOP
AGAIN: DJNZ R0,
AGAIN
RET
END
3.
Write an assembly
program to toggle ports P0, P1 and a pin P2.3 with some delay using Timer 0 ,
mode 2.
ORG 0
MOV TMOD, #2H
MOV TH0, #06AH
AGAIN: MOV P0,
#00H
SETB P2^3
MOV P1, #55H
ACALL DELAY
; ACALL DELAY
CLR P2^3
MOV P1, #0AAH
MOV P0, #0FFH
ACALL DELAY
SJMP AGAIN
ORG 30H
DELAY: NOP
SETB TR0
BACK: JNB TF0,
BACK
CLR TR0
CLR TF0
RET
4.
WRITE AN ASSEMBLY CODE
FOR SELECTING CUNTER AND DISPLAY THE COUNTER VALUES ON PORT 0
ORG 0
AGAIN: MOV TL1,
#00H
MOV TMOD, #06H
SETB TR1
BACK: MOV P0,
TH1
JNB TF1, BACK
CLR TF1
CLR TR1
SJMP AGAIN
END
5.
Write a program to
receive the data which has been sent in
serial form and send it out to port 0 in parallel form. Also save the data at
RAM location 60H.
ORG 0
MOV TMOD, #20H
MOV TH1, #-3
MOV SCON, #50H
SETB TR1
CLR RI
RPT: JNB RI, RPT
MOV A, SBUF
MOV P0, A
MOV 60H, A
END
6. Write a program to
transfer a letter ‘Y’ serially at 9600 baud continuously, and also to send a
letter ‘N’ through port 0.
ORG 0
MOV TMOD, #20H
MOV TH1, #-3
MOV SCON, #50H
SETB TR1
;CLR RI
AGAIN: MOV
SBUF, #'Y'
RPT: JNB TI,
RPT
CLR TI
;MOV A, SBUF
;MOV P0, A
;MOV 60H, A
MOV P0, #'N'
SJMP AGAIN
END
No comments:
Post a Comment