Exchange Accumulator with byte variable
Instruction | XCH A,byte |
---|---|
Function | Exchange Accumulator with byte variable |
Description | XCH 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. |
Example | R0 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. |
Variants | XCH A, Rn XCH A, direct address XCH A,@Ri |
Instruction | XCH A, Rn |
---|---|
Bytes | 1 |
Cycles | 1 |
Encoding | 1 1 0 0 1 n n n |
Operation | A swap Rn |
Flags Affected | C AC F0 RS1 RS0 OV P |
Example | XCH 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 |
Instruction | XCH A, direct address |
---|---|
Bytes | 2 |
Cycles | 1 |
Encoding | 1 1 0 0 0 1 0 1 A7...A0 |
Operation | A swap (direct) |
Flags Affected | C AC F0 RS1 RS0 OV P |
Example | XCH 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 |
Instruction | XCH A,@Ri |
---|---|
Bytes | 1 |
Cycles | 1 |
Encoding | 1 1 0 0 0 1 1 i |
Operation | A swap (Ri) |
Flags Affected | C AC F0 RS1 RS0 OV P |
Example | XCH 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