You are on page 1of 5

Inside the Microcontroller

Registers
temporary storage area to hold data values
Registers named A, B, C, D etc

Arithmetic Logic Unit (ALU)


Hardware which performs arithmetic and logical
operations

Control Unit

Decodes the instructions fetched from memory


Generates control signals to perform operations

Instruction register
Instruction register

Inside the Microcontroller


Registers
Registers
Instruction
Instruction
Decoder &
Decoder &
Control
Control

Control Bus
Control Bus

ALU
ALU

Program Counter
Program Counter
2

Adding three numbers


Add numbers 35, 27 and 12
Which Microcontroller unit will add the two
numbers? (Register, ALU, Control Unit)
The ALU
Before the ALU can add the numbers, where
should the numbers be temporarily stored?
Registers
MOV instruction loads register with data
ADD instruction adds two data values

Adding three numbers

MOV instruction loads register with 35


MOV A, 35
Machine Code B035 (2 byte instruction)

Add 27 with contents of register


ADD A, 27
Machine Code 0427 (2 byte instruction)

Add 12 with contents of register


ADD A, 12
Machine Code 0412 (2 byte instruction)

What is the size of the program?


Three instructions each of 2 bytes = 6 bytes
4

Adding three numbers


Where should the
program be stored?
RAM/ROM
At which address
should the program be
stored?
Usually the first
address of the memory
Assume first address =
1400

Address
1400
1401
1402
1403
1404
1405

Instruction
B0
35
04
27
04
12
5

You might also like