Electronic Circuits and Tutorials
HomeElectronics Tutorials > Microcontroller Tutorials > 8051 / 8052 - Instruction Set > ADD, ADDC - Add Accumulator, Add Accumulator with Carry
8051/8052 Microcontroller Tutorial

8051 / 8052 Microcontroller Instruction Set :
ADD, ADDC - Add Accumulator,
Add Accumulator with Carry

Operation: ADD, ADDC
Function: Add Accumulator, Add Accumulator With Carry
Syntax: ADD A,operand
  ADDC A,operand

Instructions OpCode Bytes Cycles Flags
ADD A,#data 0x24 2 1 C, AC, OV
ADD A,iram addr 0x25 2 1 C, AC, OV
ADD A,@R0 0x26 1 1 C, AC, OV
ADD A,@R1 0x27 1 1 C, AC, OV
ADD A,R0 0x28 1 1 C, AC, OV
ADD A,R1 0x29 1 1 C, AC, OV
ADD A,R2 0x2A 1 1 C, AC, OV
ADD A,R3 0x2B 1 1 C, AC, OV
ADD A,R4 0x2C 1 1 C, AC, OV
ADD A,R5 0x2D 1 1 C, AC, OV
ADD A,R6 0x2E 1 1 C, AC, OV
ADD A,R7 0x2F 1 1 C, AC, OV

 

Instructions OpCode Bytes Cycles Flags
ADDC A,#data 0x34 2 1 C, AC, OV
ADDC A,iram addr 0x35 2 1 C, AC, OV
ADDC A,@R0 0x36 1 1 C, AC, OV
ADDC A,@R1 0x37 1 1 C, AC, OV
ADDC A,R0 0x38 1 1 C, AC, OV
ADDC A,R1 0x39 1 1 C, AC, OV
ADDC A,R2 0x3A 1 1 C, AC, OV
ADDC A,R3 0x3B 1 1 C, AC, OV
ADDC A,R4 0x3C 1 1 C, AC, OV
ADDC A,R5 0x3D 1 1 C, AC, OV
ADDC A,R6 0x3E 1 1 C, AC, OV
ADDC A,R7 0x3F 1 1 C, AC, OV

Description: ADD and ADDC both add the value operand to the value of the Accumulator, leaving the resulting value in the Accumulator. The value operand is not affected. ADD and ADDC function identically except that ADDC adds the value of operand as well as the value of the Carry flag whereas ADD does not add the Carry flag to the result.

The Carry bit (C) is set if there is a carry-out of bit 7. In other words, if the unsigned summed value of the Accumulator, operand and (in the case of ADDC) the Carry flag exceeds 255 Carry is set. Otherwise, the Carry bit is cleared.

The Auxiliary Carry (AC) bit is set if there is a carry-out of bit 3. In other words, if the unsigned summed value of the low nibble of the Accumulator, operand and (in the case of ADDC) the Carry flag exceeds 15 the Auxiliary Carry flag is set. Otherwise, the Auxiliary Carry flag is cleared.

The Overflow (OV) bit is set if there is a carry-out of bit 6 or out of bit 7, but not both. In other words, if the addition of the Accumulator, operand and (in the case of ADDC) the Carry flag treated as signed values results in a value that is out of the range of a signed byte (-128 through +127) the Overflow flag is set. Otherwise, the Overflow flag is cleared.

See Also: SUBB, DA, INC, DEC, Instruction Set


Note: To report broken links or to submit your projects, tutorials please email to Webmaster