Intel MCS 51 User Manual page 88

Table of Contents

Advertisement

int&
MCS@-51PROGRAMMER'SGUIDE AND INSTRUCTION SET
MOVX
<dest-byte>, <sin-byte>
Function:
Move External
Deaoription:
The MOVX
instructions transfer data betweenthe Accumulator and a byte of exa
data
memory,hence the "X" appendedto MOV.There are two types of instructions,differingin
whetherthey providean eight-bitor sixteen-bitindirect address to the externrddata RAM.
In the first typq the contents of ROor R] in the current register bank providean eight-bit
address multiplexedwith data on PO.Eight bits are sufficient for external 1/0 expansion
decodingor for a relativelysmall RAM array. For somewhatlarger arrays, any output port
pins can be used to output higher-orderaddress bits. These pins wouldbe controlled by an
output instructionprecedingthe MOVX.
In the secondtype of MOVXinstruction,the Data Pointer generatesa sixteen-bitaddress. P2
outputsthe high-ordereight addressbits (the contents of DPH) whilePOmultiplexesthe low-
order eightbits (DPL) with data. The P2 SpecialFunction Register retains its previouscon-
tents whilethe P2 ouQut buffers are emitting the contents of DPH. This form is faster and
more efticientwhen accessingvery large data arrays (up to 64K bytes), since no additional
instructionsare neededto set up the output ports.
It is possiblein some situations to mix the two MOVX types. A large R4M array with its
high~rder address lines driven by P2 can be addressed via the Data Pointer,or with code to
output high-orderaddress bits to P2 followedby a MOVX instructionusingROor RI.
Example:
An external256 byte RAM using
multiplexed a ddress/&talines(e.g.,an Mel
8155UM/
I/Oflimer) is connected to the 8051Port O. Port 3 provides control lines for the external
W.
Ports 1 and 2 are used for normal 1/0. Registers O and 1 contain 12H and 34H.
Location34Hof the extemsJ RAM holdsthe value 56H. The instructionsequence,
MOVX A@Rl
MOVX
@RO,A
copiesthe value 56H into both the Accumulatorand external RAM location 12H.
2-58

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents