



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
AVR instructions sheet for to use in exams etc.
Typology: Cheat Sheet
1 / 5
This page cannot be seen from the preview
Don't miss anything!
Notes: 1. Not all instructions are available in all devices. Refer to the device specific instruction summary.
Mnemonics Operands Description Operation Flags #Clock Note Arithmetic and Logic Instructions ADD Rd, Rr Add without Carry Rd โ Rd + Rr Z,C,N,V,S,H 1 ADC Rd, Rr Add with Carry Rd โ Rd + Rr + C Z,C,N,V,S,H 1 ADIW Rd, K Add Immediate to Word Rd+1:Rd โ Rd+1:Rd + K Z,C,N,V,S 2 SUB Rd, Rr Subtract without Carry Rd โ Rd - Rr Z,C,N,V,S,H 1 SUBI Rd, K Subtract Immediate Rd โ Rd - K Z,C,N,V,S,H 1 SBC Rd, Rr Subtract with Carry Rd โ Rd - Rr - C Z,C,N,V,S,H 1 SBCI Rd, K Subtract Immediate with Carry Rd โ Rd - K - C Z,C,N,V,S,H 1 SBIW Rd, K Subtract Immediate from Word Rd+1:Rd โ Rd+1:Rd - K Z,C,N,V,S 2 AND Rd, Rr Logical AND Rd โ Rd โข Rr Z,N,V,S 1 ANDI Rd, K Logical AND with Immediate Rd โ Rd โข K Z,N,V,S 1 OR Rd, Rr Logical OR Rd โ Rd v Rr Z,N,V,S 1 ORI Rd, K Logical OR with Immediate Rd โ Rd v K Z,N,V,S 1 EOR Rd, Rr Exclusive OR Rd โ Rd โ Rr Z,N,V,S 1 COM Rd Oneโs Complement Rd โ $FF - Rd Z,C,N,V,S 1 NEG Rd Twoโs Complement Rd โ $00 - Rd Z,C,N,V,S,H 1 SBR Rd,K Set Bit(s) in Register Rd โ Rd v K Z,N,V,S 1 CBR Rd,K Clear Bit(s) in Register Rd โ Rd โข ($FFh - K) Z,N,V,S 1 INC Rd Increment Rd โ Rd + 1 Z,N,V,S 1 DEC Rd Decrement Rd โ Rd - 1 Z,N,V,S 1 TST Rd Test for Zero or Minus Rd โ Rd โข Rd Z,N,V,S 1 CLR Rd Clear Register Rd โ Rd โ Rd Z,N,V,S 1 SER Rd Set Register Rd โ $FF None 1 MUL Rd,Rr Multiply Unsigned R1:R0 โ Rd ร Rr (UU) Z,C 2 MULS Rd,Rr Multiply Signed R1:R0 โ Rd ร Rr (SS) Z,C 2 MULSU Rd,Rr Multiply Signed with Unsigned R1:R0 โ Rd ร Rr (SU) Z,C 2 FMUL Rd,Rr Fractional Multiply Unsigned R1:R0 โ (Rd ร Rr)<<1 (UU) Z,C 2 FMULS Rd,Rr Fractional Multiply Signed R1:R0 โ (Rd ร Rr)<<1 (SS) Z,C 2 FMULSU Rd,Rr Fractional Multiply Signed with Unsigned
R1:R0 โ (Rd ร Rr)<<1 (SU) Z,C 2
5
BRGE k Branch if Greater or Equal, Instruction Set Summary (Continued)
ST -Z, Rr Store Indirect and Pre- Decrement
Z โ Z - 1, (Z) โ Rr None 2
STD Z+q,Rr Store Indirect with Displacement (Z + q) โ Rr None 2 LPM Load Program Memory R0 โ (Z) None 3 LPM Rd, Z Load Program Memory Rd โ (Z) None 3 LPM Rd, Z+ Load Program Memory and Post- Increment
Rd โ (Z), Z โ Z + 1 None 3
ELPM Extended Load Program Memory R0 โ (RAMPZ:Z) None 3 ELPM Rd, Z Extended Load Program Memory Rd โ (RAMPZ:Z) None 3 ELPM Rd, Z+ Extended Load Program Memory and Post-Increment
Rd โ (RAMPZ:Z), Z โ Z + 1 None 3
SPM Store Program Memory (Z) โ R1:R0 None - ESPM Extended Store Program Memory
(RAMPZ:Z) โ R1:R0 None -
IN Rd, A In From I/O Location Rd โ I/O(A) None 1 OUT A, Rr Out To I/O Location I/O(A) โ Rr None 1 PUSH Rr Push Register on Stack STACK โ Rr None 2 POP Rd Pop Register from Stack Rd โ STACK None 2 Bit and Bit-test Instructions LSL Rd Logical Shift Left Rd(n+1)โRd(n),Rd(0)โ0,CโRd(7) Z,C,N,V,H 1 LSR Rd Logical Shift Right Rd(n)โRd(n+1),Rd(7)โ0,CโRd(0) Z,C,N,V 1 ROL Rd Rotate Left Through Carry Rd(0)โC,Rd(n+1)โRd(n),CโRd(7) Z,C,N,V,H 1 ROR Rd Rotate Right Through Carry Rd(7)โC,Rd(n)โRd(n+1),CโRd(0) Z,C,N,V 1 ASR Rd Arithmetic Shift Right Rd(n) โ Rd(n+1), n=0..6 Z,C,N,V 1 SWAP Rd Swap Nibbles Rd(3..0) โ Rd(7..4) None 1 BSET s Flag Set SREG(s) โ 1 SREG(s) 1 BCLR s Flag Clear SREG(s) โ 0 SREG(s) 1 SBI A, b Set Bit in I/O Register I/O(A, b) โ 1 None 2 CBI A, b Clear Bit in I/O Register I/O(A, b) โ 0 None 2 BST Rr, b Bit Store from Register to T T โ Rr(b) T 1 BLD Rd, b Bit load from T to Register Rd(b) โ T None 1 SEC Set Carry C โ 1 C 1 CLC Clear Carry C โ 0 C 1 SEN Set Negative Flag N โ 1 N 1 CLN Clear Negative Flag N โ 0 N 1 SEZ Set Zero Flag Z โ 1 Z 1 CLZ Clear Zero Flag Z โ 0 Z 1
Mnemonics Operands Description Operation Flags #Clock Note
SEI Global Interrupt Enable I โ 1 I 1 CLI Global Interrupt Disable I โ 0 I 1 SES Set Signed Test Flag S โ 1 S 1 CLS Clear Signed Test Flag S โ 0 S 1 SEV Set Twoโs Complement Overflow V โ 1 V 1 CLV Clear Twoโs Complement Overflow
SET Set T in SREG T โ 1 T 1 CLT Clear T in SREG T โ 0 T 1 SEH Set Half Carry Flag in SREG H โ 1 H 1 CLH Clear Half Carry Flag in SREG H โ 0 H 1 NOP No Operation None 1 SLEEP Sleep (see specific descr. for Sleep) None 1 WDR Watchdog Reset (see specific descr. for WDR) None 1
Mnemonics Operands Description Operation Flags #Clock Note