Showing posts with label RAM. Show all posts
Showing posts with label RAM. Show all posts

Wednesday, September 11, 2013

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.
  1. Whenever is low, or
  2. 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

Monday, July 1, 2013

8051 Micro controller is 8-bit controller.it contain 128Byte of internal RAM.internal RAM divided into three section.
  • 32 bytes-Register Bank.
  • 16 Byte-bit addressable area.
  •  80 byte-Scratch pad area & SFR.

below diagram show architecture of RAM



32 Byte-Register Bank
there are four register bank into RAM.each register bank contain 8 registers of 1byte.so total 32 register in register bank.by default register bank 0 is selected.to change the register bank we have to set value of two register selection bit in PSW register.
16Byte for bit addressable Area.
In RAM there are 16 byte area in which 128 bit we can accessed by suitable instruction.the address range of bits addressable area is 00h (LSB of first byte of 20h ) to 7Fh(MSB of last byte if 2Fh).
remaining 80 bytes are general purpose area which are shared with DATA and SFR (special function register)upper 128 byte of RAM accessed indirect addressing while SFR accessed by direct addressing only.SFR contain special register like ACC,B,IE,IP,IE etc.below diagram show memory allocation for SFR.


 
Related Posts Plugin for WordPress, Blogger...
Subscribe to RSS Feed Follow me on Twitter!