Documente Academic
Documente Profesional
Documente Cultură
Microcontroller Fundamentals
1
Microprocessor Vs. Microcontroller
2
Microprocessor Vs. Microcontroller
Microprocessors Microcontrollers
3
Microprocessor Vs. Microcontroller
4
Microcontroller-Based System
5
Embedded System
An embedded product uses a microprocessor (or microcontroller) to do
one task and one task only
There is only one application software that is typically burned into ROM
A PC, in contrast with the embedded system, can be used for any
number of applications
7
Microcontroller 8051
8
Microcontroller (8051)
Flags (CY,P,OV,AC,
Memory Bank
Selection)
9
Microcontroller (8051)
10
Microcontroller (8051)
11
Microcontroller (8051)
12
Microcontroller (8051)
13
Microcontroller (8051)
14
Microcontroller (8051)
15
Microcontroller (8051)
RAM location from 0 to 7 are set aside for bank 0 of R0-R7 where R0 is
RAM location 0, R1 is RAM location 1, R2 is RAM location 2, and so
on, until memory location 7 which belongs to R7 of bank 0
It is much easier to refer to these RAM locations with names such as R0,
R1, and so on, than by their memory locations
16
Microcontroller (8051)
17
Microcontroller (8051)
18
Microcontroller (8051)
19
Microcontroller (8051)
20
Microcontroller (8051)
ALE (Address Latch Enable): for multiplexing and de-
multiplexing of data and address
Vcc: Pin 40 provides supply voltage to the chip. The voltage source is
+5V
21
Applications of Microcontroller
22
Microprocessors
23
Microprocessor
MPU communicates with Memory and I/O
using the System Bus
Address bus
Unidirectional
Memory and I/O Addresses
Data bus
Bidirectional
Transfers Binary Data and Instructions
Control lines
Read and Write timing signals
24
Microprocessor (MPU)
MPU (CPU)
Read instructions
Process binary data
25
Microprocessor-Based System
26
Microprocessor (8085)
27
Microprocessor (8085)
It is a 8 bit microprocessor.
It is manufactured with N-MOS technology.
It has 16-bit address bus address up to 216 = 65536 bytes
(64KB) memory locations through A0-A15 .
The first 8 lines of address bus and 8 lines of data bus are
multiplexed AD0 – AD7 .
Data bus is a group of 8 lines D0 – D7
It supports external interrupt request.
28
Microprocessor (8085)
A 16 bit program counter (PC)
A 16 bit stack pointer (SP)
Six 8-bit general purpose register arranged in pairs: BC, DE,
HL.
It requires a signal +5V power supply and operates at 3.2
MHZ single phase clock.
It is enclosed with 40 pins DIP (Dual in line package).
29
Microprocessor (8085)
30
Microprocessor (8085)
31
Microprocessor (8085)
32
Microprocessor (8085)
33
Microprocessor (8085)
Programmer’s model
34
Microprocessor (8085)
Instruction Types
35
Microprocessor (8085)
Addressing mode
Addressing modes are the manner of specifying effective address.
8085 Addressing mode can be classified into:
36
Microprocessor (8085)
Addressing mode
2 - Register addressing mode: The instruction specifies the
register or register pair in which the data is located
Ex: MOV A,B
Here the content of B register is copied to the Accumulator
37
Microprocessor (8085)
Addressing mode
4- Immediate addressing mode: The instruction contains the
data itself. This is either an 8 bit quantity or 16 bit (the LSB first and the
MSB is the second)
Ex: MVI A , 28h
LXI H , 2000h
First instruction loads the Accumulator with the 8-bit immediate data
28h
Second instruction loads the HL register pair with 16-bit immediate data
2000h
38
Microprocessor (8086)
39
Microprocessor (8086)
330_01 40
Microprocessor (8086)
Bus Interface Unit (BIU):
Handles all the data and addresses on the buses for the
execution unit.
330_01 42
Microprocessor (8086)
Execution Unit (EU)
Perform Arithmetic and logic operations (ALU)
43
Microprocessor (8086)
44
Microprocessor (8086)
Memory and Segment Registers
45
Microprocessor (8086)
Memory and Segment Registers
46
Microprocessor (8086)
♦ Logical and Physical Address
47
Memory address space and data organization
48
Memory address space and data organization
49
Memory address space and data organization
50
Memory address space and data organization
51
Segment registers and memory segmentation
52
Segment registers and memory segmentation
53
Segment registers and memory segmentation
54
Segment registers and memory segmentation
55
Segment registers and memory segmentation
CS = 0009H, DS = 0FFFH, SS = 10E0, and ES = 3281H. We note
here that code segment and data segment are overlapped while other
segments are disjointed
56
Special and General purpose registers
57
Special and General purpose registers
58
Special and General purpose registers
59
Special and General purpose registers
The stack pointer (SP) and base pointer (BP) are used with
the stack segment register (SS) to access memory
locations within the stack segment.
The source index (SI) and destination index (DI) are used
with DS or ES to generate addresses for instructions that
access data stored in the data segment of memory.
61
Special and General purpose registers
Status Register: The status register also called flag
register: is 16-bit register with only nine bits that are
implemented. Six of theses are status flags:
63
Special and General purpose registers
The sign flag (SF): The MSB of the result is copied into
SF. Thus, SF is set if the result is a negative number of
reset if it is positive.
64
Special and General purpose registers
The trap flag(TF): if TF is set, the 8086 goes into the single-
step mode of operation. When in the single-step mode, it
executes an instruction and then jumps to a special service
routine that may determine the effect of executing the
instruction. This type of operation is very useful for
debugging programs.
66
Generating a memory address
67
Generating a memory address
To express the 20-bit Physical Address of memory
Multiply Segment register by 10H ( or shift it to left by
four bit), Add it to the offset
68
Generating a memory address
69
Stack memory and registers
70
Stack memory and Registers
71
Stack memory and Registers
72
Stack memory and Registers
73
PUSH & POP instruction
74
PUSH & POP instruction
75
PUSH & POP instruction
76
PUSH & POP instruction
77
Input and Output address space
78