External Direct Addressing

5.5 External Direct Addressing

External memory is accessed using a suite of instructions that use external direct addressing. It is referred to as external direct because it appears to be direct addressing, but it is used to access external memory rather than internal memory.

There are only two commands that use external direct addressing mode:

MOVX A,@DPTR

MOVX @DPTR,A

As you can see, both commands use DPTR. In these instructions, DPTR must first be loaded with the address of external memory that you wish to read or write. Once DPTR holds the correct external memory address, the first com- mand moves the contents of that external memory address into the accumula- tor. For example, if you want to read the contents of external RAM address

1516H, execute the instructions:

MOV DPTR,#1516h ;Select the external address to read

MOVX A,@DPTR

;Move the contents of external RAM into

 

;accumulator

The second command does the opposite: it allows you to write the value of the accumulator to the external memory address pointed to by DPTR. For exam- ple, if you want to write the contents of the accumulator to external RAM ad- dress 1516H, execute the instructions:

MOV DPTR,#1516h ;Select the external address to read

MOVX @DPTR,A

;Move the contents of external RAM into

 

;accumulator

MOVX to data flash memory writes to the data flash memory location. To clear the flash content, page erase is needed.

Addressing Modes

5-5

 

Page 59
Image 59
Texas Instruments MSC1210 manual External Direct Addressing, Movx A,@DPTR Movx @DPTR,A