L3: Microprocessor and Microcontroller
L3: Microprocessor and Microcontroller
(Course Code:18ME744)
REFERENCE BOOKS:
Further Reference:
National Programme on Technology Enhanced Learning (NPTEL)
https://nptel.ac.in/courses/112103174/1 by Dr. S. N. Joshi (IITG)
Learning Objectives
• The microprocessor contains the arithmetic, logic, and control circuits required
to perform the functions.
Microprocessor systems
Microprocessor
• Processor system processes the data, fetching the instructions from memory,
Microprocessor operation
microprocessor.
• In Decode cycle, the microprocessor figures out what operation the instruction
is meant to do.
1. Central processing unit (CPU): To recognise and carry out program instructions.
• Digital signals move from one section to another, along paths called buses.
• A bus, is a number of parallel conductors (wires), carries electrical signals and the paths are
shared by all the chips in the system.
• A bus has 16 or 32 parallel connections, each carry 1 bit of a data word.
• Parallel connections gives faster transmission than serial connection, in which an entire word is
sent in a sequence of bits along a single conductor.
Architecture of a microprocessor
• Arithmetic and Logic unit (ALU): Responsible for performing the data
manipulation.
• It generates the timing signals, to fetch a program instruction from memory and
execute it.
i.e. Operations within the microprocessor are referred in terms of No. of cycles they
take.
Architecture of Microprocessor systems
1. Instruction Set
• Set of instructions a microprocessor can understand.
• It is an interface between hardware and software (program).
2. Bus
A bus is a set of conductors / wires intended to transmit data, address or control
information to different elements in a microprocessor.
2. Control Bus
• Carries the signals relating to control actions / control signals.
E.g. : Microprocessor to inform memory devices, whether to read data from an
input device or write data to an output device.
Terms Used in a Microprocessor
• When a address is selected, it is placed on the address bus, only that location is
open to the communications from the CPU.
E.g.: 8-bit data bus has a 16-bit-wide address bus, i.e. 16 wires.
• This size of address bus enables 216 locations to be addressed; 216 = 65536
locations (64KB).
Terms Used in a Microprocessor
4. Clock Speed: No. of operations per second a processor can perform, MHz / GHz.
E.g. An 8-bit microprocessor can process 8-bit data at a time. ( 4 bits - 64 bits)
Microprocessor systems
Registers
• The two numbers can be processed by the ALU, result is transferred back into
by the ALU.
• Every time ALU executes an operation, two things will happen; one is the result,
and the other is the status of the operation, which goes into the flag register.
Example
• Consider the state of the Z, N, C and V flags for the operation of adding the hex numbers 02 and
06.
• The result is 08. Since it is not zero, then Z is 0.
• The result is positive, so N is 0. There is no carry, so C is 0.
• The unsigned result is within the range -128 to +127 and so there is no overflow and V is 0.
Microprocessor systems
• This register contains the address of the memory location, for the next program
instruction.
• The program counter is incremented each time so that the CPU executes
Addition of two numbers, the MAR is loaded with the address of the first number.
• The address of the second number is then loaded into the MAR.
• The data at this address is then added to the data in the accumulator.
• After fetching an instruction from the memory via data bus, the CPU stores the
• After each fetch cycle, the CPU increments the PC by one, resulting that the
General-purpose registers
Increment/Decrement counter
Example
• This unit generates signals within microprocessor to carry out the instruction,
be opened or closed. so that the data goes where it is required and the ALU
operations occur.
• The control unit itself consists of three parts; the instructions register (IR).
• The memory unit stores binary data (program instruction codes or numbers)
• Size of the memory = Number of wires in the address bus.
• The memory elements consist of large numbers of storage cells, each cell capable
of storing 0 or 1 bit.
• The storage cells are grouped in locations, each location capable of storing one
word.
• To access the stored word, each location is identified by a unique address.
E.g.
• A 4-bit address bus can have 16 different addresses with each capable of storing 1
byte (8 bits)
Microprocessor systems
Forms of Memory
• The data can only be read, used for fixed programs like OS and
programs.
Used for ROMs, can be programmed and their contents can be altered
• Consists of series of small electronic circuits, cells, which can store charge.
• The pattern remains permanently in the chip until erased by ultraviolet light
EEPROM
• Erasing is by applying relatively high voltage rather than using ultraviolet light.
Microprocessor systems
Forms of Memory
• Its volatile
• Information stored is temporary
• Used for current operation / runtime operations
• Introduced in 1977.
• It is 8-bit Microprocessor.
1. Register unit
2. Control unit
4. Interrupt unit
5. Serial IO unit
Functioning of 8085 Microprocessor
Programs / instructions
8 8 8
5/8
8 8
8 8
8 8
8 16
16
16
8085 Architecture
Fetch cycle
Fetch cycle
• PC will have address of the instruction that is stored in the register or memory
• This address will be now put on the address bus, as µp will send RD signal on
the control bus, the instruction will be fetched from the memory through the
data bus.
• Once the instructions come into the data bus, the µp cannot float the
instruction, these instructions has to be stored in another register called as IR
(instruction register)
• Once instruction is stored in IR the fetch cycle is complete.
8085 Architecture
Decode cycle
Decode cycle
• After reading the OP code, the µp will understand which OP code belongs
which instruction, i.e. called decoding.
• Once the instruction is decoded by the Instruction decoder (ID), then is the
execution cycle.
8085 Architecture
Decode cycle
• Now exactly the same process will happen, for the next/second instruction.
• To fetch the second instruction the µp has to know its address, then the
address is given by the PC, and PC will go on increment, after every instruction
being executed by µp, hence pc is of 16 bit and µp is of 8 bit.
• The other general purpose register are of 8 bit.
• Data bus is of 8 bit.
• Address bus is of 16 bit.
8085 Architecture
instruction.
Example
Example
• The Accumulator (A) gets the value 02 & the B register gets the value 03.
• The instructions for µp to add these numbers will be ADD B.
• The two things that the µp knows are who is the first operand & where it is
stored.
• Every µp has its own characteristics.
• In any arithmetic or logical operation, the Accumulator (A) will hold the first
operand and also gets the result
• The second operand will be on any other general purpose register.
8085 Architecture
Example
• If the series of arithmetic operations continues, the Accumulator will hold the
accumulated value.
8085 Architecture
Example
• The Accumulator (A) has the value 02 & the B register has the value 03.
• The instructions for µp to add these numbers will be ADD B.
• This instruction stored in the memory is fetched, i.e.
• PC will get the address.
• The instruction will be fetched from the data bus.
• This instructions comes to the IR, & then ID decodes, i.e. the ID converts the
INST ADD B to binary.
• This instruction goes to the timing & control signal, will release the timing &
control signal to tell other components to what to do.
8085 Architecture
Example
• The timing & control signal, will release signal to Accumulator (A), so the A will
• Similarly the timing & control signal will send the signal to the other register B,
• This value 03 is put on the internal data bus and comes to the temporary
register.
8085 Architecture
Example
Temporary register
• This register hold the second operand / value momentarily, as it is used by µp.
• The timing & control signal will send the signal to ALU to add the values.
• The ALU will add the values i.e. 02+03 = 05 and the result is put back into the
accumulator through the data bus.
• The timing & control signal will send the signal to Accumulator, it will stores the
value / result i.e. 05.
Microprocessor systems
Input/output: enables data transfer between the CPU and the external world.
• It is a 16-bit register.
executed, the program counter points to the memory address of the next
instruction to be executed.
8085 Microprocessor – Functional Units
• It is an 8-bit register.
• Control Signals: Read (RD), Write (WR), ALE (Address Latch Enable)
components of microprocessor.
Interrupt control
Example:
• As the microprocessor is executing a process and an interrupt occurs, the microprocessor shifts
• After the request is completed, the control goes back to the main program.
Classification of Microprocessor
Classification of Microprocessor
Microcontroller
Microcontroller
E.g.
• Motorola 68HC11, Intel 8051 and PIC16C6x/7x are 8-bit microcontrollers.
• Motorola 68HC16 is an example of a 16-bit microcontroller.
• Motorola 68300 a 32-bit microcontroller.
Microcontroller
Microcontroller
• The microcontroller has pins for external connections of inputs, outputs, power,
• The pins for the I/P & O/P are grouped into units called input/output ports.
• Two ports may be used for a 16-bit word, one to transmit the lower 8 bits and the
• The ports can be input only, output only or programmable to be either I/P or O/P.
Microprocessor vs Microcontroller
Microprocessor Microcontroller
Microprocessors are multitasking in Single task oriented.
nature. E.g.: Washing machine
Designers can decide the nos. of Fixed number for memory or I/O makes a
memory or I/O ports needed. it ideal for a limited but specific task.
External support for the system makes it Lightweight and cheaper than a
heavier and costlier. microprocessor.
More space and high power It consumes less power and takes less
consumption space.
Microprocessor vs Microcontroller
Microcontroller
Microcontroller
Selecting a microcontroller
1. Consumer Electronics Products: Toys, Cameras, Robots, Washing Machine, Microwave Ovens