ATTINY13指令整理

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

指令操作数说明操作标志#时钟数ADDRd,Rr无进位加法Rd←Rd+RrZ,C,N,V,H1ADCRd,Rr带进位加法Rd←Rd+Rr+CZ,C,N,V,H1ADIWRdl,K立即数与字相加Rdh:Rdl←Rdh:Rdl+KZ,C,N,V,S2SUBRd,Rr无进位减法Rd←Rd-RrZ,C,N,V,H1SUBIRd,K减立即数Rd←Rd-KZ,C,N,V,H1SBCRd,Rr带进位减法Rd←Rd-Rr-CZ,C,N,V,H1SBCIRd,K带进位减立即数Rd←Rd-K-CZ,C,N,V,H1SBIWRdl,K从字中减立即数Rdh:Rdl←Rdh:Rdl-KZ,C,N,V,S2ANDRd,Rr逻辑与Rd←Rd*RrZ,N,V1ANDIRd,K与立即数的逻辑与操作Rd←Rd*KZ,N,V1ORRd,Rr逻辑或Rd←RdvRrZ,N,V1ORIRd,K与立即数的逻辑或操作Rd←RdvKZ,N,V1EORRd,Rr异或Rd←Rd⊕RrZ,N,V1COMRd1的补码Rd←0xFF-RdZ,C,N,V1NEGRd2的补码Rd←0x00-RdZ,C,N,V,H1SBRRd,K设置寄存器的位Rd←RdvKZ,N,V1CBRRd,K寄存器位清零Rd←Rd*(0xFF-K)Z,N,V1INCRd加一操作Rd←Rd+1Z,N,V1DECRd减一操作Rd←Rd-1Z,N,V1TSTRd测试是否为零或负Rd←Rd*RdZ,N,V1CLRRd寄存器清零Rd←Rd⊕RdZ,N,V1SERRd寄存器置位Rd←0xFFNone1NOP空操作None1SLEEP休眠(seespecificdescr.forSleepfunction)None1WDR复位看门狗(seespecificdescr.forWDR/Timer)None1BREAK终止ForOn-chipDebugOnlyNoneN/AMCU控制指令TINY13指令集概述算数和逻辑指令指令操作数说明操作标志#时钟数RJMPk相对跳转PC←PC+k+1None2IJMP间接跳转到(Z)PC←ZNone2RCALLk相对子程序调用PC←PC+k+1None3ICALL间接调用(Z)PC←ZNone3RET子程序返回PC←STACKNone4RETI中断返回PC←STACKI4CPSERd,Rr比较,相等则跳过下一条指令if(Rd=Rr)PC←PC+2or3None1/2/3CPRd,Rr比较Rd-RrZ,N,V,C,H1CPCRd,Rr带进位比较Rd-Rr-CZ,N,V,C,H1CPIRd,K与立即数比较Rd-KZ,N,V,C,H1SBRCRr,b寄存器位为0”则跳过下一条指令if(Rr(b)=0)PC←PC+2or3None1/2/3SBRSRr,b寄存器位为1”则跳过下一条指令if(Rr(b)=1)PC←PC+2or3None1/2/3SBICP,bI/O寄存器位为0”则跳过下一条指令if(P(b)=0)PC←PC+2or3None1/2/3SBISP,bI/O寄存器位为1”则跳过下一条指令if(P(b)=1)PC←PC+2or3None1/2/3BRBSs,k状态寄存器位为1”则跳过下一条指令if(SREG(s)=1)thenPC←PC+k+1None1/2BRBCs,k状态寄存器位为0”则跳过下一条指令if(SREG(s)=0)thenPC←PC+k+1None1/2BREQk相等则跳转if(Z=1)thenPC←PC+k+1None1/2BRNEk不相等则跳转if(Z=0)thenPC←PC+k+1None1/2BRCSk进位位为1”则跳转if(C=1)thenPC←PC+k+1None1/2BRCCk进位位为0”则跳转if(C=0)thenPC←PC+k+1None1/2BRSHk大于或等于则跳转if(C=0)thenPC←PC+k+1None1/2BRLOk小于则跳转if(C=1)thenPC←PC+k+1None1/2BRMIk负则跳转if(N=1)thenPC←PC+k+1None1/2BRPLk正则跳转if(N=0)thenPC←PC+k+1None1/2BRGEk有符号数大于或等于则跳转if(N⊕V=0)thenPC←PC+k+1None1/2BRLTk有符号数负则跳转if(N⊕V=1)thenPC←PC+k+1None1/2BRHSk半进位位为1”则跳转if(H=1)thenPC←PC+k+1None1/2BRHCk半进位位为0”则跳转if(H=0)thenPC←PC+k+1None1/2BRTSkT为1”则跳转if(T=1)thenPC←PC+k+1None1/2BRTCkT为0”则跳转if(T=0)thenPC←PC+k+1None1/2BRVSk溢出标志为1”则跳转if(V=1)thenPC←PC+k+1None1/2BRVCk溢出标志为0”则跳转if(V=0)thenPC←PC+k+1None1/2BRIEk中断使能则跳转if(I=1)thenPC←PC+k+1None1/2BRIDk中断禁止则跳转if(I=0)thenPC←PC+k+1None1/2跳转指令指令操作数说明操作标志#时钟数SBIP,bI/O寄存器位置位I/O(P,b)←1None2CBIP,bI/O寄存器位清零I/O(P,b)←0None2LSLRd逻辑左移Rd(n+1)←Rd(n),Rd(0)←0Z,C,N,V1LSRRd逻辑右移Rd(n)←Rd(n+1),Rd(7)←0Z,C,N,V1ROLRd带进位循环左移Rd(0)←C,Rd(n+1)←Rd(n),C←Rd(7)Z,C,N,V1RORRd带进位循环右移Rd(7)←C,Rd(n)←Rd(n+1),C←Rd(0)Z,C,N,V1ASRRd算术右移Rd(n)←Rd(n+1),n=0..6Z,C,N,V1SWAPRd高低半字节交换Rd(3..0)←Rd(7..4),Rd(7..4)←Rd(3..0)None1BSETs标志置位SREG(s)←1SREG(s)1BCLRs标志清零SREG(s)←0SREG(s)1BSTRr,b从寄存器将位赋给TT←Rr(b)T1BLDRd,b将T赋给寄存器位Rd(b)←TNone1SEC进位位置位C←1C1CLC进位位清零C←0C1SEN负标志位置位N←1N1CLN负标志位清零N←0N1SEZ零标志位置位Z←1Z1CLZ零标志位清零Z←0Z1SEI全局中断使能I←1I1CLI全局中断禁用I←0I1SES符号测试标志位置位S←1S1CLS符号测试标志位清零S←0S1SEV2的补码溢出标志置位V←1V1CLV2的补码溢出标志清零V←0V1SETSREG的T置位T←1T1CLTSREG的T清零T←0T1SEHSREG的半进位标志置位H←1H1CLHSREG的半进位标志清零H←0H1位和位测试指令指令操作数说明操作标志#时钟数MOVRd,Rr寄存器间复制Rd←RrNone1MOVWRd,Rr复制寄存器字Rd+1:Rd←Rr+1:RrNone1LDIRd,K加载立即数Rd←KNone1LDRd,X加载间接寻址数据Rd←(X)None2LDRd,X+加载间接寻址数据,然后地址加一Rd←(X),X←X+1None2LDRd,-X地址减一后加载间接寻址数据X←X-1,Rd←(X)None2LDRd,Y加载间接寻址数据Rd←(Y)None2LDRd,Y+加载间接寻址数据,然后地址加一Rd←(Y),Y←Y+1None2LDRd,-Y地址减一后加载间接寻址数据Y←Y-1,Rd←(Y)None2LDDRd,Y+q加载带偏移量的间接寻址数据Rd←(Y+q)None2LDRd,Z加载间接寻址数据Rd←(Z)None2LDRd,Z+加载间接寻址数据,然后地址加一Rd←(Z),Z←Z+1None2LDRd,-Z地址减一后加载间接寻址数据Z←Z-1,Rd←(Z)None2LDDRd,Z+q加载带偏移量的间接寻址数据Rd←(Z+q)None2LDSRd,k从SRAM加载数据Rd←(k)None2STX,Rr以间接寻址方式存储数据(X)←RrNone2STX+,Rr以间接寻址方式存储数据,然后地址加一(X)←Rr,X←X+1None2ST-X,RrX←X-1,(X)←RrNone2STY,Rr加载间接寻址数据(Y)←RrNone2STY+,Rr加载间接寻址数据,然后地址加一(Y)←Rr,Y←Y+1None2ST-Y,RrY←Y-1,(Y)←RrNone2STDY+q,Rr加载带偏移量的间接寻址数据(Y+q)←RrNone2STZ,Rr加载间接寻址数据(Z)←RrNone2STZ+,Rr加载间接寻址数据,然后地址加一(Z)←Rr,Z←Z+1None2ST-Z,RrZ←Z-1,(Z)←RrNone2STDZ+q,Rr加载带偏移量的间接寻址数据(Z+q)←RrNone2STSk,Rr从SRAM加载数据(k)←RrNone2LPM加载程序空间的数据R0←(Z)None3LPMRd,Z加载程序空间的数据Rd←(Z)None3LPMRd,Z+加载程序空间的数据,然后地址加一Rd←(Z),Z←Z+1None3SPM保存程序空间的数据(z)←R1:R0NoneINRd,P从I/O端口读数据Rd←PNone1OUTP,Rr想I/O端口输出数据P←RrNone1PUSHRr将寄存器推入堆栈STACK←RrNone2POPRd将寄存器弹出堆栈Rd←STACKNone2数据传送指令

1 / 4
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功