算术指令是执行基本算术运算(例如加法,减法,乘法等)的指令。AVR微控制器有2个操作数,它们实际上是保存数据的寄存器。左寄存器是源寄存器,右寄存器是源寄存器。
下表显示了算术指令:
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 |
注意:此处D和S分别代表“目标”和“源”。
D和S是寄存器。 AVR中没有划分指令。