8051 Slides
8051 Slides
Sudip Nag
Department of E & ECE
IIT Kharagpur
Pin Diagram
Pin Diagram
Ground
Overview of 8051 Features
• ROM – 4K Bytes
• RAM – 128 B Bytes
tes
• Timer – 2
• I/O Pins
Pi – 32 (P0 tto P3)
• Serial Port – 1
• Interrupt sources – 6
Features (in detail)
Features (continued)
8051 Architecture (simplified)
(8 bit microcontroller)
(8-bit i t ll )
4 KB
128 Bytes
30 pF 30 pF
1.24-12 MHz
80051 A
Archittecturre (deetailed
d)
(88-bit miicrocon
ntrollerr)
Core Family Chips of 8051 Series
Nil
8051 Interfacing overview
TH0
TL0
P1 AD7-AD0 D7-D0
A7-A0
P3 A15-A8
External data memory access
P1 AD7-AD0 D7-D0
A7-A0
P3 A10-A8
ALU Capability
•Arithmetic Operation:
ADD INC,
ADD, INC DEC
DEC, CMPZ
CMPZ, CMPNZ,
CMPNZ SUBB,
SUBB MUL,
MUL
DIV
•Logical Operation:
AND, OR, EX-OR, RL, RLC, RR, RRC, SWAP
P0-P3, A, B, PSW,IP,IE
ACC, SCON, TCON
Bit addressable SFRs
Reset Operation
• Hold the RST pin to
a high level for at
least 2 cycles
• Power-on
P resett - can
be implemented by
connecting
ti a 10 uF F
capacitor between
RST pini andd
ground.
Interrupt Structure
• External Interrupt (2) – Generated by external
sources through and .
• Internal Interrupt
p ((3)) – From the on-chip
p
functional units
Interrupt Priority
• Set by writing to the special function interrupt priority
register (IP).
(IP)
Bits 7 6 5 4 3 2 1 0
X X X PS PT1 PX1PT0 PX0
Bits 7 6 5 4 3 2 1 0
EA X X ES S ET1 EX1 ET0 0 EX00
EA=0 – Disable all the interrupts; EA=1 – set or reset the
corresponding masking bit to enable (=1) or disable (=0)
an interrupt.
Bits 7 6 5 4 3 2 1 0
EA X X ES ET1 EX1 ET0 EX0
Serial port
Timer External Intr.
Intr
Interrupt Structure (Contd.)
• INT0 and INT: External interrupt; Low level sensitive; Must be
active for at least 12 CC to be sensed by the processor; REI
instruction at the end of the ISS deactivates this signal.
• Can be configured in edge-triggered (high-low) mode by setting
th IT0 or IT1 bits
the bit in
i the
th TCON register.
it
TCON register:
Bits 7 6 5 4 3 2 1 0
TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
If IT0/IT1=1,
IT0/IT1 1, IE0/IE1 is set by H/W when 11-00
transition is detected on INT0 or INT1.
Event sequence
• Initialization: Configure different components/
registers by appropriate values
values.
•Polling: After initialization, application program is
executed. Active interruptsp are checked as per
p the
assigned priority levels and are serviced.
Summary
• Features of 8051 microcontroller.
• Register organization; SFRs; memory
organization/interfacing.
• Basic internal architecture of 8051.
8051
• Multifunction ports; timing diagram;
memory addressing;
dd i
• Interrupt structure