Micro Processor & Controller
Micro Processor & Controller
Microprocessor:
It is a central processing unit (CPU) that executes instructions fetched from memory.
Typically used in systems where flexibility and computational power are required.
Requires external components like memory, input/output devices, and timers to form a complete
system.
Microcontroller:
Used in embedded systems where compactness, low cost, and low power consumption are crucial.
Includes on-chip memory (RAM, ROM/Flash), timers, serial communication ports, and I/O ports.
CPU Core: Includes an Arithmetic Logic Unit (ALU), a set of registers, and control logic.
Serial Communication Ports: UART (Universal Asynchronous Receiver/Transmitter) for serial communication.
The 8051 microcontroller typically has 40 pins, organized into various functional groups:
In immediate addressing mode, the operand is specified directly within the instruction itself.
Example: MOV A, #25H (moves the immediate value 25H to register A).
In direct addressing mode, the operand is located at a memory location specified directly within
the instruction.
Example: MOV A, 30H (moves the contents of memory location 30H to register A).
In indirect addressing mode, the operand is located at a memory location whose address is
stored in a register or memory location.
Example: MOV A, @R0 (moves the contents of the memory location whose address is stored in
register R0 to register A).
In indexed addressing mode, the operand is located at a memory location specified by adding an
offset to a base register.
Example: MOV A, @DPTR (moves the contents of the memory location pointed to by the data
pointer (DPTR) to register A).
In relative addressing mode, the operand is located at a memory location relative to the current
program counter (PC).
Example: SJMP LABEL (jumps to the specified label relative to the current PC).
In bit addressing mode, individual bits within the internal RAM are accessed directly.
Example: SETB P1.0 (sets bit 0 of port 1).
The 8051 microcontroller has a Harvard architecture with separate program memory and data memory:
The program memory, also known as ROM (Read-Only Memory), stores the program code that
the microcontroller executes.
In the 8051 micro-controller, the program memory typically consists of 4 KB (4,096 bytes) of
ROM.
The program memory is non-volatile, meaning the program code remains stored even when the
power is turned off.
The data memory, also known as RAM (Random Access Memory), is used to store data and
variables during program execution.
In the 8051 micro-controller, the data memory typically consists of 128 bytes of RAM.
The data memory is volatile, meaning the data stored in RAM is lost when the power is turned
off.
The data memory is further divided into multiple banks, each serving specific purposes such as
general-purpose registers, bit-addressable memory, and special function registers.
3. Special Function Registers (SFRs):
The 8051 micro-controller includes a set of special function registers (SFRs) that control various
hardware peripherals and functions of the microcontroller.
The SFRs are memory-mapped registers located within the data memory space.
These registers control features such as I/O ports, timers/counters, serial communication,
interrupt control, and power management.
The 8051 microcontroller supports external data memory expansion through additional RAM
chips connected to its external memory interface.
External RAM can be used to expand the data memory capacity of the microcontroller for
applications requiring larger data storage.
Some variants of the 8051 micro-controller support external program memory expansion
through additional ROM or EPROM chips connected to its external memory interface.
External ROM can be used to expand the program memory capacity of the microcontroller for
applications requiring larger program code storage.
These instructions perform operations on data stored in registers, memory, or I/O ports, facilitating the execution of
programs on the microcontroller.
The 8086 micro-processor, introduced by Intel in 1978, is a 16-bit microprocessor that became one of the most
influential microprocessors in computing history. Here's an explanation of its architecture:
The 8086 microprocessor features a 16-bit data bus, allowing it to transfer data in 16-bit chunks
between the CPU and memory or peripherals.
2. Registers:
Segment Registers: CS (code segment), DS (data segment), SS (stack segment), and ES (extra
segment).
Special-Purpose Registers: IP (instruction pointer), FLAGS (status flags), and various control
registers.
These registers are used for arithmetic and logical operations, addressing, data manipulation, and
control flow within the CPU.
3. Execution Unit:
The 8086 microprocessor contains an execution unit responsible for executing instructions fetched
from memory.
Instructions are fetched from memory and decoded by the instruction decoder before being
executed by the execution unit.
4. Memory Segmentation:
The 8086 uses a memory segmentation model, dividing memory into segments of up to 64 KB each.
Segment registers hold the base addresses of these segments, allowing the processor to access a
larger address space than the 16-bit address bus would normally allow.
Segment: Offset addressing is used to access memory locations, where the physical address is
calculated as Segment * 16 + Offset.
Hardware interrupts are triggered by external devices, while software interrupts are invoked using
the INT instruction.
The Interrupt Vector Table (IVT) is a table of interrupt vectors that contains the addresses of interrupt
service routines (ISRs) for handling interrupts.
6. Modes of Operation:
The 8086 can operate in two modes: real mode and protected mode.
Real mode provides a compatibility mode for running legacy software and allows access to only 1 MB
of memory.
Protected mode enables features like virtual memory, memory protection, and multitasking, allowing
access to up to 4 GB of memory.
7. Instruction Set:
The 8086-instruction set is based on the x86 architecture and includes a wide range of instructions
for arithmetic, logical, data transfer, and control operations.
Instructions are variable-length, with opcodes ranging from one to six bytes.
Instructions are classified into groups such as data transfer, arithmetic, logical, control transfer, and
string manipulation.
It divides the memory into multiple segments, each with its own base address and size.
Segmentation provides a flexible way to access memory and supports memory protection and sharing.
3. Simplified memory management with logical segmentation of code, data, and stack.
The 8086 microprocessor has several types of registers, including general-purpose registers, segment
registers, and special-purpose registers.
Segment registers: CS (code segment), DS (data segment), SS (stack segment), and ES (extra segment).
Special-purpose registers: IP (instruction pointer), FLAGS (status flags), and various control registers.
Register organization allows efficient data manipulation, addressing, and control flow within the CPU.
3. Interrupts:
Interrupts are signals generated by external devices or internal events to request attention from the CPU.
Hardware interrupts are triggered by external devices such as I/O devices, timers, and peripherals.
Software interrupts are triggered by software instructions (INT) to invoke specific interrupt service
routines (ISRs).
Interrupt handling involves saving the current state of the CPU, executing the ISR, and restoring the state
after servicing the interrupt.
The 8086 has a dedicated interrupt vector table (IVT) to store the addresses of ISR routines.
Interrupts can be prioritized using interrupt masks and handled asynchronously to improve system
responsiveness.
The address bus is a set of wires used to carry memory addresses from the CPU to memory and I/O
devices.
The data bus is a set of wires used to carry data between the CPU, memory, and I/O devices.
The width of the address bus determines the maximum amount of memory that can be addressed.
The width of the data bus determines the maximum size of data that can be transferred in a single cycle.
Address and data buses are vital components of the CPU-memory interface, enabling data transfer and
communication within the system.
The 8086 microprocessor has a 20-bit address bus and a 16-bit data bus.
1. Data Bus:
The data bus is a bi-directional pathway that allows the transfer of data between the CPU and
external devices such as memory and input/output (I/O) devices.
In the 8086 microprocessor, the data bus is 16 bits wide, allowing it to transfer data in 16-bit chunks
or words.
The data bus carries information such as instructions, operands, and data during the execution of
programs.
It is responsible for transmitting data both to and from memory, as well as between the CPU and I/O
devices.
2. Address Bus:
The address bus is a unidirectional pathway that carries memory addresses generated by the CPU to
access specific locations in memory or I/O ports.
In the 8086 microprocessor, the address bus is 20 bits wide, allowing it to address up to 1 MB (2^20)
of memory locations.
The address bus is used to specify the memory location or I/O port to read from or write to during
memory or I/O operations.
When the CPU initiates a memory read or write operation, it places the memory address on the
address bus, enabling the memory or I/O device to respond accordingly.
3. Functionality:
During a memory read operation, the CPU places the desired memory address on the address bus,
and the data stored at that memory location is transferred back to the CPU via the data bus.
Similarly, during a memory write operation, the CPU places the memory address and the data to be
written on the address bus and data bus, respectively, and the data is stored at the specified memory
location.
The address bus and data bus work together to enable the CPU to communicate with memory and
peripherals, facilitating the execution of programs and the transfer of data in a computer system.
Memory size calculation in the 8086 microprocessor is based on the number of addressable locations
and the size of each location.
With a 20-bit address bus, the 8086 can address 2^20 (1,048,576) memory locations.
The size of each memory location depends on the data bus width, which is 16 bits for the 8086.
Therefore, the total memory size that can be addressed by the 8086 is 1,048,576 * 16 bits = 2^20 bytes =
1 MB.
The execution of instructions is divided into multiple stages, and each stage is performed concurrently for
different instructions.
Pipelining reduces the overall execution time by allowing the CPU to start executing the next instruction
before completing the current one.
The basic idea behind pipelining is to minimize idle time and maximize throughput by keeping the CPU
busy with multiple instructions in different stages of execution.
The 8086 microprocessor does not support pipelining due to its simple architecture and single-cycle
instruction execution.
However, modern microprocessors, such as those based on the x86 architecture, use pipelining
extensively to achieve higher performance.