Microprocessor and Interfacing - Lecture - 1 (New)
Microprocessor and Interfacing - Lecture - 1 (New)
Fall 2024
United International University
EEE3403: Microprocessor and Interfacing
Lecture#1
Introduction
S. M. Lutful Kabir, PhD
Professor, UIU
Introduction
• Microprocessor has revolutionized various industries and our day-to-
day life.
• Its use in control, monitoring, measurement and signal processing
has made a breakthrough in electronic industry.
• Now-a-days you won’t be able to name one electronic device in
which microprocessor or its derivative has not been used.
• This course is designed to make you familiar with this remarkable
piece of wonder.
2
05-11-2024
Features of Microprocessors
• Cost
• Size
• Power Consumption
• Versatility
• Reliability
4
05-11-2024
History
What is a Microprocessor?
• Many components like transistors, registers, and diodes which come together
in a chip to perform.
• When the central processor unit is made of only one integrated circuit, it
becomes a microprocessor.
• It has millions of transistors and electronic components to process multiple
instructions at a time.
• From the technological viewpoint, a microprocessor is a VLSI (Very Large
Scale Integration) single-chip implementation of a complete processing unit.
• It is a programmable device that takes in input, performs some arithmetic and
logical operations over it and produces the desired output.
• The ability of the chip has become more complex with technology evolution.
• Now, most devices need to have a microprocessor to function.
6
05-11-2024
Basic of Microprocessor
• A Microprocessor takes a bunch of instructions in machine language and
executes them, telling the processor what it has to do.
• Microprocessor performs three basic things while executing the instruction:
– It performs some basic operations like addition, subtraction, multiplication,
division, and some logical operations using its Arithmetic and Logical Unit
(ALU). New Microprocessors also perform operations on floating-point
numbers also.
– Data in microprocessors can move from one location to another.
– It has a Program Counter (PC) register that stores the address of the next
instruction and based on the value of the PC, Microprocessor jumps from
one location to another and takes decisions.
8
05-11-2024
Three Stages
Each computer's CPU can have different cycles based on different instruction
sets, but will be similar to the following cycle:
1. Fetch stage: The next instruction is fetched from the memory address
that is currently stored in the program counter and stored into the
instruction register. At the end of the fetch operation, the PC points to the
next instruction that will be read at the next cycle.
2. Decode stage: During this stage, the encoded instruction presented in
the instruction register is interpreted by the decoder.
3. Execute stage: The control unit of the CPU passes the decoded
information as a sequence of control signals to the relevant functional
units.
10
05-11-2024
Evolution of Microprocessors
11
Clock Speed
16-bit microprocessor: 8086: 4.7MHz, 8MHz, 10MHz
8088: more than 5MHz
80186/80188: 6MHz
80286: 8MHz
12
05-11-2024
15
16
05-11-2024
What is microcontroller?
• A microcontroller is an integrated circuit that is programmed to do a
specific task.
• Microcontroller are really just a “mini-computer”.
• It’s a miniature version of your laptop, desktop, palmtop, PDA etc.
17
Microcontroller
18
05-11-2024
19
Microcontroller Programming
• Code is written for the microcontroller in an integrated development
environment, a PC program. You have to use a high-level language.
• The IDE debugs the code for errors, and then compiles it into binary
code which the microcontroller can execute.
• A programmer ( a piece of hardware, not a person) is used to transfer
the code from PC to the microcontroller.
20
05-11-2024
21
22
05-11-2024
23
Microcontroller Packaging
24
05-11-2024
An example
25
26
05-11-2024
STM32F1 series
• The STM32F103C8 is a microcontroller from STMicroelectronics' STM32
series.
• It is based on the ARM Cortex-M3 core and is commonly known as the "Blue
Pill" due to its small, blue PCB design.
• This microcontroller is popular among hobbyists and developers for various
embedded systems and IoT projects because of its affordability and versatility.
• Key features of the STM32F103C8 include:
– 1. CPU: ARM Cortex-M3 core running at up to 72 MHz.
– 2. Flash Memory: 64 KB or 128 KB of Flash memory for program storage.
– 3. RAM: 20 KB of SRAM for data storage.
– 4. GPIO: Multiple General-Purpose Input/Output pins for interfacing with
external devices.
27
An Example Application
• You can create a simple robot using the STM32F103C8 microcontroller for
control and various sensors and actuators for functionality.
• Here's an example of a basic line-following robot:
• *Components:*
– 1. STM32F103C8 microcontroller board.
– 2. Infrared (IR) sensors for line detection (usually array of IR sensors).
– 3. Motor driver to control the robot's motors.
– 4. DC motors and wheels for movement.
– 5. Chassis and wheels to build the physical robot.
– 6. Power supply for the microcontroller and motors.
30
05-11-2024
Design Milestones
• *Functionality:*
– 1. *Line Detection:* Use the IR sensors to detect lines on the ground.
These sensors will provide analog or digital signals based on whether
the robot is on the line or not.
– 2. *Motor Control:* Interface the motor driver with the STM32F103C8
to control the speed and direction of the DC motors. You can use PWM
signals to achieve variable speed control.
• *Decision Making:*
– Write a control algorithm in C/C++ (using a development environment
like STM32CubeIDE) to make decisions based on the sensor inputs.
For example, if the left sensor detects the line, turn the robot right, and
vice versa.
31
32
05-11-2024
Microcontroller Programming
After the compilation, if the code is
error free, use ST-Link utility to
download the hex file of the code to
the uC through the ST-Link
hardware (keeping connected to
the USB of your PC).
33
Items to be collected
Hardware
• 1 Microcontroller (Blue Pill)
• 1 ST-Link module
• Other components as when necessary
Software
• Proteus
• STMCube IDE
• STM32 ST-Link Utility
34
05-11-2024
Counselling Hour
• Saturday : 2:00 PM - 4:00 PM
• Tuesday : 2:00 PM – 4:00 PM
35
Thanks
36