《单片机原理与接口技术 (24).pdf》由会员分享,可在线阅读,更多相关《单片机原理与接口技术 (24).pdf(11页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、单片机原理与接口技术MCS-5129ADD4ADDC4SUBB4MUL()DIVINC1DEC110124241717MOV MOVA#datadirectRiRnA#dataA(direct)A(Ri)A(Rn)22111111Rn#datadirectARn#dataRn(direct)Rn(A)221121direct#dataAdirectRiRndirect#datadirect(A)direct(direct)direct(Ri)direct(Rn)3232221221Ri#datadirectA(Ri)#data(Ri)(direct)(Ri)(A)221121MOV ARn A
2、(Rn)n=07 MOV Adirect A(direct)MOV ARi A(Ri)i=01MOV A#data AdataMOV Rn,direct Rn(direct)MOV Ri,direct (Ri)(direct)MOV direct1direct2 direct1(direct2)MOV DPTR#data16 DPTRdata161161A=30H(4FH)=30HR0=20H(20H)=30H(21H)=30HMOV A#30H MOV 4FHA MOV R0#20H MOV R04FH MOV 21H20H RAM 60HA2MOV A,60HMOV A,#60HMOV R
3、0#60H MOV AR0MOV R060HMOV AR060H32H32H58H1.MOV R1R2MOV R2R02.R0R1MOV AR23.SFRMOV R0#80HMOV AR0MOV#80HR2(2000H)(2100H)AMOVX DPTR1664KBRAMMOVX ADPTRA(DPTR)MOVX DPTRA(DPTR)(A)Ri8256BRAMMOVXARiA(Ri)MOVXRiA(Ri)(A)MOVX A2000H MOVX 2100H2000HDPTR=2000HA=XDPTR=2100H(2100H)=XMOV DPTR#2000HMOVX ADPTRMOV DPTR#
4、2100HMOVX DPTRAA1.DPTRMOVCAA+DPTRA(A+DPTR)64KB ROM2.PCMOVC AA+PC A(A)+(PC)+1)256BY=X2X(0X15)RAM20HYRAM21HSQU:MOV DPTR#TAB MOV A20HX)MOVC AA+DPTRY=X2MOV 21HAYRETORG 3000HTAB:DB 00010409225ORG 1000HY=X2X(0X15)RAM20HYRAM21HORG 1000H 1000H SQU:MOV A20HX1002H ADD A#3 1004HMOVC AA+PCY=X21005HMOV 21HA1007H
5、RET1008H TAB:DB 000104 100BHDB 09225 A=02B=56HSP=?A=?B=?SPSP56HSPSP0202HA00H02H00H02HSPSP56H0202HSPSPSPSP02PUSH n SP SP+1(SP)(n)POP n (n)(SP)SP SP-130H02H56HSBRMOV SP#30H PUSH ACCPUSH BMOV A#0MOV B#01POP BPOP ACC()RAM1.XCH ARn A RnXCH ARiA(Ri)XCH Adirect A(direct)2.XCHD ARi A03 (Ri)03 SWAP AA47 A03A
6、=29HXCH A2AHA=?(2AH)=?38H29H29HRAM 2AH2BHBCDBCD20HMOV A#0 MOV R0#2AH MOV R1#2BHXCHD AR0SWAP AXCHD AR1XCH A20H1.MOV A#1000H A1000H2.MOVX A1000HA(1000H)RAM3.MOVC A1000H A(1000H)ROM4.MOVX 60HARAM(60H)A5.MOV R060HRAM(61H)(60H)MOV 61HR06.XCH R1R2R1R27.MOVX DPTR#2000H DPTR2000H8.MOVX 60HDPTR RAMRAM1.MOV DPTR#1000H 2.MOV DPTR#1000H MOVX ADPTR 3.MOV DPTR#1000H MOV A,#0 MOVC AA+DPTR4.MOV R0#60H MOVX AR0 5.MOV R0,#60H MOV 61H,R06.XCH AR1 XCH AR2 7.MOV DPTR#2000H 8.MOVX A,DPTR MOV 60H,A启迪智慧思维创造精彩人生