Arithmetic instructions in AVR microcontroller

Arithmetic Instructions are the instructions which perform basic arithmetic operations such as addition, subtraction, multiplication, etc. AVR micro-controller has 2 operands which are actually registers that hold the data. The left register is the source register while the right one is the source register.



The following table shows the arithmetic instructions :

Instruction Operand Explanation Example
ADD D, S D = D+ S ADD D, S
ADC D, S D = D+ S+ carry ADC D, K
SUB D, S D = D- S SUB D, S
SBC D, S D = D- S- carry SBC D, S
MUL Unsigned nos. R1= Higher byte of the result

R0= Lower byte of the result

MUL D, S
MULS Signed nos. R1= Higher byte of the result



R0= Lower byte of the result

MULS D, S
MULSU Signed nos. and Unsigned nos. R1= Higher byte of the result

R0= Lower byte of the result

MULSU D, S
INC D D= D+1 INC D
DEC D D= D-1 DEC D

Note : Here D and S stand for Destination and Source respectively.
D and S are registers. There is no instruction for division in AVR.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.