- •Instruction Set Nomenclature
- •I/O Registers
- •The Program and Data Addressing Modes
- •Conditional Branch Summary
- •Complete Instruction Set Summary
- •ADC – Add with Carry
- •ADD – Add without Carry
- •ADIW – Add Immediate to Word
- •AND – Logical AND
- •ANDI – Logical AND with Immediate
- •ASR – Arithmetic Shift Right
- •BCLR – Bit Clear in SREG
- •BLD – Bit Load from the T Flag in SREG to a Bit in Register
- •BRBC – Branch if Bit in SREG is Cleared
- •BRBS – Branch if Bit in SREG is Set
- •BRCC – Branch if Carry Cleared
- •BRCS – Branch if Carry Set
- •BREAK – Break
- •BREQ – Branch if Equal
- •BRGE – Branch if Greater or Equal (Signed)
- •BRHC – Branch if Half Carry Flag is Cleared
- •BRHS – Branch if Half Carry Flag is Set
- •BRID – Branch if Global Interrupt is Disabled
- •BRIE – Branch if Global Interrupt is Enabled
- •BRLO – Branch if Lower (Unsigned)
- •BRLT – Branch if Less Than (Signed)
- •BRMI – Branch if Minus
- •BRNE – Branch if Not Equal
- •BRPL – Branch if Plus
- •BRSH – Branch if Same or Higher (Unsigned)
- •BRTC – Branch if the T Flag is Cleared
- •BRTS – Branch if the T Flag is Set
- •BRVC – Branch if Overflow Cleared
- •BRVS – Branch if Overflow Set
- •BSET – Bit Set in SREG
- •BST – Bit Store from Bit in Register to T Flag in SREG
- •CALL – Long Call to a Subroutine
- •CBI – Clear Bit in I/O Register
- •CBR – Clear Bits in Register
- •CLC – Clear Carry Flag
- •CLH – Clear Half Carry Flag
- •CLI – Clear Global Interrupt Flag
- •CLN – Clear Negative Flag
- •CLR – Clear Register
- •CLS – Clear Signed Flag
- •CLT – Clear T Flag
- •CLV – Clear Overflow Flag
- •CLZ – Clear Zero Flag
- •COM – One’s Complement
- •CP – Compare
- •CPC – Compare with Carry
- •CPI – Compare with Immediate
- •CPSE – Compare Skip if Equal
- •DEC – Decrement
- •DES – Data Encryption Standard
- •EICALL – Extended Indirect Call to Subroutine
- •EIJMP – Extended Indirect Jump
- •ELPM – Extended Load Program Memory
- •EOR – Exclusive OR
- •FMUL – Fractional Multiply Unsigned
- •FMULS – Fractional Multiply Signed
- •FMULSU – Fractional Multiply Signed with Unsigned
- •ICALL – Indirect Call to Subroutine
- •IJMP – Indirect Jump
- •IN - Load an I/O Location to Register
- •INC – Increment
- •JMP – Jump
- •LAC – Load And Clear
- •LAS – Load And Set
- •LAT – Load And Toggle
- •LD – Load Indirect from Data Space to Register using Index X
- •LD (LDD) – Load Indirect from Data Space to Register using Index Y
- •LD (LDD) – Load Indirect From Data Space to Register using Index Z
- •LDI – Load Immediate
- •LDS – Load Direct from Data Space
- •LDS (16-bit) – Load Direct from Data Space
- •LPM – Load Program Memory
- •LSL – Logical Shift Left
- •LSR – Logical Shift Right
- •MOV – Copy Register
- •MOVW – Copy Register Word
- •MUL – Multiply Unsigned
- •MULS – Multiply Signed
- •MULSU – Multiply Signed with Unsigned
- •NEG – Two’s Complement
- •NOP – No Operation
- •OR – Logical OR
- •ORI – Logical OR with Immediate
- •OUT – Store Register to I/O Location
- •POP – Pop Register from Stack
- •PUSH – Push Register on Stack
- •RCALL – Relative Call to Subroutine
- •RET – Return from Subroutine
- •RETI – Return from Interrupt
- •RJMP – Relative Jump
- •ROL – Rotate Left trough Carry
- •ROR – Rotate Right through Carry
- •SBC – Subtract with Carry
- •SBCI – Subtract Immediate with Carry
- •SBI – Set Bit in I/O Register
- •SBIC – Skip if Bit in I/O Register is Cleared
- •SBIS – Skip if Bit in I/O Register is Set
- •SBIW – Subtract Immediate from Word
- •SBR – Set Bits in Register
- •SBRC – Skip if Bit in Register is Cleared
- •SBRS – Skip if Bit in Register is Set
- •SEC – Set Carry Flag
- •SEH – Set Half Carry Flag
- •SEI – Set Global Interrupt Flag
- •SEN – Set Negative Flag
- •SER – Set all Bits in Register
- •SES – Set Signed Flag
- •SET – Set T Flag
- •SEV – Set Overflow Flag
- •SEZ – Set Zero Flag
- •SLEEP
- •SPM – Store Program Memory
- •SPM #2– Store Program Memory
- •ST – Store Indirect From Register to Data Space using Index X
- •ST (STD) – Store Indirect From Register to Data Space using Index Y
- •ST (STD) – Store Indirect From Register to Data Space using Index Z
- •STS – Store Direct to Data Space
- •STS (16-bit) – Store Direct to Data Space
- •SUB – Subtract without Carry
- •SUBI – Subtract Immediate
- •SWAP – Swap Nibbles
- •TST – Test for Zero or Minus
- •WDR – Watchdog Reset
- •XCH – Exchange
- •Datasheet Revision History
WDR – Watchdog Reset
Description:
This instruction resets the Watchdog Timer. This instruction must be executed within a limited time given by the WD prescaler. See the Watchdog Timer hardware specification.
Operation:
(i)WD timer restart.
|
Syntax: |
|
|
|
|
Operands: |
|
|
Program Counter: |
|||||||
(i) |
WDR |
|
|
|
|
None |
|
|
|
|
|
PC ← PC + 1 |
||||
|
16-bit Opcode: |
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1001 |
|
0101 |
|
1010 |
|
1000 |
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
Status Register and Boolean Formula: |
|
|
|
|
|
|||||||||||
I |
|
T |
|
|
H |
|
S |
V |
N |
Z |
|
C |
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
– |
|
– |
|
|
– |
|
– |
– |
|
– |
– |
|
– |
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
wdr |
|
|
|
; Reset watchdog timer |
|
|
|
|
|
|||||
Words: |
1 (2 bytes) |
|
|
|
|
|
|
|
|
|
|
|
||||
Cycles: 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 AVR Instruction Set
0856I–AVR–07/10
AVR Instruction Set
XCH – Exchange
Description:
Operation:
(i)(Z) ← Rd, Rd ← (Z)
|
Syntax: |
|
|
Operands: |
Program Counter: |
||
(i) |
XCH Z,Rd |
0 ≤ d ≤ 31 |
PC ← PC + 1 |
||||
|
16-bit Opcode: |
|
|
|
|||
|
|
|
|
|
|
|
|
|
1001 |
|
001r |
|
rrrr |
0100 |
|
|
|
|
|
|
|
|
|
Words: 1 (2 bytes)
Cycles: 1
157
0856I–AVR–07/10
Datasheet Revision History
Please note that the referring page numbers in this section are referred to this document. The referring revision in this section is referred to the document revision.
Rev.0856I – 07/10
1.Updated “Complete Instruction Set Summary” on page 11 with new instructions: LAC, LAS, LAT and XCH. “LAC – Load And Clear” on page 84
“LAS – Load And Set” on page 85 “LAT – Load And Toggle” on page 86 “XCH – Exchange” on page 157
2.Updated number of clock cycles column to include Reduced Core tinyAVR.
(ATtiny replaced by Reduced Core tinyAVR).
Rev.0856H – 04/09
1. Updated “Complete Instruction Set Summary” on page 11:
Updated number of clock cycles column to include Reduced Core tinyAVR.
2.Updated sections for Reduced Core tinyAVR compatibility: “CBI – Clear Bit in I/O Register” on page 48
“LD – Load Indirect from Data Space to Register using Index X” on page 87
“LD (LDD) – Load Indirect from Data Space to Register using Index Y” on page 90 “LD (LDD) – Load Indirect From Data Space to Register using Index Z” on page 92 “RCALL – Relative Call to Subroutine” on page 114
“SBI – Set Bit in I/O Register” on page 123
“ST – Store Indirect From Register to Data Space using Index X” on page 144
“ST (STD) – Store Indirect From Register to Data Space using Index Y” on page 146 “ST (STD) – Store Indirect From Register to Data Space using Index Z” on page 148
3.Added sections for Reduced Core tinyAVR compatibility:
“LDS (16-bit) – Load Direct from Data Space” on page 96 “STS (16-bit) – Store Direct to Data Space” on page 151
Rev.0856G – 07/08
1.Inserted “Datasheet Revision History”
2.Updated “Cycles XMEGA” for ST, by removing (iv).
3.Updated “SPM #2” opcodes.
158 AVR Instruction Set
0856I–AVR–07/10
AVR Instruction Set
Rev.0856F – 05/08
1. This revision is based on the AVR Instruction Set 0856E-AVR-11/05
Changes done compared to AVR Instruction Set 0856E-AVR-11/05:
–Updated “Complete Instruction Set Summary” with DES and SPM #2.
–Updated AVR Instruction Set with XMEGA Clock cycles and Instruction Description.
159
0856I–AVR–07/10
Headquarters |
International |
|
|
|
|
|
|
|
|
Atmel Corporation |
|
Atmel Asia |
Atmel Europe |
Atmel Japan |
2325 Orchard Parkway |
|
Unit 1-5 & 16, 19/F |
Le Krebs |
9F, Tonetsu Shinkawa Bldg. |
San Jose, CA 95131 |
|
BEA Tower, Millennium City 5 |
8, Rue Jean-Pierre Timbaud |
1-24-8 Shinkawa |
USA |
|
418 Kwun Tong Road |
BP 309 |
Chuo-ku, Tokyo 104-0033 |
Tel: 1(408) 441-0311 |
|
Kwun Tong, Kowloon |
78054 Saint-Quentin-en- |
Japan |
Fax: 1(408) 487-2600 |
|
Hong Kong |
Yvelines Cedex |
Tel: (81) 3-3523-3551 |
|
|
Tel: (852) 2245-6100 |
France |
Fax: (81) 3-3523-7581 |
|
|
Fax: (852) 2722-1369 |
Tel: (33) 1-30-60-70-00 |
|
|
|
|
Fax: (33) 1-30-60-71-11 |
|
Product Contact
Web Site |
Technical Support |
Sales Contact |
www.atmel.com |
avr@atmel.com |
www.atmel.com/contacts |
Literature Requests |
|
|
www.atmel.com/literature |
|
|
Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL’S TERMS AND CONDI-
TIONS OF SALE LOCATED ON ATMEL’S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel’s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.
© 2010 Atmel Corporation. All rights reserved. Atmel®, Atmel logo and combinations thereof, AVR®, AVR® logo, tinyAVR® and others are registered trademarks, XMEGATM and others are trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others.
0856I–AVR–07/10