The architecture of 8051 microcontroller can be divided into five main sections: the CPU, the program memory, the data memory, the input/output (I/O) ports and the timer and control unit.
- The CPU of the 8051 microcontroller is an 8-bit processor that can execute instructions at a clock speed of up to 12 MHz.
- The CPU consists of several registers that are used to store data and control the operation of the microcontroller. These registers include the accumulator, the program counter, the stack pointer, and several general-purpose registers.
- The accumulator is a special register that is used to store the results of arithmetic and logical operations performed by the CPU.
- The program counter is a register that keeps track of the address of the next instruction to be executed.
- The stack pointer is a register that points to the top of the stack, which is a region of memory used to store temporary data during the execution of a program.
- The general-purpose registers are used to store data during program execution.
- The CPU of the 8051 microcontroller supports a range of instructions, including arithmetic, logic, and data transfer instructions. It also supports branching and looping instructions, which are used to implement control structures such as loops and conditional statements.
- The program memory of the 8051 microcontroller is used to store the program code that the microcontroller executes. The program memory can be either ROM or Flash memory.
- The size of the program memory varies from 2K to 64K bytes, depending on the specific model of the microcontroller.
- The program memory is divided into two sections: the code memory and the data memory.
- The code memory is used to store the executable code, while the data memory is used to store constant data such as tables and lookup values.
- The data memory of the 8051 microcontroller is used to store data that is used by the microcontroller during operation. The data memory can be either internal RAM or external RAM.
- The size of the data memory varies from 128 bytes to 256 bytes for internal RAM, and up to 64K bytes for external RAM.
- The data memory is divided into two sections: the general-purpose registers and the SFRs (special function registers).
- The general-purpose registers are used to store data during program execution, while the SFRs are used to control the operation of the microcontroller and to interface with external devices.
Input/Output (I/O) Ports:
- The I/O ports of the 8051 microcontroller are used to interface with the outside world. The 8051 microcontroller has four ports, each of which can be configured as either input or output. The ports are named Port 0, Port 1, Port 2, and Port 3.
- Port 0 is an 8-bit bidirectional port that can be used to interface with external devices.
- Port 1 is also an 8-bit bidirectional port that can be used to interface with external devices.
- Port 2 is an 8-bit port that is used to interface with external memory devices.
- Port 3 is an 8-bit port that is used to interface with external interrupt sources.
- In addition to the four I/O ports, the 8051 microcontroller also has several other I/O pins, including the Reset pin, the XTAL1 and XTAL2 pins, and the ALE (Address Latch Enable) pin. These pins are used for various purposes, such as system reset, clock input, and address bus control.
Timer and Control Unit
- The main function of a timer is to make a delay otherwise time gap among two events.
- This microcontroller includes two timers where each timer is 16-bit where the system can generate two delays concurrently to produce the suitable delay.
- The delay can be generated through the timer based on the requirement of the processor & transmits the signal to the processor whenever the particular delay gets generated.
- By using this processor, we can also produce a delay based on the requirement of the system. However, this will guide to remain the processor active all the time because it will not perform any other task in that specific period.
- As a result, the existence of a timer within the microcontroller permits the processor to be free for performing other operations.