资源描述:
《汇编小编程答案知识分享.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、汇编小编程答案精品文档综合一、简单小程序编制:注:所有多字节数的低字节都在低地址;R0或R1均指向内部RAM的最低字节。1、将30H、31H单元内容与T0计数器的TL0、TH0交换。保持其它R和M不变。解:MOVA,R0XCHA,30HMOVTL0,AMOVA,TH0XCHA,31HMOVTH0,A2、将30H、31H单元内容与5C30H、5C31H交换。保持其它R和M不变。解:MOVDPTR,#5C30HMOVXA,@DPTRXCHA,30HMOVX@DPTR,AINCDPTRMOVXA,@DPTRXCHA,31HMOVX@DPTR,A3、
2、将30H、31H单元内容与R0指向的两字节单元交换。保持其它R和M不变。解:MOVA,@R0XCHA,30HMOV@R0,AINCR0MOVA,@R0XCHA,31HMOV@R0,A4、将30H、31H单元内容与DPTR指向的两字节单元交换。保持其它R和M不变。解:MOVXA,@DPTRXCHA,30HMOVX@DPTR,AINCDPTRMOVXA,@DPTRXCHA,31HMOVX@DPTR,A5、将30H、31H单元内容存入5C30H、5C31H单元。保持其它R和M不变。解:MOVA,30HMOVDPTR,#5C30HMOVX@DPTR,
3、AMOVA,31HINCDPTRMOVX@DPTR,A6、将30H、31H单元内容加上数03C4H后存入5C30H、5C31H单元。解:MOVA,30HADDA,#0C4HMOVDPTR,#5C30HMOVX@DPTR,AMOVA,31HADDCA,#03HINCDPTRMOVX@DPTR,A7、将30H、31H单元内容减去数03C4H后存入5C30H、5C31H单元。解:CLRCMOVA,30HSUBBA,#0C4HMOVDPTR,#5C30HMOVX@DPTR,AMOVA,31HSUBBA,#03HINCDPTRMOVX@DPTR,A8、
4、将30H、31H单元内容除以2后存入5C30H、5C31H单元。解:MOVA,31HCLRCRRCAMOVDPTR,#5C31HMOVX@DPTR,AMOVA,30HRRCAMOVDPTR,#5C30HMOVX@DPTR,A9、将30H、31H单元内容乘以2后存入5C30H、5C31H单元。收集于网络,如有侵权请联系管理员删除精品文档解:MOVA,30HCLRCRLCAMOVDPTR,#5C30HMOVX@DPTR,AMOVA,31HRLCAINCDPTRMOVX@DPTR,A10、将30H、31H单元内容减1。保持其它R和M不变。解:MOV
5、A,30HJNZL0DEC31HSJMP$L0:DEC30H11、将30H、31H单元内容加1。保持其它R和M不变。解:INC30HMOVA,30HJNZOKINC31HOK:……………..12、将外部RAM中的5C30H、5C31H单元内容乘以2。保持其它R和M不变。解:MOVDPTR,#5C30HCLRCMOVXA,@DPTRRLCAMOVX@DPTR,AINCDPTRMOVXA,@DPTRRLCAMOVX@DPTR,A13、将外部RAM中的5C30H、5C31H单元内容除以2。保持其它R和M不变。解:MOVDPTR,#5C31HCLRC
6、MOVXA,@DPTRRRCAMOVX@DPTR,ADECDPLMOVXA,@DPTRRRCAMOVX@DPTR,A14、将30H的低半字节和31H单元的高半字节交换。解:MOVA,31HSWAPAMOVR0,#30HXCHDA,@R0SWAPAMOV31H,A15、将30H的高半字节和31H单元的高半字节交换。解:MOVA,30HXCHA,31HMOVR0,#31HXCHDA,@R0MOV30H,A16、将30H、31H单元的4位16进制数的中间两位数交换。解:MOVA,30HSWAPAMOVR0,#31HXCHDA,@R0SWAPAMOV
7、30H,AMOVA,@R0MOV31H,A17、如果INT0为低,则位30H改为它的值与P0口最低位的“反”相“与”后的值;否则,清30H位。解:JBP3.2,L0MOVC,30HANLC,/P0.0MOV30H,CSJMP$L0:CLR30H18、如果INT0为低,则位30H改为它的值与P0口最高位的“反”相“或”后的值;否则,清30H位。解:JBP3.2,L0MOVC,30HOPLC,/P0.7MOV30H,C收集于网络,如有侵权请联系管理员删除精品文档SJMP$L0:CLR30H19、如果INT0为高,则,位30H改为它的值与P0口最低
8、位相“或”后的值;否则,取反30H位。解:JNB30H,L0MOVC,30HORLC,P0.0MOV30H,CSJMP$L0:CPL30H20、如果INT0为低,则