Friday, September 23, 2011

MOVX dest-byte, source-byte

It moves external memory.
No flags are afffected.
This transfers data between external memory and register A.
this allows us to access external memory connected to the controller.
The address of external memory access can be either 8 bit or 16 bit.

For 16 bit
use DPTR.
like
MOVX A, @DPTR    ;

moves data from external memory stored at address DPTR to accumulator.
External data is moved into the CPU.

MOVX @DPTR, A    ;

moves data from Aaccumulator to address stored at DPTR.
data is moved from CPU to external memory.

For 8 bit
use R0 or R1 register.
like

MOVX A, @Ri ; WHERE i IS 0 OR 1

moves data from external memory stored at address Ri to accumulator.
External data is moved into the CPU.

MOVX @Ri, A ; WHERE i IS 0 OR 1

moves data from Aaccumulator to address stored at Ri.
data is moved from CPU to external memory.

The 16 bit is used for accessing external memory whereas 8 bit is used for accessing external I/O ports.

1 comment: