📜  AVR微控制器中的逻辑指令

📅  最后修改于: 2021-06-28 16:34:38             🧑  作者: Mango

逻辑指令是执行基本算术运算(例如AND,OR,XOR等)的指令。在AVR微控制器中,目标操作数始终是寄存器。

下表显示了逻辑指令:

Instruction Operand Explanation Example
AND D, S D = D AND S
Performs a AND operation on the operands
and stores the result in the left hand operand
AND D, S
ANDI D, k(constant) D = D AND k
Performs a AND operation on the operands
and stores the result in the left hand operand with the right hand operand being a constant
ANDI D, k
OR D, S D = D OR S
Performs a OR operation on the operands
and stores the result in the left hand operand
OR D, S
ORI D, k D = D OR k
Performs a OR operation on the operands
and stores the result in the left hand operand with the right hand operand being a constant
ORI D, k
EOR D, S D = D XOR S
Performs a EX-OR operation on the operands
and stores the result in the left hand operand
EOR D, S
COM D. D = 1’s complement of D
The complement action changes ‘1’s to ‘0’s
and ‘0’s to ‘1’s
COM D NEG D D = 2’s complement of D
This instruction takes the 2’s complement
NEG D
CP D, S Compares D and S
This instruction is really a subtraction action.
The only difference is that the values of registers don’t change
CP D, S
CPI D, k Compares D and k
The only difference between CP an CPI is that
CPI has one of the operands as a constant
CP D, k

笔记 :
D和S分别是目标和源。两者都是寄存器。 k是一个常数。