Datasheet

ADE5166/ADE5169/ADE5566/ADE5569 Data Sheet
Rev. D | Page 90 of 156
INSTRUCTIONS THAT AFFECT FLAGS
Many instructions explicitly modify the carry bit, such as the
MOV C bit and CLR C instructions. Other instructions that
affect status flags are listed in this section.
ADD A, Source
This instruction adds the source to the accumulator. No status
flags are referenced by the instruction.
Table 70. ADD A (Source) Affected Status Flags
Flag Description
C
Set if there is a carry out of Bit 7. Cleared otherwise. Used
to indicate an overflow if the operands are unsigned.
OV Set if there is a carry out of Bit 6 or a carry out of Bit 7, but
not if both are set. Used to indicate an overflow for
signed addition. This flag is set if two positive operands
yield a negative result or if two negative operands yield a
positive result.
AC Set if there is a carry out of Bit 3. Cleared otherwise.
ADDC A, Source
This instruction adds the source and the carry bit to the accu-
mulator. The carry status flag is referenced by the instruction.
Table 71. ADDC A (Source) Affected Status Flags
Flag Description
C Set if there is a carry out of Bit 7. Cleared otherwise. Used
to indicate an overflow if the operands are unsigned.
OV Set if there is a carry out of Bit 6 or a carry out of Bit 7, but
not if both are set. Used to indicate an overflow for
signed addition. This flag is set if two positive operands
yield a negative result or if two negative operands yield a
positive result.
AC Set if there is a carry out of Bit 3. Cleared otherwise.
SUBB A, Source
This instruction subtracts the source byte and the carry (borrow)
flag from the accumulator. It references the carry (borrow)
status flag.
Table 72. SUBB A (Source) Affected Status Flags
Flag Description
C Set if there is a borrow needed for Bit 7. Cleared other-
wise. Used to indicate an overflow if the operands are
unsigned.
OV Set if there is a borrow needed for Bit 6 or Bit 7, but not
for both. Used to indicate an overflow for signed sub-
traction. This flag is set if a negative number subtracted
from a positive number yields a negative result or if a
positive number subtracted from a negative number
yields a positive result.
AC Set if a borrow is needed for Bit 3. Cleared otherwise.
MUL AB
This instruction multiplies the accumulator by the B SFR. This
operation is unsigned. The lower byte of the 16-bit product is
stored in the accumulator and the higher byte is left in the B
register. No status flags are referenced by the instruction.
Table 73. MUL AB Affected Status Flags
Flag Description
C Cleared.
OV Set if the result is greater than 255. Cleared otherwise.
DIV AB
This instruction divides the accumulator by the B SFR. This
operation is unsigned. The integer part of the quotient is stored
in the accumulator and the remainder goes into the B register.
No status flags are referenced by the instruction.
Table 74. DIV AB Affected Status Flags
Flag Description
C Cleared.
OV Cleared unless the B register is equal to 0, in which
case the results of the division are undefined and the
OV flag is set.
DA A
This instruction adjusts the accumulator to hold two 4-bit digits
after the addition of two binary coded decimals (BCDs) with the
ADD or ADDC instructions. If the AC bit is set or if the value of
Bit 0 to Bit 3 exceeds 9, 0x06 is added to the accumulator to cor-
rect the lower four bits. If the carry bit is set when the instruction
begins, or if 0x06 is added to the accumulator in the first step, 0x60
is added to the accumulator to correct the higher four bits.
The carry and AC status flags are referenced by this instruction.
Table 75. DA A Affected Status Flag
Flag Description
C Set if the result is greater than 0x99. Cleared otherwise.
RRC A
This instruction rotates the accumulator to the right through
the carry flag. The old LSB of the accumulator becomes the new
carry flag, and the old carry flag is loaded into the new MSB of
the accumulator.
The carry status flag is referenced by this instruction.
Table 76. RRC A Affected Status Flag
Flag Description
C Equal to the state of ACC[0] before execution of the
instruction.