Detailed explanation of 8051 microcontroller instruction definition - ADD A, (2)

Publisher:艺泉阁Latest update time:2016-03-18 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
 Detailed explanation of 8051 MCU instruction definition - (ADD A, )

 

ADD A,

 


Function: Addition.
Description: The ADD instruction can be used to complete the addition of the source operand indicated by src-byte and the current value of accumulator A. The result is placed in accumulator A. According to the operation result, if there is a carry in the 7th bit, the carry flag is set to 1, otherwise it is cleared; if there is a carry in the 3rd bit, the auxiliary carry flag is set to 1, otherwise it is cleared. If it is an unsigned integer addition, the carry bit is set to indicate that the current operation result has overflowed.

    If a carry is generated from bit 6 but not bit 7, or if a carry is generated from bit 7 but not bit 6, OV is set to 1, otherwise OV is cleared to 0. When adding signed integers with carry, OV is set to indicate that the sum of two positive integers is a negative number, or the sum of two negative integers is a positive number.

    The source operands of this type of instructions can accept four addressing modes: register addressing, direct addressing, register indirect addressing, and immediate addressing.
Example: Assume that the data in accumulator A is 0C3H (11000011B), and the value of R0 is 0AAH (10101010B).
Execute the following instruction:
ADD     A,
the result in accumulator A in R0 is 6DH (01101101B), the auxiliary carry flag AC is cleared, and the carry flag C and overflow flag OV are set.

ADD A, Rn
    Number of bytes: 1
 Execution cycle: 1
   Machine: 00101rrr
     Operation: (A)←(A)+(Rn)

ADD A, direct
   Number of bytes: 2
 Execution cycles: 1
   Machine: 00100101 aaaaaaaa
     Operation: (A)←(A)+(direct)

ADD A, @Ri
  Bytes: 1

 Execution cycle: 1
  Machine: 0010011i
    Operation: (A)←(A)+((Ri))

ADD A, #data
  Number of bytes: 2
 Execution cycle: 1
  Machine: 00100100 dddddddd
    Operation: (A)←(A)+#data

Reference address:Detailed explanation of 8051 microcontroller instruction definition - ADD A, (2)

Previous article:Detailed explanation of 8051 microcontroller instruction definition - ADDC A, (3)
Next article:Detailed explanation of 8051 microcontroller instruction definition - ACALL addr11 (1)

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号