SKEE3223 - Module 01 - Introduction
SKEE3223 - Module 01 - Introduction
2023:2024-II 2
2
1 0 /9 /2 0 2 4
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
29-Sep-24 6
6
1 0 /9 /2 0 2 4
What is Computer?
Data Storage
www.utm.my
29-Sep-24 7
• 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);
}
11
6
www.utm.my
29-Sep-24 12
12
1 0 /9 /2 0 2 4
www.utm.my
29-Sep-24 13
13
7-Oct-24 14
14
1 0 /9 /2 0 2 4
15
15
MMG #1
Control Server
MMG #5:
Operator stations
P2 Putrajaya PLCs + Display
panel
16
16
1 0 /9 /2 0 2 4
17
Custom controller
18
1 0 /9 /2 0 2 4
www.utm.my
• Speed (must be predictable)
29-Sep-24 19
19
• 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
www.utm.my
29-Sep-24 21
21
29-Sep-24 22
22
1 0 /9 /2 0 2 4
www.utm.my
address indicated by Address
Register
29-Sep-24 23
23
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
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
29-Sep-24 28
28
1 0 /9 /2 0 2 4
Microprocessor (μP)
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
• 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
34
1 0 /9 /2 0 2 4
www.utm.my
29-Sep-24 35
35
29-Sep-24 36
36
1 0 /9 /2 0 2 4
• 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
www.utm.my
29-Sep-24 39
39
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
www.utm.my
29-Sep-24 41
41
29-Sep-24 42
42
1 0 /9 /2 0 2 4
Selecting A μP
• 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
THANK YOU 22
29-Sep-24 44
44