The ADD instruction tells the microcontroller’s CPU to add the source byte to register A and put the result in register A. Recall, A is the accumulator register typically used for all arithmetic and logic instructions.
The ADD instruction is usually in the following form:
ADD A, source ; ADD the source operand to the accumulator
The source operand can be either a register or immediate data, but the destination register must always be register A.
Example of ADD instruction:
MOV A, #23H ; load 23H i.e. in hexadecimal into register A
MOV R2, #28H ; load 28H into register R2
ADD A, R2 ; add contents of R2 to A thus, A = A + R2
The following instructions aren’t allowed:
ADD R2, A ; Not allowed as A must always be the destination register
ADD R2, #25 ; Not allowed as destination register is not A
You may also read:
- The MOV Instruction in Intel 8051 (MCS-51) Microcontroller
- The Basic Structure of Intel 8051 Microcontroller
- The Intel 8085 Microprocessor
- Main Features of Intel 8086 Microprocessor
- Main Features of 80C51, 87C51 and 80C31 Microcontrollers
- An Overview of Assembly Language for Programming Microcontrollers
Please follow us and share:
Leave a Reply