资源描述:
《《单片机》读程序题题库答案.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、四、阅读下列程序,注释并填写指令执行后的结果(每题10分)1、ORG0LJMPSTART;跳转到(PC)=0030H处ORG30HSTART:MOVR0,#20H;#20H->R0(R0)=20HMOVR1,#30H;#30H->R1(R1)=30HMOVA,R0;(R0)->A(A)=20HADDA,#36H;(A)+#36H->A(A)=56HMOVP1,A;(A)->P1(P1)=56HINCR0;(R0)+1->R0(R0)=21HINCR1;(R1)+1->R0(R1)=31HANLA,R1;(A)&(R
2、1)->A(A)=10HSWAPA;累加器A的高低4位交换(A)=01HPUSHACC;累加器A内容压栈MOVP1,A;(A)->P1(P1)=01HPOPB;堆栈内容出栈到B寄存器(B)=01HMOVR0,A;(A)->R0(R0)=01HMOVDPTR,#2200H;#2200H->DPTR(DPTR)=2200HSETBC;1->Cy(Cy)=1ADDCA,#0;(A)+0+(Cy)->A(A)=02HMOVX@DPTR,A;(A)->(DPTR)(2200H)=02HEND(R0)=01H(R1)=31H(
3、P1)=01H(B)=01H(2200H)=02H2、ORG0LJMPSTART;跳转到(PC)=0030H处ORG30HSTART:MOVSP,#50H;#50H->SP(SP)=50H第57页共57页MOVR2,#10H;#10H->R2(R2)=10HMOVDPTR,#3000H;#3000H->DPTR(DPTR)=3000HCRLA;0->A(A)=0LOOP:MOVX@DPTR,A;(A)->(DPTR)INCDPTR;(DPTR)+1->DPTRDJNZR2,LOOP;(R2)-1->R2若(R2)不
4、等于零则转移到LOOP处INCDPH;(DPH)+1->DPH(DPH)=31H(R2)=00H(DPL)=10HINCDPH;(DPH)+1->DPH(DPH)=32HMOV20H,#36H;#36H->(20H)(20H)=36HSETB00H;位地址00H置120H.0=1(20H)=37HMOVA,20H;(20H)->A(A)=37HMOVX@DPTR,A;(A)->(DPTR)(DPTR)=3210H(3210H)=37HINCA;(A)+1->A(A)=38HINCA;(A)+1->A(A)=39HP
5、USHACC;累加器A内容压栈(SP)=51HXCHA,R2;累加器A的内容与R2内容互换(A)=00H(R2)=39HPOPDPH;堆栈内容弹到DPH(DPH)=39HADDA,#55H;(A)+#55H->A(A)=55HPUSHACC;累加器A内容压栈END(A)=55H(R2)=39H(20H)=37H(DPTR)=3910H(SP)=51H3、ORG0LJMPSTART;跳转到(PC)=0030H处ORG30HSTART:MOVR0,#30H;#30H->R0(R0)=30HMOVA,#12H;#12H-
6、>A(A)=12HSETBC;(Cy)=1ADDCA,R0;(A)+(R0)+Cy->A(A)=43HMOV@R0,A;(A)->(R0)(30H)=43H第57页共57页SWAPA;累加器A高低4位交换(A)=34HINCA;(A)+1->A(A)=35HMOVDPTR,#2000H;#2000H->DPTR(DPTR)=2000HINCDPH;(DPH)+1->DPH(DPH)=21HMOVP1,A;(A)->P1(P1)=35HINCA;(A)+1->A(A)=36HMOVX@DPTR,A;(A)->(DPT
7、R)(2100H)=36HXCHA,R0;(A)óR0(A)=30H(R0)=36HRLA;累加器A内容循环左移(A)=60HPUSHACC;累加器A的内容入栈RLA;累加器A内容循环左移(A)=0C0HPOPACC;堆栈内容弹出到累加器A(A)=60HEND(A)=60H(R0)=36H(DPTR)=2100H(P1)=35H(30H)=43H4、ORG0LJMPSTART;跳转到(PC)=0030H处ORG30HSTART:MOVSP,#50H;#50H->SP(SP)=50HMOVDPTR,#3000H;#3
8、000H->DPTR(DPTR)=3000HMOVR0,#20H;#20H->R0(R0)=20HMOVA,#23H;#23H->A(A)=23HMOVR2,#0FH;#0FH->R2(R2)=0FHSETB01H;置位20H.1(20H.1)=1SETBC;置位Cy(Cy)=1ADDCA,@R0;(A)+((R0))+Cy->A(A)=26HINCR0;(