02 Introduction To Microcontrollers
02 Introduction To Microcontrollers
Microcontrollers
8051 Microcontroller
• An 8-bit microcontroller introduced by Intel in
1981, the original member of family.
• The core was equipped with all essential
components required for embedded system.
• Became very popular after Intel allowed other
manufacturer to make any flavor of 8051,
provided they remain code compatible.
• The 8-bit arena is the growth segment of market.
Program Memory ?
3 No on-chip Program Memory
5 On-chip Program Memory
Example
8052 8051 with 8 KB PROM and 3 Timers. A superset of 8051.
8752 8051 with 8 KB EPROM and 3 Timers. A variant of 8052.
An Introduction to 8051 – Manish Tiwari 7
8051 Core Pin Description
19
XTAL 1
T= (1/frequency)*C*12
FFH
Special
Function 128 bytes
Registers Internal 4K bytes
(SFRs) Program
80H Memory
7FH
General (ROM)
Purpose 128 bytes
RAM
(GPR)
00H
General
Purpose
RAM
(GPR)
FFH FFH
General Special
128 bytes Purpose Function 128 bytes
RAM Registers
(GPR) (SFRs)
80H 80H
7FH
General
Purpose 128 bytes
RAM
(GPR)
Both 8051, 8052.
00H
Accessible through ANY
ADDRESSING Mode.
END
END
Note: DAA adjusts for BCD, only & only when addition (ADD)
was done on Valid BCD No.
END
An Introduction to 8051 – Manish Tiwari 84
Multiplication
Multiplication is performed with registers A & B only.
MUL AB
B-A A*B
A Lower byte of product.
B Higher byte of product.
After multiplication
─ CY = 0, always.
─ If OV = 0, result ≤ FFH i.e. result is 8-bit only and B=0.
─ If OV = 1, result > FFH i.e. result is 16-bit.
DIV AB
Operation performed is A/B
A Quotient after division.
B Remainder after division.
After division
─ CY = 0, always.
─ If OV = 0, Normal division.
─ If OV = 1, Divide by zero.
CY A7 A6 A5 A4 A3 A2 A1 A0
CY A7 A6 A5 A4 A3 A2 A1 A0
Rotate Accumulator Right
CY A7 A6 A5 A4 A3 A2 A1 A0
CY A7 A6 A5 A4 A3 A2 A1 A0
Program P17
Special ANDing.
─ ANL Addr, A (Addr) (Addr) AND A
─ ANL Addr, #DATA8 (Addr) (Addr) AND #DATA8
Special ORing.
─ ORL Addr, A (Addr) (Addr) OR A
─ ORL Addr, #DATA8 (Addr) (Addr) OR #DATA8
Special XORing.
─ XRL Addr, A (Addr) (Addr) XOR A
─ XRL Addr, #DATA8 (Addr) (Addr) XOR #DATA8
U U U U 0 0 1 1
UUUU 3
U U U U 0 1 0 1 0 0 1 1 0 1 0 1
UUUU 5 3 5
U U U U 0 0 1 1
UUUU 3
POP R0
POP B
POP A
RET ; Back to caller.