Wednesday, March 2, 2016

8051 XCH Instruction

Exchange Accumulator with byte variable

InstructionXCH A,byte
FunctionExchange Accumulator with byte variable
DescriptionXCH loads the Accumulator with the contents of the indicated variable, at the same time writing the original Accumulator contents to the indicated variable. The source/destination operand can use register, direct, or register-indirect addressing.
ExampleR0 contains the address 20H. The Accumulator holds the value 3FH (0011111lB). Internal RAM location 20H holds the value 75H (01110101B). The following instruction,
XCH A,@R0
leaves RAM location 20H holding the values 3FH ( 00111111B) and 75H (01110101B) in the accumulator.
VariantsXCH A, Rn
XCH A, direct address
XCH A,@Ri

InstructionXCH A, Rn
Bytes1
Cycles1
Encoding1 1 0 0 1 n n n
OperationA swap Rn
Flags AffectedC AC F0 RS1 RS0 OV P
ExampleXCH A, R6
Bytes: Number of bytes required to encode the instruction.
Cycles: Number of instruction cycles required to execute the instruction. Note that there are 12 oscillator cycles to one instruction cycle on a standard 8051.
Encoding: Lists the byte encoding for the instruction.
Operation: Lists, step-by-step, the operations performed by the instruction.
Flags Affected: are highlighted in Bold

InstructionXCH A, direct address
Bytes2
Cycles1
Encoding1 1 0 0 0 1 0 1 A7...A0
OperationA swap (direct)
Flags AffectedC AC F0 RS1 RS0 OV P
ExampleXCH A, 45h
Bytes: Number of bytes required to encode the instruction.
Cycles: Number of instruction cycles required to execute the instruction. Note that there are 12 oscillator cycles to one instruction cycle on a standard 8051.
Encoding: Lists the byte encoding for the instruction.
Operation: Lists, step-by-step, the operations performed by the instruction.
Flags Affected: are highlighted in Bold

InstructionXCH A,@Ri
Bytes1
Cycles1
Encoding1 1 0 0 0 1 1 i
OperationA swap (Ri)
Flags AffectedC AC F0 RS1 RS0 OV P
ExampleXCH A, @R0
Bytes: Number of bytes required to encode the instruction.
Cycles: Number of instruction cycles required to execute the instruction. Note that there are 12 oscillator cycles to one instruction cycle on a standard 8051.
Encoding: Lists the byte encoding for the instruction.
Operation: Lists, step-by-step, the operations performed by the instruction.
Flags Affected: are highlighted in Bold



Related topics:
8051 Data Transfer Instructions   |   8051 MOV Instruction   |   8051 MOVC Instruction   |   8051 MOVX Instruction   |   8051 PUSH Instruction   |   8051 POP Instruction   |   8051 XCHD Instruction

List of topics: 8051

No comments:

Post a Comment