單片機(jī)之匯編指令系統(tǒng)
控制轉(zhuǎn)移指令:
AJMP addr ;絕對(duì)跳轉(zhuǎn)指令
SJMP rel ;相對(duì)跳轉(zhuǎn)指令,(PC)+2+rel→PC
LJMP addr16 ;長(zhǎng)跳轉(zhuǎn)指令,addr16→PC
JMP @A+DPTR ;間接跳轉(zhuǎn)指令
JZ rel ;判零跳轉(zhuǎn)指令,(A)=1,則(PC)+2+rel→PC,若A!=0,則(PC)+2→PC
JNZ rel ;與上相反
CJNE A,direct,rel;比較不相等跳轉(zhuǎn)指令.執(zhí)行過(guò)程為:a.(A)=(direct),則(PC)+3→(PC),Cy=0
b.(A)>(direct),則(PC)+3+rel→(PC),Cy=0
c.(A)(direct),則(PC)+3+rel→(PC),Cy=1
DJNZ Rn,rel ;減一不為零跳轉(zhuǎn)指令 .執(zhí)行過(guò)錯(cuò)為 a.(PC)+2→PC. b.(Rn)-1→direct c.若Rn!=0,則(PC)+rel→PC;若direct=0,則程序往下執(zhí)行
ACALL addr ;短調(diào)用指令
LCALL addr ;長(zhǎng)調(diào)用指令
RET ;從子程序返回指令
RETI ;從中斷返回指令
NOP ;空操作指令
指令助記注釋:
ADDC ---Add with Carry Flag
SUBB ---Subtract With Borrow
INC ---- Increment
DEC-------Decrement
MUL----Multiply
DIV----Divide
DA----Decimal Adjust
MOV----move
MOVX----move external RAM
MOVC----move code
XCH----Exchange
XCHD----Exchange low-order Digit
ANL----and logical
ORL----or logical
XRL----exclusive-or logical
CLR----clear
CPL----complement logical
RL----rotate left
RR---rotate right
ACALL----absolute subroutine call
LCALL----long subroutine call
RET----return from subroutine
RETI----return from interrupt
AJUMP----absolute jump
LJMP----long jump
SJMP----short jump
JZ----jump if accumulator is zero
JNZ----jump if not zero
JC----jump if carray flag is set
JB----jump if direct bit not set
CJNE----compare jmp if not equal
DJNZ----decrement jump if zero
NOP----no operation
評(píng)論