Monday, February 29, 2016

8051 DIV Instruction

Division

InstructionDIV AB
FunctionDivide
Bytes1
Cycles4
Encoding1 0 0 0 0 1 0 0
OperationAB = A / B
DescriptionDIV AB divides the unsigned eight-bit integer in the Accumulator by the unsigned eight-bit integer in register B. The Accumulator receives the integer part of the quotient; register B receives the integer remainder. The carry and OV flags are cleared.
Exception: if B had originally contained 00H, the values returned in the Accumulator and B-register are undefined and the overflow flag are set. The carry flag is cleared in any case.
Flags AffectedC AC F0 RS1 RS0 OV P
ExampleThe Accumulator contains 251 (0FBH or 11111011B) and B contains 18 ( 12H or 00010010B). The following instruction,
DIV AB
leaves 13 in the Accumulator (0DH or 00001101B) and the value 17 (11H or 00010001B) in B, since 251 = (13 x 18) + 17. Carry and OV are both cleared.



Related topics:
8051 Arithmetic Operation Instructions   |   8051 ADD Instruction   |   8051 ADDC Instruction   |   8051 SUBB Instruction   |   8051 INC Instruction   |   8051 DEC Instruction   |   8051 MUL Instruction   |   8051 DA Instruction

List of topics: 8051

No comments:

Post a Comment