Microcontrollers in Practice

A.7: AVR Instruction Set

A.7 AVR Instruction Set

Arithmetic and Logic Instructions

Mnemonic

Description

Operation

Flags

ADD

Rd, Rr

Add two Registers

Rd ? Rd + Rr

Z,C,N,V,H

ADC

Rd, Rr

Add with Carry two Registers

Rd ? Rd + Rr + C

Z,C,N,V,H

ADIW

Rdl.K

Add Immediate to Word

Rdh:Rd1 ? Rdh:Rdl + K

Z,C,N,V,S

SUB

Rd, Rr

Subtract two Registers

Rd ? Rd - Rr

Z,C,N,V,H

SUBI

Rd, K

Subtract Constant from Register

Rd ? Rd - K

Z,C,N,V,H

SBC

Rd, Rr

Subtract with Carry two Registers

Rd ? Rd - Rr - C

Z,C,N,V,H

SBCI

Rd, K

Subtract with Carry Constant from Reg.

Rd ? Rd - K - C

Z,C,N,V,H

SBIW

Rdl.K

Subtract Immediate from Word

Rdh:Rdl ? Rdh:Rdl -,K

Z,C,N,V,S

AND

Rd, Rr

Logical AND Registers

Rd ? Rd Rr

Z,N,V

ANDI

Rd,K

Logical AND Register and Constant

Rd ? Rd K

Z,N,V

OR

Rd, Rr

Logical OR Registers

Rd ? Rd v Rr

Z,N,V

ORI

Rd, K

Logical OR Register and Constant

Rd ? Rd v K

Z,N,V

FOR

Rd, Rr

Exclusive OR Reqisters

Rd ? Rd 0 Rr

Z,N,V

COM

Rd

One's Complement

Rd ? 0xFF - Rd

Z,C,N,V

NEG

Rd

Two's Complement

Rd ? 0x00 - Rd

Z,C,N,V,H

SBR

Rd,K

Set Bit(s) in Register

Rd ? Rd v K

Z,N,V

CBR

Rd,K

Clear Bit(s) in Register

Rd ? Rd (OXff - K)

Z,N,V

INC

Rd

Increment

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Flip-Flops
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.