BFM3333 Course: Microcontroller System
BFM3333 Course: Microcontroller System
BFM3333 Course: Microcontroller System
MICROCONTROLLER SYSTEM
L2: Common Architecture of Microcontrollers
www.ump.edu.my
LECTURE OUTLINES
3
Basic elements of microchips
• Integrated circuits IC contains many electrical and
electronics components that are working together to build
memory, ALU, registrars run instructions, etc
• A Microcontroller is a VLSI (Very Large Scale
Integration) Integrated Circuit (IC) that contains electronic
computing unit and logic unit (combinely known as CPU).
• The microcontroller are decoding all given instructions
into the language of machine 0 or 1
• The data storage and conversion between the software and
hardware components in microcontrollers need to be so
accurate.
4
Basic elements of microchips
5
Basic elements of microchips
6
Basic elements of microchips
7
Basic elements of microchips
8
PIC Microcontroller Advantages
10
PIC Microcontroller Architecture
PIC MICROCONTROLLER 8
• Data memory (RAM): a small number of 8bit registers
• Program memory (ROM): 12bit, 14bit or 16bit wide (in
• EPROM, FLASH, or ROM)
11
PIC Microcontroller Architecture
Example:
An add operation of the form a:=b+c must fetch 2
operands from
memory and write 1 operand to memory. In addition it is
likely to have to fetch 3 instructions from memory.
. With a single memory this will take 6 cycles.
. With 2 memories, we can fetch the instructions in
parallel with the data and do it in 3 cycles.
12
Common Microcontroller Architecture
13
CPU
A central processing unit (CPU) is the electronic circuitry
within a microcontroller that carries out the instructions of
a computer program by performing the basic arithmetic,
logical, control and input/output (I/O) operations specified
by the instructions.
CPU is the brain of a microcontroller.
CPU connects every part of a microcontroller into a single
system.
14
CPU
15
CPU
A basic CPU consists of the data path, which executes instructions,
and of the control unit, which basically tells the data path what to do.
16
CPU
Parts of a CPU:
1. ALU - The arithmetic logic unit executes all calculations
within the CPU
2. CU - control unit, coordinates how data moves around
3.Registers, a memory location within the actual processor that
work at very fast speeds.
of calculations
17
CPU
18
CPU: Control Unit
19
CPU: Control Unit
20
CPU: Control Unit
To ease the design of the control unit, Maurice Wilkes reflected
that the control unit is actually a small CPU by itself and could
benefit from its own set of microinstructions.
In his subsequent control unit design, program instructions were
broken down into microinstructions, each of which did some small
part of the whole instruction (like providing the correct register for
the ALU).
This essentially made control design a programming task: Adding a
new instruction to the instruction set boiled down to programming
the instruction in microcode. As a consequence, it suddenly became
comparatively easy to add new and complex instructions, and
instruction sets grew rather large and powerful as a result. This
earned the architecture the name Complex Instruction Set
Computer (CISC).
21
CPU: Control Unit
Of course, the powerful instruction set
has its price, and this price is speed:
Microcoded instructions execute slower
than hard-wired ones.
Furthermore, studies revealed that only
20% of the instructions of a CISC
machine are responsible for 80% of the
code (80/20 rule).
This and the fact that these complex
instructions can be implemented by a
combination of simple ones gave rise to
a movement back towards simple hard-
wired architectures, which were
correspondingly called Reduced
Instruction Set Computer (RISC).
22
CPU: Arithmetic Logic Unit
At the core of the CPU is the arithmetic logic unit (ALU),
which is used to perform computations (AND, ADD, INC, . . .
).
Several control lines select which operation the ALU should
perform on the input data.
The ALU takes two inputs and returns the result of the
operation as its output.
Source and destination are taken from registers or from
memory.
23
CPU: Arithmetic Logic Unit
24
CPU: Arithmetic Logic Unit
25
CPU: Arithmetic Logic Unit
26
CPU: Register File
27
CPU: Register File
Register TYPES:
28
CPU: Register File
29
CPU: Register File
30
CPU: Stack Pointer
The reason for placing the stack pointer at the end of the
data memory is that your variables are generally at the
start of the data memory, so by putting the stack at the
end of the memory it takes longest for the two to collide.
Since the SP must be initialized by the programmer, you must
look up how your controller handles the stack and either
initialize the SP to the last address in memory (if a push stores
first and decrements afterwards ) or to the last address
+ 1 (if the push decrements first).
32
Thank you
www.ump.edu.my 33