35 Instruction Set Summary

Table 35-1. Arithmetic and Logic Instructions
MnemonicOperandsDescriptionOpFlags
ADDRd, RrAdd without CarryRdRd + RrZ,C,N,V,S,H
ADCRd, RrAdd with CarryRdRd + Rr + CZ,C,N,V,S,H
ADIWRd, KAdd Immediate to WordRd + 1:RdRd + 1:Rd + KZ,C,N,V,S
SUBRd, RrSubtract without CarryRdRd - RrZ,C,N,V,S,H
SUBIRd, KSubtract ImmediateRdRd - KZ,C,N,V,S,H
SBCRd, RrSubtract with CarryRdRd - Rr - CZ,C,N,V,S,H
SBCIRd, KSubtract Immediate with CarryRdRd - K - CZ,C,N,V,S,H
SBIWRd, KSubtract Immediate from WordRd + 1:RdRd + 1:Rd - KZ,C,N,V,S
ANDRd, RrLogical ANDRdRd • RrZ,N,V,S
ANDIRd, KLogical AND with ImmediateRdRd • KZ,N,V,S
ORRd, RrLogical ORRdRd v RrZ,N,V,S
ORIRd, KLogical OR with ImmediateRdRd v KZ,N,V,S
EORRd, RrExclusive ORRdRd ⊕ RrZ,N,V,S
COMRdOne’s ComplementRd$FF - RdZ,C,N,V,S
NEGRdTwo’s ComplementRd$00 - RdZ,C,N,V,S,H
SBRRd,KSet Bit(s) in RegisterRdRd v KZ,N,V,S
CBRRd,KClear Bit(s) in RegisterRdRd • ($FFh - K)Z,N,V,S
INCRdIncrementRdRd + 1Z,N,V,S
DECRdDecrementRdRd - 1Z,N,V,S
TSTRdTest for Zero or MinusRdRd • RdZ,N,V,S
CLRRdClear RegisterRdRd ⊕ RdZ,N,V,S
SERRdSet RegisterRd$FFNone
Table 35-2. Branch Instructions
MnemonicOperandsDescriptionOpFlags
RJMPkRelative JumpPCPC + k + 1None
IJMPIndirect Jump to (Z)

PC(15:0)

PC(21:16)

←


Z

0

None
RCALLkRelative Call SubroutinePCPC + k + 1None
ICALLIndirect Call to (Z)

PC(15:0)

PC(21:16)

←


Z

0

None
RETSubroutine ReturnPCSTACKNone
RETIInterrupt ReturnPCSTACKI
CPSERd,RrCompare, skip if Equalif (Rd = Rr) PCPC + 2 or 3None
CPRd,RrCompareRd - RrZ,C,N,V,S,H
CPCRd,RrCompare with CarryRd - Rr - CZ,C,N,V,S,H
CPIRd,KCompare with ImmediateRd - KZ,C,N,V,S,H
SBRCRr, bSkip if Bit in Register Clearedif (Rr(b) = 0) PCPC + 2 or 3None
SBRSRr, bSkip if Bit in Register Setif (Rr(b) = 1) PCPC + 2 or 3None
SBICA, bSkip if Bit in I/O Register Clearedif (I/O(A,b) = 0) PCPC + 2 or 3None
SBISA, bSkip if Bit in I/O Register SetIf (I/O(A,b) =1) PCPC + 2 or 3None
BRBSs, kBranch if Status Flag Setif (SREG(s) = 1) then PCPC + k + 1None
BRBCs, kBranch if Status Flag Clearedif (SREG(s) = 0) then PCPC + k + 1None
BREQ kBranch if Equalif (Z = 1) then PCPC + k + 1None
BRNE kBranch if Not Equalif (Z = 0) then PCPC + k + 1None
BRCS kBranch if Carry Setif (C = 1) then PCPC + k + 1None
BRCC kBranch if Carry Clearedif (C = 0) then PCPC + k + 1None
BRSH kBranch if Same or Higherif (C = 0) then PCPC + k + 1None
BRLO kBranch if Lowerif (C = 1) then PCPC + k + 1None
BRMI kBranch if Minusif (N = 1) then PCPC + k + 1None
BRPL kBranch if Plusif (N = 0) then PCPC + k + 1None
BRGE kBranch if Greater or Equal, Signedif (N ⊕ V= 0) then PCPC + k + 1None
BRLT kBranch if Less Than, Signedif (N ⊕ V= 1) then PCPC + k + 1None
BRHS kBranch if Half Carry Flag Setif (H = 1) then PCPC + k + 1None
BRHC kBranch if Half Carry Flag Clearedif (H = 0) then PCPC + k + 1None
BRTS kBranch if T Flag Setif (T = 1) then PCPC + k + 1None
BRTC kBranch if T Flag Clearedif (T = 0) then PCPC + k + 1None
BRVS kBranch if Overflow Flag is Setif (V = 1) then PCPC + k + 1None
BRVC kBranch if Overflow Flag is Clearedif (V = 0) then PCPC + k + 1None
BRIE kBranch if Interrupt Enabledif (I = 1) then PCPC + k + 1None
BRID kBranch if Interrupt Disabledif (I = 0) then PCPC + k + 1None
Table 35-3. Data Transfer Instructions
MnemonicOperandsDescriptionOpFlags
MOVRd, RrCopy RegisterRdRrNone
LDIRd, KLoad ImmediateRdKNone
LDSRd, kLoad Direct from data spaceRd(k)None
LDRd, XLoad IndirectRd(X)None
LDRd, X+Load Indirect and Post-Increment

Rd

X

←


(X)


X + 1

None
LDRd, -XLoad Indirect and Pre-Decrement

X

Rd

←


X - 1


(X)

None
LDRd, YLoad IndirectRd(Y)None
LDRd, Y+Load Indirect and Post-Increment

Rd

Y

←


(Y)

Y + 1

None
LDRd, -YLoad Indirect and Pre-Decrement

Y

Rd

←


Y - 1


(Y)

None
LDDRd, Y+qLoad Indirect with DisplacementRd(Y + q)None
LDRd, ZLoad IndirectRd(Z)None
LDRd, Z+Load Indirect and Post-Increment

Rd

Z

←


(Z)

Z+1

None
LDRd, -ZLoad Indirect and Pre-Decrement

Z

Rd

←


Z - 1

(Z)

None
LDDRd, Z+qLoad Indirect with DisplacementRd(Z + q)None
STSk, RrStore Direct to Data Space(k)RdNone
STX, RrStore Indirect(X)RrNone
STX+, RrStore Indirect and Post-Increment

(X)

X

←


Rr

X + 1

None
ST-X, RrStore Indirect and Pre-Decrement

X

(X)

←


X - 1


Rr

None
STY, RrStore Indirect(Y)RrNone
STY+, RrStore Indirect and Post-Increment

(Y)

Y

←


Rr

Y + 1

None
ST-Y, RrStore Indirect and Pre-Decrement

Y

(Y)

←


Y - 1

Rr

None
STDY+q, RrStore Indirect with Displacement(Y + q)RrNone
STZ, RrStore Indirect(Z)RrNone
STZ+, RrStore Indirect and Post-Increment

(Z)

Z

←


Rr


Z + 1
None
ST-Z, RrStore Indirect and Pre-DecrementZZ - 1None
STDZ+q,RrStore Indirect with Displacement(Z + q)RrNone
LPMLoad Program MemoryR0(Z)None
INRd, AIn From I/O LocationRdI/O(A)None
OUTA, RrOut To I/O LocationI/O(A)RrNone
PUSHRrPush Register on StackSTACKRrNone
POPRdPop Register from StackRdSTACKNone
Table 35-4. Bit and Bit-Test Instructions
MnemonicOperandsDescriptionOpFlags
LSLRdLogical Shift Left

Rd(n+1)

Rd(0)

C

Rd(n)


0

Rd(7)

Z,C,N,V,H
LSRRdLogical Shift Right

Rd(n)

Rd(7)

C

Rd(n+1)


0

Rd(0)

Z,C,N,V
ROLRdRotate Left Through Carry

Rd(0)

Rd(n+1)

C

C

Rd(n)

Rd(7)

Z,C,N,V,H
RORRdRotate Right Through Carry

Rd(7)

Rd(n)

C

C

Rd(n+1)

Rd(0)

Z,C,N,V
ASRRdArithmetic Shift RightRd(n)Rd(n+1), n=0..6Z,C,N,V
SWAPRdSwap NibblesRd(3..0)Rd(7..4)None
SBIA, bSet Bit in I/O RegisterI/O(A, b)1None
CBIA, bClear Bit in I/O RegisterI/O(A, b)0None
BSTRr, bBit Store from Register to TTRr(b)T
BLDRd, bBit load from T to RegisterRd(b)TNone
BSETsFlag SetSREG(s)1SREG(s)
BCLRsFlag ClearSREG(s)0SREG(s)
SECSet CarryC1C
CLCClear CarryC0C
SENSet Negative FlagN1N
CLNClear Negative FlagN0N
SEZSet Zero FlagZ1Z
CLZClear Zero FlagZ0Z
SEIGlobal Interrupt EnableI1I
CLIGlobal Interrupt DisableI0I
SESSet Signed Test FlagS1S
CLSClear Signed Test FlagS0S
SEVSet Two’s Complement OverflowV1V
CLVClear Two’s Complement OverflowV0V
SETSet T in SREGT1T
CLTClear T in SREGT0T
SEHSet Half Carry Flag in SREGH1H
CLHClear Half Carry Flag in SREGH0H
Table 35-5. MCU Control Instructions
MnemonicOperandsDescriptionOperationFlags
BREAKBreak(See also in Debug interface description)None
NOPNo OperationNone
SLEEPSleep(see also power management and sleep description)None
WDRWatchdog Reset(see also Watchdog Controller description)None
Note:
  1. Cycle time for data memory accesses assume internal RAM access and are not valid for accesses through the NVM controller. A minimum of one extra cycle must be added when accessing memory through the NVM controller (such as Flash and EEPROM), but depending on simultaneous accesses by other masters or the NVM controller state, there may be more than one extra cycle.