《单片机原理与接口技术 (29).pdf》由会员分享,可在线阅读,更多相关《单片机原理与接口技术 (29).pdf(10页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、单片机原理与接口技术:a)b)a)b)ABC1 R4 R5MOVAR5CPLAADDA#1MOVR5AMOVAR4CPLAADDC A#0MOVR4A000EH000FH000EH000FH000EH000FH000EH000FH000EH000FH2000EH000FHMOVXA20HR0R1P2000EH000FH000EH000FHORG 0000HMOV P2,#0H ;P2MOV R0,#0EH ;R0=0EH MOV R1,#0FH;R1=0FHMOVX A,R0 ;A=(000EH)MOV 20H,A ;(20H)=(000EH)MOVX A,R1 ;A=(000FH)XCH A
2、,20H ;A=(000EH),(20H)=(000FH)MOVX R1,A MOV A,20HMOVX R0,A ;SJMP$END3BCDBCDRAM42H0 41H0 40HMOVR0#40HMOVAR0MOVR2AANLA#0FH0INCR0MOVR0A MOVAR2SWAP AANLA#0FHINCR0MOVR0A5:BCD:(d3d2d1d0)BCD=(d310+d2)100+(d110+d0):R5()R4()BCDR5R4(16)BCD4B:ORG2100HMOVA,R5;(A)d3d2(MOVR2,A;(R2)d3d2ACALLBCD2B;1d310+d2AMOVB,64H;
3、(B)100MULAB;(d310+d2)100MOVR6,A;R68XCHA,B;8AMOVR5,A;R58MOVA,R4;(A)d1d0(MOVR2,A;(R2)d1d0ACALLBCD2B;1d110+d0AADDA,R6;(A)(R6)+(A)MOVR4,A;R4168MOVA,R5;(A)(R5)ADDCA,00H;(A)(R5)+8CMOVR5,A;R5168RET;4R1R0R3R2R2R1R0ORG1000HCLRCMOVAR0AADDAR2MOVR0AMOVARlAADDC AR3MOVRlAMOVA#0ADDC A#0MOVR2ASJMP$END6-1RAM20H,00H0
4、5HRAM21HTABDPTRAMOVC AA+DPTRBCDTAB0TAB+11TAB+24TAB+39TAB+416HTAB+525HDPTRAORG 0000HMOV DPTR,#TAB MOV A,20HMOVC A,A+DPTR;MOV 21H,ASJMP$TAB:DB 00H,01H,04H,09H,16H,25H END6-2HEXASCIIHEXORG 0100HHEX EQU 30HHEXASCMOV A,HEX ANL A#00001111BADD A#3 MOVC AA+PCMOV HEXA 2RET1ASCTABDB30H31H32H33H34H35H36H37H38HDB39H41H42H43H44H45H46HEND 启迪智慧思维创造精彩人生