Module 1 : Introduction to Microcontrollers

Lecture 4: Organization of Data Memory

DATA Memory

Data memory can be classified into the following categories
  • Bits
  • Registers
  • Variable RAM
  • Program counter stack

Microcontroller can have ability to perform manipulation of individual bits in certain registers(bit manipulation). This is a unique feature of a microcontroller, not available in a microprocessor.

Eight bits make a byte. Memory bytes are known as file registers.

Registers are some special RAM locations that can be accessed by the processor very easily.

Fig 4.1  Static RAM (SRAM) memory cell

Fig 4.2  SRAM memory cell equivalent

The figure of a single SRAM cell is shown above. This consists of two CMOS inverters connected back to front, so as to form a latch.

Processor stacks store/save the data in a simple way during program execution. Processor stack is a part of RAM area where the data is saved in a Last In First Out (LIFO) fashion just like a stack of paper on a table. Data is stored by executing a 'push' instruction and data is read out using a 'pop' instruction.

I/O Registers:
In addition to the Data memory, some special purpose registers are required that are used in input/output and control operations. These registers are called I/O registers. These are important for microcontroller peripheral interface and control applications.

Hardware interface registers (I/O Space)

As we already know a microcontroller has some embedded peripherals and I/O devices. The data transfer to these devices takes place through I/O registers. In a microprocessor, input /output (I/O) devices are externally interfaced and are mapped either to memory address (memory mapped I/O) or a separate I/O address space (I/O mapped I/O).

In a microcontroller, two possible architectures can be used i.e., Princeton(Von Neumann) architecture and Harvard architecture.

I/O Register space in Princeton architecture :

In Princeton architecture we have only one memory interface for program memory (ROM) and data memory (RAM). One option is to map the I/O Register as a part of data memory or variable RAM area. This architecture is simple and straight forward. This is called memory mapped I/O. Alternatively a separate I/O register space can be assigned.

Fig 4.3  I/O Registers in Princeton Architecture

The drawback of memory mapped I/O is that a program which wrongly executed may overwrite I/O registers.

 
I/O Registers space in Harvard Architecture :

These are the following options available for I/O register space in Harvard Architecture.

  1. I/O registers in program ROM.
  2. I/O registers in register space (Data Memory area).
  3. I/O registers in separate space.
                         
Fig  4.4  Organisation of I/O registers in Harward Architecture

The first option is somewhat difficult to implement as there is no means to write to program ROM area. It is also complicated to have a separate I/O space as shown in (3). Hence the second option where I/O registers are placed in the register space is widely used.