8051 Instruction Set Manual

XCH

The XCH instruction loads the accumulator with the byte value of the specified operand while simultaneously storing the previous contents of the accumulator in the specified operand.

See Also: SWAP, XCHD

XCH A, @Ri
CACF0RS1RS0OV P
Bytes1
Cycles1
Encoding
1100011i
Operation
XCH
A swap (Ri)
Example
XCH A, @R0
XCH A, direct
CACF0RS1RS0OV P
Bytes2
Cycles1
Encoding
11000101direct
Operation
XCH
A swap (direct)
Example
XCH A, 45h
XCH A, Rn
CACF0RS1RS0OV P
Bytes1
Cycles1
Encoding
11001nnn
Operation
XCH
A swap Rn
Example
XCH A, R6