单片机原理与接口技术 (26).pdf
单片机原理与接口技术A=01B10A?1A402R2XRLA#0C0HAD7D6ORLA#03HAD1D01ANLA#0E7HAD4D30A=100011BA1.A0CLR A A02.ACPL A A/A3.8RL A ARR A A9RLC ACyRRC ACyRL ARR ARLC ARRC AA.0A.7A.0A.7A.0A.7A.0A.7CYCYR6R5 XACYCYA0A0A7A7CYCYA0A0A7A7A AA APSWPSWPSWPSWRRC ARRC ASFRSFRRR ARR ASFRSFRA0A0A7A7CYCYA0A0A7A7CYCYA AA APSWPSWPSWPSWRLC ARLC ASFRSFRRL ARL ASFRSFR9R6R5XCLRCMOVAR5RLCAMOVR5AMOVAR6RLCAMOVR6ACy=0R6=55H R5=AAHR6=01010101R5=10101010Cy=0R6=01010101R5=10101010Cy=0R6=10101011R5=01010100Cy=0CLR CCy 0CLR 40H40H001CLRSETBCPLANLORL(Cy)=0(40H)=1ANL C/40H Cy=(40H)=40HF0ACC.0ANL C40H CC(40H)ANL C/40H CC/(40H)01PCCPUnnPC nnePC PC+e 1000H LJMP 2000H1003H 2000H 1000H SJMP 02 1004H 1.LJMPaddr16PC addr1664KBaddr16LOOPLOOP12.AJMP addr11 PC PC+2PC100 addr11PC15112KB(PC)+2AJMPPC)2KBLJMPPC=0000HPC=AAAAH0000H0001HAAA9HAAAAH0002HPC0000H64 KBPC低11位程序计数器PCPC高5位(保持不变)AJMP addr11 PC+2PCaddr11PC.10PC.0AJMP07FEHAJMP K11 ;K110800H0FFFH0800H .0E00HK11.0F80HK120FFEHAJMPK12 1000H.A10A9A800001A7A6A5A4A3A2A1A0操作码(第一字节)操作数(第二字节)113.SJMP relPC PC+2PC PC+rel80Hrelrel8128127relrel=-(+)=-PCLJMP NEXT AJMP NEXT SJMP NEXTNEXTe HERESJMP HERE;HERESJMP$2130HSJMP NEXT 2150HNEXTMOV AR2=2150H-(2130H+2)=001EH8e=1EH4.()JMP A+DPTR.PC A+DPTR64KBX(0XFH)XRAM40HX=0FUNC0X=1FUNC1KEY:MOV DPTR,#KTABMOV A,40HADD A,AJMP A+DPTRKTAB:AJMP FUNC0 AJMP FUNC1FUNC0:FUNC1:1.2.CyJNC eCy=0Cy=1JC eCy=1Cy=0JZ ePCPC+2JNZ ePCPC+2A00HA=00HPCPC+e()A00HPC()PCPC+e()A=00HPC()3.JB bite (b)=1JNB bite (b)=04.0JBC bite (b)=1,b 04.0CJNE 12eCJNE Ane PC(PC)+3A(n)PC(PC)+e(A)(n)Cy0(A)(n)Cy1(A)=(n)PC(Cy)=0128127R435H35H35HCJNE R4,#35HNEQ;R4 35HEQ;R4=35HNEQ:JC LESS R4 35HLESS:R4 35H6.DJNZ eDJNZ Rne PC(PC)+2R2(R2)-1(Rn)0PCPC+e(Rn)=0PCRAM70H16RAM 1000H16100MOVR7,#16;R7MOVR0,#70H;R0MOVDPTR,#1000H;LOOP:MOVA,R0;RAMMOVX DPTR,A;RAMINCR0;INCDPTR;DJNZR7,LOOP;MOV R2#100 LOOPDJNZ R2LOOP1.2.()ACALL addr11PC(PC)+2SP(SP)+1(SP)(PCL)SP(SP)+1(SP)(PCH)PC100 addr11PC1511addr11.2KBLCALL nn;PC(PC)+3,64KB;SP(SP)+1(SP)(PCL);SP(SP)+1(SP(PCH);PC nnnn3.RETPCH(SP)SP(SP)-1PCL(SP)SP(SP)-1RETPC4.RETI PCH(SP)SP (SP)-1PCL(SP)SP (SP)-1RETIPC5.NOP PC (PC)+1CPURAMCybit1.MOV Cb Cy(b)MOV bC (b)Cy20H30HMOV C20HMOV 30HC2.01CLRSETBCPLCLR C Cy 0CLR 40H(40H)01.“MOV”:RAM“MOVX”:RAMA“MOVC”:ROMA2.Rii01Rnn071RnRiMOV R1,R0 MOV A,R2 3.APSW启迪智慧思维创造精彩人生