资源描述:
《单片机原理及应用 教学课件 作者 佟云峰机械工业单片机书稿第三章参考答案.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、部分习题参考答案第三章8题:ORG0000HMOVR1,#80HMOVXA,@R1MOV2BH,AEND9题:ORG0000HMOVR1,#40HMOVXA,@R1XCHA,R0MOVX@R1,AEND10题:(A)=57HCY=1P=1AC=1OV=1(A)=3BHCY=0P=1AC=1OV=011题:L2,L212题:(R0)=0FAH13题:ORG0000HMOVDPTR,#30HMOVXA,@DPTRMOVB,AINCDPTRMOVXA,@DPTRMULABMOV33H,AMOV32H,BEND14题:ORG0000HMOVA,2
2、0HANLA,#0FHADDA,#30HMOV21H,AMOVA,20HSWAPAANLA,#0FHADDA,#30HMOV22H,AEND15题:解一ORG0000HMOVA,R3ANLA,#0FHADDA,#30HCJNEA,#3AH,NEXT1SJMPNEXT2NEXT1:JCNEXT3NEXT2:ADDA,#07HNEXT3:MOVDPTR,#2000HMOVX@DPTR,AEND解二ORG0000HMOVA,R3ANLA,#0FHADDA,#30HCJNEA,#39H,NEXT1SJMPNEXT3NEXT1:JCNEXT3ADD
3、A,#07HNEXT3:MOVDPTR,#2000HMOVX@DPTR,AEND解三ORG0000HMOVA,R3ANLA,#0FHADDA,#30HMOVR1,ACLRCSUBBA,#3AHMOVA,R1JCNEXTADDA,#07HNEXT:MOVDPTR,#2000HMOVX@DPTR,AEND16题:ORG0000HMOVA,30HMOVB,#64HDIVABMOV40H,AMOVA,BMOVB,#0AHDIVABMOV41H,BSWAPAORLA,41HMOV41H,AEND18题:ORG0000HCLRCMOVA,21HRRC
4、AMOV21H,AMOVA,20HRRCAMOV20H,AMOV0FH,C;若为循环右移一位用。END19题:ORG0000HMOVA,R6CPLAADDA,#01HMOVR6,AMOVA,R7CPLAADDCA,#00HMOVR7,AEND23题:ORG0000HMOVR0,#35HMOVDPTR,#3000HMOVR2,#21HLOOP:MOVA,@R0MOVX@DPTR,AINCR0INCDPTRDJNZR2,LOOPEND24题:ORG0000HMOVA,5AHCJNEA,#0AH,NEXT1NEXT0:ADDA,5AHADDA,
5、#08HSJMPEXITNEXT1:JNCNEXT2MOVB,AMULABDECASJMPEXITNEXT2:CJNEA,#0FH,NEXT3SJMPNEXT0NEXT3:JCNEXT0MOVA,#29HEXIT:MOV5BH,AEND25题:ORG0000HMOVR0,#50HMOVA,#00HMOVR2,#08HLOOP:ADDA,@R0INCR0DJNZR2,LOOPMOVB,#08HDIVABMOV5BH,AEND27题:ORG0000HMOVR0,#30HMOVDPTR,#2000HMOVR2,#0FHLOOP0:MOVXA,@
6、DPTRMOV@R0,AINCR0INCDPTRDJNZR2,LOOP0MOVR0,#30HMOVDPTR,#2100HMOVR2,#0FHCLRCLOOP1:MOVXA,@DPTRADDCA,@R0MOV@R0,AINCR0INCDPTRDJNZR2,LOOP1MOVR0,#30HMOVDPTR,#2200HMOVR2,#0FHLOOP2:MOVA,@R0MOVX@DPTR,AINCR0INCDPTRDJNZR2,LOOP2END28题:ORG0000HMOVR0,#30HMOVDPTR,#2000HMOVR2,#32HLOOP0:MO
7、VXA,@DPTRMOV@R0,AINCR0INCDPTRDJNZR2,LOOP0MOVR7,#31HLOOP1:MOVR0,#30HMOVR1,#30HMOVA,R7MOVR6,ALOOP2:MOVA,@R0INCR1MOV20H,@R1CJNEA,20H,NEXT1NEXT1:JCNEXT2XCHA,@R1MOV@R0,ANEXT2:INCR0DJNZR6,LOOP2DJNZR7,LOOP1MOVR0,#30HMOVDPTR,#2200HMOVR2,#0FHLOOP3:MOVA,@R0MOVX@DPTR,AINCR0INCDPTRDJ
8、NZR2,LOOP3END29题:ORG0000HMOVR0,#00H;放奇数个数MOVR1,#00HMOVDPTR,#2000HMOVR2,#64HLOOP2:MOVXA,@DPTRJNBA