Programming Microcontrollers

ADD Instruction in Intel 8051 (MCS-51) Microcontroller

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
Share
John Mulindi

John Mulindi has a background in a technical field and he writes on topics ranging from automation, computer systems, embedded systems, mechatronics to measurement and control.

Recent Posts

Key Features of PIC16X84 Family of Microcontrollers

PIC microcontrollers are fabricated by Microchip Technology. PIC16C84 and PIC16F84 are the two microcontrollers in…

3 months ago

How to Create a PIC Tracing LEDs Project in C

I am creating this project in C language using MPLAB X IDE XC8 compiler. However,…

3 months ago

Main Features of Intel 8086 Microprocessor

8-bit microprocessors are limited in their speed (the number of instructions that can be executed…

3 months ago

Basic Features of 68HC11 Family of Microcontrollers

The 68HC11 (also abbreviated as 6811 or HC11) is an 8-bit microcontroller that was introduced…

3 months ago

Process Synchronization using Semaphores

Mutual exclusion typically imposes some conditions on access to a given resource by two or…

4 months ago

The Procedure for Designing a Microcontroller-Based System

In envisaging a new microcontroller design, it is prudent to follow a design procedure that…

4 months ago