《单片机》读程序题题库.docx
《《单片机》读程序题题库.docx》由会员分享,可在线阅读,更多相关《《单片机》读程序题题库.docx(57页珍藏版)》请在冰豆网上搜索。
![《单片机》读程序题题库.docx](https://file1.bdocx.com/fileroot1/2022-11/30/f0802868-262e-4fbb-becb-baa84499764c/f0802868-262e-4fbb-becb-baa84499764c1.gif)
《单片机》读程序题题库
《单片机原理及应用》读程序题题库
四、阅读下列程序,注释并填写指令执行后的结果(每题10分)
1、ORG0
LJMPSTART
ORG30H
START:
MOVR0,#20H
MOVR1,#30H
MOVA,R0
ADDA,#36H
MOVP1,A
INCR0
INCR1
ANLA,R1
SWAPA
PUSHACC
MOVP1,A
POPB
MOVR0,A
MOVDPTR,#2200H
SETBC
ADDCA,#0
MOVX@DPTR,A
END
(R0)=(R1)=(P1)=
(B)=(2200H)=
2、ORG0
LJMPSTART
ORG30H
START:
MOVSP,#50H
MOVR2,#10H
MOVDPTR,#3000H
CLRA
LOOP:
MOVX@DPTR,A
INCDPTR
DJNZR2,LOOP
INCDPH
INCDPH
MOV20H,#36H
SETB00H
MOVA,20H
MOVX@DPTR,A
INCA
INCA
PUSHACC
XCHA,R2
POPDPH
ADDA,#55H
PUSHACC
END
(A)=(R2)=(20H)=
(DPTR)=(SP)=
3、ORG0
LJMPSTART
ORG30H
START:
MOVR0,#30H
MOVA,#12H
SETBC
ADDCA,R0
MOV@R0,A
SWAPA
INCA
MOVDPTR,#2000H
INCDPH
MOVP1,A
INCA
MOVX@DPTR,A
XCHA,R0
RLA
PUSHACC
RLA
POPACC
END
(A)=(R0)=(DPTR)=
(P1)=(30H)=
4、ORG0
LJMPSTART
ORG30H
START:
MOVSP,#50H
MOVDPTR,#3000H
MOVR0,#20H
MOVA,#23H
MOVR2,#0FH
SETB01H
SETBC
ADDCA,@R0
INCR0
MOV@R0,A
LOOP:
DJNZR2,LOOP
SWAPA
PUSHACC
INCDPH
MOVX@DPTR,A
POPB
RRA
ADDA,B
MOVP1,A
END
(21H)=(R2)=(A)=(B)=(3100H)=
5、ORG0
LJMPSTART
ORG30H
START:
MOVDPTR,#1000H
MOVA,#13H
MOVR0,#20H
SETBC
MOV@R0,A
RLCA
XCHA,@R0
PUSHACC
POPDPL
MOVX@DPTR,A
DECA
PUSHDPH
POPB
ADDA,B
MOVP1,A
CLRA
ADDA,B
END
(P1)=(B)=(20H)=
(DPTR)=(R0)=
6、ORG0
LJMPSTART
ORG30H
START:
MOVSP,#50H
MOVR0,#20H
MOVR2,#10H
MOVA,#24H
LOOP:
MOV@R0,A
INCR0
DJNZR2,LOOP
SETB00H
SETBC
ADDCA,#00H
SWAPA
PUSHACC
POPDPH
PUSHACC
POPB
MOVA,R2
MOVDPL,A
MOVA,B
PUSHACC
END
(A)=(R2)=(20H)=(DPTR)=(SP)=
7、ORG0
LJMPSTART
ORG30H
START:
MOVDPTR,#2100H
CLRA
MOVR1,#30H
SETBC
ADDCA,R1
MOV@R1,A
PUSHACC
POPDPL
RRA
MOVR0,A
ORLA,#24H
MOVP1,A
SWAPA
MOVDPH,A
MOVB,#02H
ADDA,B
CLRACC.3
SWAPA
END
(A)=(R0)=(DPTR)=(P1)=(30H)=
8、ORG0
LJMPSTART
ORG30H
START:
MOVSP,#50H
MOVR3,#10H
CLRA
MOVR0,#20H
LOOP:
MOV@R0,A
INCR0
DJNZR3,LOOP
SETB00H
SETBC
SUBBA,#00H
MOVDPL,A
PUSHACC
MOVA,R3
MOVDPH,A
POPACC
MOVX@DPTR,A
ANLA,#55H
PUSHACC
CLRA
END
(A)=(R3)=(20H)=(DPTR)=(SP)=
9、ORG0
LJMPSTART
ORG30H
START:
MOVR0,#30H
MOVR1,#20H
MOVA,R0
ADDA,#37H
MOVP1,A
INCR0
INCR1
ANLA,R1
SWAPA
PUSHACC
MOVP1,A
SWAPA
POPB
MOVR0,A
MOVDPTR,#2200H
SETBC
ADDCA,B
MOVX@DPTR,A
END
(R0)=(R1)=(P1)=(B)=(2200H)=
10、ORG0
LJMPSTART
ORG30H
START:
MOVSP,#50H
MOVR2,#20H
MOVDPTR,#3000H
CLRA
LOOP:
MOVX@DPTR,A
INCDPTR
DJNZR2,LOOP
INCDPH
INCDPH
MOV20H,#38H
SETB01H
MOVA,20H
MOVX@DPTR,A
INCA
INCA
PUSHACC
XCHA,R2
POPDPH
ADDA,#55H
PUSHACC
END
(A)=(R2)=(20H)=(DPTR)=(SP)=
11、ORG0
LJMPSTART
ORG30H
START:
MOVR0,#20H
MOVA,#31H
SETBC
ADDCA,R0
MOV@R0,A
SWAPA
DECA
MOVDPTR,#2000H
INCDPH
DECDPL
MOVP1,A
INCA
MOVX@DPTR,A
XCHA,R0
RLA
PUSHACC
RLA
POPACC
END
(A)=(R0)=(DPTR)=(P1)=(20H)=
12、ORG0
LJMPSTART
ORG30H
START:
MOVSP,#50H
MOVDPTR,#2000H
MOV20H,#06H
MOVR0,#20H
MOVA,#35H
MOVR2,#10H
SETB00H
SETBC
ADDCA,@R0
INCR0
MOV@R0,A
LOOP:
DJNZR2,LOOP
SWAPA
PUSHACC
INCDPH
MOVX@DPTR,A
POPB
RRA
ADDA,B
MOVP1,A
END
(21H)=(R2)=(A)=(B)=(2100H)=
13、ORG0
LJMPSTART
ORG30H
START:
MOVDPTR,#2000H
MOVA,#36H
MOVR0,#30H
SETBC
MOV@R0,A
RLCA
XCHA,@R0
PUSHACC
POPDPL
MOVX@DPTR,A
DECA
PUSHDPH
POPB
ADDA,B
MOVP1,A
CLRA
ADDA,B
END
(P1)=(B)=(30H)=(DPTR)=(R0)=
14、ORG0
LJMPSTART
ORG30H
START:
MOVSP,#60H
MOVR0,#20H
MOVR2,#10H
MOVA,#24H
LOOP:
MOV@R0,A
INCR0
DJNZR2,LOOP
SETB01H
SETBC
ADDCA,20H
SWAPA
PUSHACC
POPDPH
PUSHACC
POPB
MOVA,R2
MOVDPL,A
ADDA,B
PUSHACC
END
(A)=(R0)=(20H)=(DPTR)=(SP)=
15、ORG0
LJMPSTART
ORG30H
START:
MOVDPTR,#1100H
CLRA
MOV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