01 Module-1 MC 2022-23
01 Module-1 MC 2022-23
which are systems dedicated to a Automotive systems: engine management, airbag deployment.
specific function within a larger
Consumer electronics: gaming systems handling controls, digital
mechanical or electrical system. cameras adjusting settings.
1.1 Microprocessor v/s Microcontroller
Feature Microprocessor (µP) Microcontroller (µC)
Functionality Central processing unit Mini-computer on a chip
Specific tasks in embedded
Purpose General-purpose computing
systems
Design Complex, high clock speed Simpler, lower clock speed
Memory External RAM and ROM Internal RAM and ROM
I/O peripherals External Integrated
Cost More expensive Less expensive
Power consumption Higher Lower
Embedded systems (washing
Computers, servers, laptops,
Applications machines, thermostats, toys,
smartphones
industrial control)
1.2 Micro controller & Embedded Processors
Microcontroller (MCU): Embedded Processor:
A self-contained mini-computer on a single chip A broader term encompassing any processor used in an
designed for specific tasks within an embedded embedded system.
system.
An embedded system is a dedicated computer system with a
Includes a CPU, memory (RAM and ROM), specific function, like controlling a car's engine or operating
and integrated I/O peripherals for interacting a traffic light.
with external devices (sensors, actuators,
Can include microcontrollers (MCUs) as well as more
displays).
powerful processors depending on the application's needs.
Optimized for low power consumption and
Microprocessors (µPs) can also be used as embedded
cost-effectiveness.
processors in some cases, particularly for complex
Examples: washing machine controllers, thermostat embedded systems requiring high processing power (e.g.,
regulators, remote controls. industrial robots).
1.3 Processor Architectures - Harvard v/s Princeton
von Neumann Architecture
Feature Harvard Architecture
(Princeton Architecture)
Separate memory spaces for Single memory space for both
Memory
instructions and data instructions and data
Separate data buses for instructions Single set of data buses for both
Data Buses
and data instructions and data
Instruction Fetching & Can't happen simultaneously
Can happen concurrently
Data Access (bottleneck)
Speed Faster due to concurrent processing Slower due to single bus bottleneck
Complexity More complex design Simpler design
Cost Slightly more expensive More cost-effective
More challenging due to managing Easier due to one unified memory
Programming
two memory spaces space
Real-time signal processing, high- General-purpose computing, cost-
Applications
performance systems sensitive applications
1.4 RISC v/s CISC
RISC (Reduced Instruction Set CISC (Complex Instruction Set
Feature
Computing) Computing)
Instruction Set Smaller set of simpler instructions Larger set of complex instructions
Instruction Each instruction typically in one clock Complex instructions may take multiple
Execution cycle clock cycles
Reliance on Relies on compiler to break down
Less reliance on compiler for optimization
Compiler complex tasks
Fixed instruction format for easier
Instruction Format Variable instruction length and format
decoding
Faster execution speed, lower power Potentially fewer instructions needed,
Focus
consumption simpler programming model
Faster, simpler design, lower power More versatile instruction set, potentially
Advantages
consumption smaller program size
May require more instructions for Slower, more complex design, higher
Disadvantages
complex tasks power consumption
Mobile devices, embedded systems, high- Legacy systems, personal computers
Applications
performance computing (historically)
1.5 Architecture of 8051 Microcontroller
1.6 An 8051 Microcontroller Registers
1.6.1 An 8051 Microcontroller Features
The 8051 microcontroller has many features,
including:
• Memory: 4 KB of on-chip ROM (program memory)
and 128 bytes of on-chip RAM (data memory)
• Busses: 8-bit bidirectional data bus and 16-bit
unidirectional address bus
• Timers: Two 16-bit timers
• Ports: Four 8-bit input/output ports
• Registers: Four register banks of 8 bits each, and 32
general purpose registers each of 8 bits
• Interrupts: Two external and three internal interrupts
• Special functions: UARTs, ADC, Op-amp, etc.
• Instruction set: 111 instructions
• Clock: Up to 12 MHz frequency
• Serial port: Full-featured serial port
1.7 Pin diagram of 8051Microcontroller
• Pins 1 to 8 (Port 1): These pins are a bi-directional I/O port that can be
used for interfacing with external devices.
• Pin 9 (RESET): This pin is used to reset the microcontroller to its initial
values.
• Pins 10 to 17 (Port 3): These pins have multiple functions including
serving as interrupt inputs, timer inputs, control signals, and serial
communication signals.
• Pins 18 & 19 (XTAL1 & XTAL2): These pins are used for connecting
an external crystal oscillator that provides the clock signal for the
microcontroller.
• Pin 40 (VCC): This pin provides the power supply voltage (typically
+5V) to the microcontroller.
• Pin 21 to 28 (Port 2): These pins are another bi-directional I/O port that
can be used for various purposes.
• Pin 29 (PSEN): This pin is the Program Store Enable signal and is used
during the process of fetching instructions from program memory.
• Pin 30 (EA): This pin is the External Access input and is used to enable
or disable external memory interfacing.
• Pins 32 to 39 (Port 0): This is a bi-directional I/O port that also serves as
the lower order address bus for memory access.
• Pin 20 (GND): This pin is the ground connection for the
microcontroller.
1.8 I/O ports functions in 8051 Microcontroller
1.9 Internal Memory organization of 8051 Microcontroller
Program Memory (ROM):
On-chip, typically 4KB in older models, though variants can have
more.
Stores the program instructions that the microcontroller executes.
Not directly writable by the user program. The program is written
into ROM during the manufacturing process or through special
programming techniques.
Data Memory (RAM):
On-chip, usually 128 bytes (though some variants may have more).
Stores temporary data used during program execution, such as
variables, intermediate results, and stack data.
Accessible by the user program for reading, writing, and
manipulation.
Internal RAM Organization:
The 128 bytes of internal data memory are further divided into two
sections:
Special Function Registers (SFRs):
Occupy the lower address range (typically 00h to 1Fh).
Each SFR is a small memory location (usually 8-bit) that controls
various functionalities of the microcontroller.
1.10 External Memory (ROM & RAM) interfacing 8051 Microcontroller
1.10.1 External ROM (Program Memory) Interfacing 1.10.2 External RAM (Data Memory) Interfacing
Port 0 is used as multiplexed data & address lines. It Port 0 is used as multiplexed data & address lines.
gives lower order (A7-A0) 8-bit address in initial T Address lines are decoded using external latch &
cycle & higher order (A8-A15) used as data bus. ALE signal from 8051 to provide lower order (A7-
8-bit address is latched using external latch & ALE A0) address lines.
signal from 8051. Port 2 gives higher order address lines.
Port 2 provides higher order (A15-A8) 8-bit address. RD & WR signals from 8051 selects the memory
PSEN is used to activate the output enable signal of read & memory write operations respectively.
external ROM/EPROM.
Example Code:
Example Code: To read data from and write data to the external RAM, you can use the MOVX
To read instructions from the external ROM, you can use the MOVX instruction in instruction in your 8051-assembly code:
your 8051-assembly code: MOVX A, @DPTR ; Read data from external RAM into
MOVX A, @DPTR ; Read data from external ROM into accumulator accumulator
MOVX @DPTR, A ; Write data from accumulator to external
RAM
THANK YOU