You are on page 1of 17

Microprocessors &

Microcontrollers
Lecture 17
04/04/2022
Introduction
What is microprocessor?
Microprocessor is a programmable integrated device that
has computing and decision making capability similar to
that of central processing unit.

What is microcontroller?
Microcontroller is a small computer on a single integrated
circuit chip. A microcontroller typically contains one or
more processor cores, along with additional peripherals
(memory, serial interface, timer, etc.) on the same chip
Basic Block Diagram of
Microcontroller

To connect the system we need buses- Address bus, Data bus, Control bus
Function of timer is to produce delay
Two types of delay-Hardware delay and Software delay
Hardware delay- more expensive, more power consuming, more complex
Still have massive advantage of using Hardware delay
Difference
Microprocessor Microcontroller
It is only a processor, so memory and I/O Microcontroller has a processor along
components need to be connected with internal memory and I/O
externally. components.
It has no RAM,ROM, I/O units, timers and It has a CPU along with RAM, ROM, and
other peripherals on the chip. other peripherals embedded on a single
chip
Uses an external bus to interface Uses an internal controlling bus
Due to external components, the total Due to the presence of less external
power consumption is high. components, the total power
consumption is less.
Microprocessor-based systems can run at Microcontroller based systems run up to
a very high speed because of the 200 MHz or more depending on the
technology evolved. architecture.

Example-Personal computers Example- Washing machine, embedded


systems
8051 Microcontroller
Architecture of 8051
Program Status Word
Program Status Word
• Carry flag
1000 0000
1000 0001
=1 0000 0001

• Auxiliary carry
0111 0001
0111 0101
= 1110 0110 AC=0
Program Status Word
• F0 Flag
General purpose flag available to the programmer
• Overflow Flag
This flag is set whenever the result of a signed number operation is too
large. It is used to detect errors in signed arithmetic operation. Eg.
Addition of two positive numbers and got a negative number, so OF
will be et to 1
• Parity Flag
When result has even number of 1’s, it is set to 1
• Register Bank Status
128 byte of internal RAM is divided into 4 register banks and in every
register bank we have 8 registers. (00-07H),(08-0FH)….
Memory Organization

128 Byte
RAM
Memory Organization
Register Bank
Default Register Bank = Register Bank 0
Each register bank has unique address
Only one register bank can be used at a time
Eg. MOV A,R0;
MOV A,00H;
How to move data from one register bank to another
(Bank 0 to Bank 2)
SETB PSW.4
CLR PSW.4
MOV A,R0
Memory Organization
Bit addressable read/write memory-
It is byte and bit addressable.
Eg (Byte addressable) MOV A,#03H;
MOV 26H,A;
Eg. (Bit addressable) SETB 32H
CLR 32H

Read/Write Storage Scratch Pad:


Used for read/write storage
General purpose storage of data
Used by special function registers
Architecture of 8051
• Stack Pointer(8 bit)
• Program Counter (16 bit)
• Data Pointer (16 bit) (DPTR)
They consist of two separate registers DPH (Data Pointer High) and DPL
(Data Pointer Low)
The DPTR registers are usually used for storing data and immediate
results
Special Function Registers or Control Registers----SCON, PCON, TMOD,
IP and IE
• Timer/Control unit
To count the number of events
In Intel 8051, two 16 bit timer registers-----Timer 0 and Timer 1
Architecture of 8051
16 bit Timer 0 16 bit Timer 1
THO 8 bit TLO 8 bit TH1 8 bit TL1 8 bit

After every clock pulse, timer/counter are incremented by 1


The timer register can be used in two modes – Timer Mode and the Counter Mode
Difference between these mode is in source for incrementing the timer register
Architecture of 8051
• RST pin: RESET pin, which is used to reset the
microcontroller to its initial values.
• PSEN pin: which stands for Program Store Enable. It
is used to read a signal from the external program
memory.
• EA pin: which stands for External Access input. It is
used to enable/disable the external memory
interfacing.
• ALE pin: which stands for Address Latch Enable. It is
used to demultiplex the address-data signal of port.
TMOD (Timer Mode)
• To control the Timers (Timer 0 and Timer 1),
TMOD register is used.
• 8 bit register
Thank you

You might also like