In 8051 micro controller have in built RAM and ROM,but size of this memory is limited size of RAM is 128 byte while size of ROM is 4KB some time we need more memory then this so we connect external memory with micro controller.
access external RAM
To access external RAM we used MOVX instruction.
MOVX A,@DPTR;this code used for read data from external RAM.
MOVX @DPTR,A;this code used for write data into external RAM.
access External ROM
MOVC A,@A+DPTR; to read data from ROM.
here we add content of A and DPTR and then using indirect addressing mode we copy the content of that location into A.
MOVC A,@A+PC; to read data from ROM.
we increment content of PC and then add with A.then we copy the content of that location into A using indirect addressing mode.
External program memory is accessed under the following condition.
- Whenever is low, or
- Whenever PC contains a number higher than 0FFFH (for 8051) or 1FFF (for 8052).
Some typical use of code/program memory access:
External program memory
can be not only used to store the code, but also for lookup table of
various functions required for a particular application. Mathematical
functions such as Sine, Square root, Exponential, etc. can be stored in
the program memory (Internal or eternal) and these functions can be
accessed using MOVC instruction.
PREVIOUS:Serial communication NEXT: push & pop operation
1 comments:
Excellent post. Keep posting such kind of info on your blog.
mlsu ba 2nd year result 2022 subject wise
Post a Comment