Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
17 views22 pages

SKEE3223 - Module 01 - Introduction

for STM32
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views22 pages

SKEE3223 - Module 01 - Introduction

for STM32
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

1 0 /9 /2 0 2 4

SKEE 3223: Microprocessors (Sec. 9 & 10)


Module 1 - Introduction
Dr. Zulfakar Bin Aspar (Ph.D. Electrical Engineering
st
– Electronics)
P02-204 or Embedded System Lab P04 1 floor
Ext.: no longer exist, HP: 019-7311350
Email: [email protected]
Consultation:
a) Any day in afternoon except weekends, no message or call will
be entertained
b) Or by appointment
Department of Electronics and Computer Engineering (ECE)
Faculty of Electrical Engineering,
Updated on 29 September 2024 Universiti Teknologi Malaysia

Previous Semester Analysis


2023-2024 Sem II
Average B- (those below average must work harder)
Tests 30%
Fail to review previous years test questions
Fail to understand the urgency and importance of assignments
Project 20%
Fail to present = 0% for project, English, ppt
Fail to seek early help (partner problem? Don’t know how to start, etc) 1

No report = 0% project mark


Final 50%
Fail to understand assignment such as present after final exam?!
Unanswered (blank) questions or sub-questions
Missing part of answer paper

2023:2024-II 2

2
1 0 /9 /2 0 2 4

This Semester Approach


• Decided by the meeting of all lecturers involved
• Tests 30%
 2 tests (Week 6 and 12)
 no replacement test for whatever reason
 Chapter 1 to 12
• Project 20%
 Preliminary: 5% - demonstration of basic capability: simulator, assembler
 Actual project: 15% - demonstration of working system
 Hardware and software implementation
 Group creation will be done by week 3, adjusted after Test 1 result
 Extra marks for full project system implementation
• Final 50%
 Section C will be based on assignment
 All chapters, comprehensive
 If you can get 100% during final, you will get A

2023:2024-II 3

Module 1
Introduction to
microprocessor based 2

Plastic
system
Chip case

Pins

4
1 0 /9 /2 0 2 4

MODULE 1
M IC ROP ROC ES S OR BA S E D SYSTE M

29-Sep-24 5

Microprocessors Based System


 Aim:
o To review the main elements of a microprocessor system
o To learn the architecture of a CPU especially for electronics and computer
engineering, why? That is where the big money is available!

 Intended learning outcome


3
o Define and explain important terms associated with both hardware and software
elements of a microprocessor system
o Tell the difference between general purpose computing and embedded computing
o List down the major components inside a computer & processor
o Tell the difference between computer, processor, microprocessor and microcontroller
o Explain instruction execution cycles of a generic microprocessor
www.utm.my

29-Sep-24 6

6
1 0 /9 /2 0 2 4

What is Computer?

Computer Data Processing

Data Storage

www.utm.my
29-Sep-24 7

Basic Function of Computer

• Data Processing
• Data Storage
• Data Movement 4

• Control
www.utm.my

29-Sep-24 8

8
1 0 /9 /2 0 2 4

Computing System
• Whenever the word microprocessor is mentioned, most of us think of
desktop computers
o PC
o Laptop
• Maybe at most smartphone
• In this course, we will look at another type of computing system which is far
more common that you ever imagined

www.utm.my
29-Sep-24 9

Computer Classification
• Classification of computers:
o Servers:
• big, expensive, available 24x7.
o Desktops:
• computers on your desk
o Laptops:
• computers you carry in your bag
5
o PDAs/Tabs/Smartphones (personal digital assistants):
• computers you carry in your pocket
o Embedded systems:
• computers that don’t look like computers!
• An embedded system is a type of computer
www.utm.my

29-Sep-24 10

10
1 0 /9 /2 0 2 4

Embedded System
• Embedded system: a microprocessor-based system that is built to control a function
or range of functions and is not designed to be programmed by the end user in the
same way that a PC is.

System

SOFTWARE PROGRAM
#include <16f876a.h>
# u s e delay (clock=20000000)
#byte P O R T B = 6
m ain()
{
set_tris_b(0);
portb=255; //decimal
delay_m s(1000);
portb=0x55; //hexadecimal
delay_m s(1000);
p o r t b = 0 b 1 0 1 0 1 0 1 0 ; //binary

www.utm.my
delay_m s(500);
}

An embedded system is a special-purpose computer system designed to perform certain dedicated


functions. It is usually embedded as part of a complete device including hardware and mechanical parts
29-Sep-24 11

11

Give example of embedded system?

6
www.utm.my

29-Sep-24 12

12
1 0 /9 /2 0 2 4

Embedded Systems: Example

www.utm.my
29-Sep-24 13

13

A wide area network implementation using


embedded system
7

Variable Message Signage (VMS) System at Putrajaya

7-Oct-24 14

14
1 0 /9 /2 0 2 4

Monitoring Apps at Command and Control Center


 Reverse Engineering of Variable Message Sign for Perbadanan Putrajaya, Putrajaya

15

15

DESCRIPTION OF THE TECHNOLOGY


(Description of Process)

MMG #1
Control Server

MMG #2 PLCs + Display


Host PC 1 panel 8
P14 Putrajaya
www

MMG #5:

Operator stations
P2 Putrajaya PLCs + Display
panel
16

16
1 0 /9 /2 0 2 4

Variable Message Sign (VMS)

Type 1: unavailable anymore


Type 2: Characters + Pictogram
Type 3: Characters only
Type 4: Pictogram only

17

 Reverse Engineering of Variable Message Sign for Perbadanan


Putrajaya, Putrajaya

Type 4 – pictogram only

Custom controller

18
1 0 /9 /2 0 2 4

General Purpose Computing vs Embedded System

General Purpose Computer Embedded System


Intended to run a fully general set of Runs a few applications often known at
applications design time
End-user programmable Not end-user programmable
Faster is always better Operates in fixed run-time constraints,
additional performance may not be
useful/valuable
Differentiating features: Differentiating features:
• Speed (need not be fully predictable) • Power
• Software compatibility • Cost (eg RM2 vs RM2.50)
• Cost (eg RM3k vs RM5k per laptop) • Size

www.utm.my
• Speed (must be predictable)

29-Sep-24 19

19

To design a μP system, we must know…

• Fundamentals:
 What’s inside a computer
 What’s inside a processor
• Programming:
 What happens in the processor when it’s running a program
 What do we need to write a program 10
 How to create a program
 How to run a program
 How to fix a program error
• Hardware design:
 Internal CPU components and logic operations
www.utm.my

 Timing diagrams
 Interfacing with other chips

29-Sep-24 20

20
1 0 /9 /2 0 2 4

Internal Organization of Computers


• Internal working of every computer can be divided into three main parts:
o CPU : Central processing unit
o Memory : i.e. RAM (Random access memory), ROM (Read only memory)
o I/O (input/output) devices : input (i.e. keyboard, mouse, sensor). Output (i.e. LCD,
printer, monitor)

www.utm.my
29-Sep-24 21

21

Computer: CPU (Central Processing Unit)


• CPU: Control the operation of the computer and performs its data processing functions; often
simply referred to as PROCESSOR.
• The CPU is used to execute information stored in memory .
• The I/O devices is used as a communication medium with CPU.
• The CPU is connected to memory and I/O through strip of wires called buses.
11
www.utm.my

29-Sep-24 22

22
1 0 /9 /2 0 2 4

Computer: Inside CPU (Central Processing Unit)


Registers in CPU

Program Counter (PC) points to the address of the


instruction currently being
executed by the CPU

Instruction Register (IR) stores the instruction read


from the address of the
instruction indicated by the
PC

Address Register store the address of the


current data

Data Register stores the value of from the

www.utm.my
address indicated by Address
Register

29-Sep-24 23

23

Computer: Inside CPU (Central Processing Unit)


CPU components: they do not have direct access to memory.

Decoder interpret the instruction


brought to the IR and pass
it to the CU.

Control Unit (CU) generates control signals


based on the instruction 12
detected by Decoder

Arithmetic/Logic Unit (ALU) performs arithmetic &


logic operations

Accumulator (ACC) a register that stores the


values used before and
www.utm.my

after an ALU operation

29-Sep-24 24

24
1 0 /9 /2 0 2 4

Computer: Memory
• Memory stores the binary information needed by CPU.
• Two types of memory:
o ROM (Read Only Memory):
 Non-volatile memory: contents is retained even without power.
 In embedded systems, used to store application programs and test routines.
 Contents can be set by fixing it during manufacturing or “burning” it using a programming device.
 Common types include MROM, PROM, EPROM and flash memory.
 Erasable types can only be rewritten a fixed number of times.
o RAM (Random Access Memory):
 Volatile memory: contents lost without power.
 Used to store temporary data. In embedded system, very little RAM is required. Some systems don’t even have
RAM at all!
 No limit to number of writes the device can handle.
 Fast writes (unlike EPROM/EEPROM).

www.utm.my
 Two major types are SRAM and DRAM.

29-Sep-24 25

25

Computer: Buses

13

• Buses is used to communicate between CPU and devices (memory or I/O).


• Three types of buses:
o Control Bus:
 Is a bidirectional bus.
www.utm.my

 Used to provide read or write signals to the device indicate if the CPU is asking for information or
sending information.
 A single wire is a single line of control
 A group of wires is a bus of control/data exchange/address
29-Sep-24 26

26
1 0 /9 /2 0 2 4

Computer: Buses

o Data Bus:
 Is a bidirectional bus.
 Used to carry information IN and OUT of CPU.
 The more data buses available, the better the CPU, but more expensive.
 The processing power of computer is related to the size of its data buses. I.e. a 8-bit bus can send 1 byte
a time, while 16-bit bus can send 2 byte at a time, which is twice as fast.
o Address Bus:
 Is a unidirectional bus.
 Used to identify the device and memory connected to CPU.
 For a device to be recognized by a CPU, it must be assigned by an unique address.
 The CPU puts the address (in binary) on the address bus, and the decoding circuitry finds the device.
 The more address busses available, the larger the number of devices that can be addressed.

www.utm.my
29-Sep-24 27

27

Microprocessor (μP)

• μP is a single integrated circuit (IC) that accepts and executes coded instructions
(machine code or machine language) for the purpose of manipulating data and
controlling the associated circuitry (RAM, ROM and I/O) in digital system.

14

Intel 4004, the first commercial μP


www.utm.my

29-Sep-24 28

28
1 0 /9 /2 0 2 4

Microprocessor (μP)

Microprocessor, by-itself, completely useless – must have external peripherals

www.utm.my
(memory, interfacing ICs,) to Interact with outside
world

29-Sep-24 29

29

Microcontroller (μC)
• μC is also a single integrated circuit (IC) that accepts and executes coded
instructions for the purpose of manipulating data and controlling the digital system
similar to μP.
• The different between μP and μC is that the μC contains RAM, ROM and I/O in that
single IC package.
• Thus allows miniaturization of single application because the required associated
circuitry is contained within the IC of μC. 15
www.utm.my

STM32 μC
29-Sep-24 30

30
1 0 /9 /2 0 2 4

Microcontroller (μC)

Microcontroller - put a limited amount of most commonly used resources inside one chip

www.utm.my
29-Sep-24 31

31

μP vs μC

Microprocessor Microcontroller:

o A chip that contains only the processor o A chip that contains all the components
o Need other main component chips of a computer – processor, memory and
to make a working system input/output
o More flexible o Less flexibility or almost fixed capacity 16

o Can have very few I/O or many I/O o Can be used straight away without
devices using the same processor chip additional less component count in
system
o Less powerful
www.utm.my

No matter what is the system size, the most important component is still the processor.

29-Sep-24 32

32
1 0 /9 /2 0 2 4

To design a μP system, we must know…

• Fundamentals:
 What’s inside a computer
 What’s inside a processor
• Programming:
 What happens in the processor when it’s running a program
 What do we need to write a program
 How to create a program
 How to run a program
 How to fix a program error
• Hardware design:
 Internal CPU components and logic operations

www.utm.my
 Timing diagrams
 Interfacing with other chips

29-Sep-24 33

33

Software
• Computer software oftware
o Computer programs are known as software

• Program:
o Sequence of instructions that perform a task
o The sequences can be added or modified

• Instruction: 17
o The simplest operation performed by the processor
o Think of it as a note coming from a musical
instrument
nstruction from memory
• How the computer works he (basic concept):
instruction
o Fetch an instruction he instruction
www.utm.my

o Decode the instruction


o Execute the instruction
o Repeat the whole process
29-Sep-24 34

34
1 0 /9 /2 0 2 4

Machine & Assembly Language


• Machine Language
o Is the lowest level programming language.
o It is a set of instruction that executed directly by CPU.
o While easily understood by computers, machine languages are almost impossible for humans to
use because they consist entirely of numbers i.e. 0001 1011.

www.utm.my
29-Sep-24 35

35

Machine & Assembly Language


• Assembly language
o Is a lower level programming language for a computer.
o Assembly language uses a mnemonic representation to represent each low-level machine operation i.e.
MUL may stand for “multiply”
o Assembly language is converted into executable machine code by a utility program referred to as an
assembler; the conversion process is referred to as assembly, or assembling the code.
o Assemblers can be of two types: cross assembler and native assembler.
o Cross assembler runs on one computer and generates machine instructions that will be executed by 18
another computer that has different instruction set, e.g. freeware ASM68K.
o Native assembler runs and generates instructions for the same computer.
o Drawbacks of assembly programs are:
o dependent on hardware organization, difficult to understand long programs, low programmer productivity
www.utm.my

29-Sep-24 36

36
1 0 /9 /2 0 2 4

To design a μP system, we must know…

• Fundamentals:
 What’s inside a computer
 What’s inside a processor
• Programming:
 What happens in the processor when it’s running a program
 What do we need to write a program
 How to create a program
 How to run a program
 How to fix a program error
• Hardware design:
 Internal CPU components and logic operations

www.utm.my
 Timing diagrams
 Interfacing with other chips …continue

8-Oct-24 37

37

How a Microprocessor
19

or CPU works?
Fetch -> Decode -> Execute

29-Sep-24 38
www.utm.my

38
1 0 /9 /2 0 2 4

How CPU works

Fetch Decode Execute

Fetch instructions Interpret binary perform requested


from memory instruction action

• An instruction has 3 phases of execution


• The Control Unit (CU) orchestrates the complete execution of each instruction

www.utm.my
29-Sep-24 39

39

Executing: LOAD Instruction


1. The address the CPU wants to execute is 0x1000 in the
PC.
2. Put 0x1000 in Address Register,
3. When 0x1000 enters the Address Register, it
automatically accesses 0x1000 of the memory
4. Instruction there is read from memory.
5. Instruction is stored in IR (LOAD 0x2000)
6. Instruction goes into the decoder. At the same time the PC
is increased
20
7. Decoder interprets what the content is. CU
understands that the content is to get the value of
address 0x2000
8. CU generates control signals to read the value of
0x2000 from the memory
9. A value of 1is entered into the data register by the
control signal generated by the CU.
10. Value of data register is available to any circuits
www.utm.my

needing it
11. Since this value may be operated through ALU, it is
temporarily stored in ACC.

29-Sep-24 40

40
1 0 /9 /2 0 2 4

Executing: ADD Instruction

1. Like LOAD, the address the current CPU will execute is


0x1002, which has already been increased
2. Put 0x1002 in Address Register,
3. Address 0x1002 is accessed
4. Value at 0x1002 is available
5. This value is stored in IR
6. Value in IR is sent to decoder. At the same time the PC is
increased
7. Decoder interprets value in IR. CU understands that the
content is to get the add the value of address 0x2002
8. CU generates control signals to read the value at 0x2002
based on decoder interpretation The ALU is given a control
signal to add.
9. Data from 0x2002 is loaded and saved in data register
10. ALU add data in Data Register with current value in ACC
11. The sum replaces the old value of ACC

www.utm.my
29-Sep-24 41

41

Executing: STORE Instruction

1. The current Instruction to be executed is 0x1004, which is


the PC value
2. The value in PC is transferred to the Address Register
3. Location 0x1004 is accessed
4. The value from 0x1004 is made available to the CPU
5. This value is saved in IR
6. The value in IR is made available to the decoder, and the PC 21
is incremented
7. Decoder interprets the value in IR
8. The CU generates control signals to store the value in ACC at
0x2004 based on decoder interpretation
9. The output of the ALU is stored in the ACC
10. Finally, the value in ACC is stored in location 0x2004
www.utm.my

29-Sep-24 42

42
1 0 /9 /2 0 2 4

Selecting A μP

• Choose the right one for your application


o Primary criteria: Cost, Power, Size, Speed
o Others: package options, integrated peripherals, potential for future growth

• Choose one with good software development support


o development environment - good compiler and debugger availability
o evaluation boards
o in-circuit emulators for those with deep pockets
o Operating system availability

• Other considerations
o Code density: affects power consumption, performance and system cost
o Hardware availability: make sure you can actually purchase the microcontroller before
designing it in

www.utm.my
o Prior expertise, licensing, etc

29-Sep-24 43

43

Do you know that by knowing this subject by heart, your


possibility to get a high salary job of more than RM4,000
per month has increased by 50%!
But, avoiding this subject, you have missed 90% of the
change to get a high salary job!

THANK YOU 22

univteknologimalaysia utm.my utmofficial

29-Sep-24 44

44

You might also like