Exchanges
between A and any port location copy the data on the port pins to A, Wherears
the data in A is copied to the port latch. Exchange instructions actually move
data in two directions from source to destination and from destination to
source.
·
Data Exchange
between source and destination:
- XCH A, Rn:
·
Description:
Exchange the data between accumulator and specified register. Here , Register
can be any R0…..R7.
·
Operation:
Aß
Rn.
·
Example:
XCH A, R3.
Suppose A=44H and R3=99H. After
execution of this instruction contents of R3 moved to accumulator and the
contents of accumulator moved to R3 moved to accumulator and the contents of
accumulator moved to R3. i.e. exchange of data between A and R3. Now A=99H and
R3=44H.
- XCH A, direct:
·
Description:
Exchange the data between accumulator and the contents of specified direct
address.
·
Operation:
A ß
(direct address)
·
Example:
XCH A, 03H.
Suppose A=44H and R3=99H
(address of R3 is 03H). After execution of this instruction. Exchange of data
between A and R3 is performed. Now A=99H and R3=44H.
- XCH A, @ Rp:
·
Description:
Exchange the data between accumulator and the contents of specified by registor
Rp (either R0 or R1 in indirect mode)
·
Operation:
Aß
[(Rp)]
·
Example:
XCH A, @ R0
Suppose A= 44H, R0=03H (here R0
is used to point R3) and R3=99H
(address of R3 is 03H). After execution of this instruction , Exchange
of data between A and R3 is performed. Now A=99H and R3=44H
- Exchange lower nibbles of soured and destination:
1. XCHD A, @Rp:
·
Description:
The lower nibbles (lower four bits) in accumulator and lower nibbles of
contents of address stored either in R0 or R1 are exchanged i. e. Exchange
lower nibble of accumulator and the contents of specified by register Rp(either
R0 or R1)
·
Operation:
lower nibble of A-lower nibble [(Rp)]
·
Example:
XCHD A, @R0
Suppose A=40H, R0=03H
(here R0 is used to point R3) and R3=95H (address of R3 is 03H). After
execution of this instruction exchange of lower nibbles between A and R3 is
performed.
Now, A=45H and R3=90H.
0 comments:
Post a Comment
If you have any questions or droughts feel free to ask here.