Professional Documents
Culture Documents
• CPU operation
• Memory space
• Software overview
• Peripheral overview
– Interrupt
– Timers
– Parallel port inputs and outputs
– Serial port
• low power special modes of
operation Noise
8051 Microcontroller Sukesh Rao Muligar, Asst. Prof. - ECE 1
Introduction
to
Microcontrollers
8051 Microcontroller Sukesh Rao Muligar, Asst. Prof. - ECE 2
Why do we need to learn
Microprocessors/controllers?
• General-purpose • Single-purpose
• Office
– Telephones, computers, security systems, fax machines, microwave, copier,
laser printer, color printer, paging etc.
• Auto
– Trip computer, engine control, air bag, ABS, instrumentation, security
system, transmission control, entertainment, climate control, cellular
phone, keyless entry
Interrupt 4K Timer 0
128 B
Control ROM RAM Timer 1
CPU
Bus Serial
OSC 4 I/O Ports
Control Port
TXD RXD
8051 Microcontroller P0
Sukesh Rao Muligar, P1 - ECE
Asst. Prof. P2 P3 17
Detailed Block Diagram
External
External
60K
64K 64K
SFR
EXT INT 4K
128
EA = 0 EA = 1
Direct
Addressing
Only
SFR [ Special Function
Direct & Registers]
Indirect
Addressing
128 Byte Internal RAM
C AC F0 RS1 RS0 OV F1 P
Carry Parity
Auxiliary Carry User Flag 1
User Flag 0 Register Bank Select Overflow
Bank 3 R0 R1 R2 R3 R4 R5 R6 R7
Bank 2 R0 R1 R2 R3 R4 R5 R6 R7
Bank 1 R0 R1 R2 R3 R4 R5 R6 R7
Bank 0 R0 R1 R2 R3 R4 R5 R6 R7
Writing
logic 1
OSC ÷12
C /T 0 TLx THx TFx
(8 Bit) (8 Bit) (1 Bit)
C /T 1
T PIN
INTERRUPT
TR
Gate
INT PIN
GATE:
When set, timer/counter x is enabled, if INTx pin is high
and TRx is set.
When cleared, timer/counter x is enabled, if TRx bit set.
C/T*:
When set, counter operation (input from Tx input pin).
When cleared, timer operation (input from internal clock).
Timer 0 Timer 1
Mode 0 Mode 0
Mode 1 Mode 1
Mode 2 Mode 2
Mode 3
T 0PIN
INTERRUPT
TR0
Gate
INT 0 PIN
OSC ÷12
C /T 0 TL0 TH0 INTERRUPT
C /T 1 TF0
T 0PIN
(5 Bit) (8 Bit)
TR0
Gate
INT 0 PIN
OSC ÷12
C /T 0 TL0 TH0 INTERRUPT
C /T 1 TF0
T 0PIN
(8 Bit) (8 Bit)
TR0
Gate
INT 0 PIN
OSC ÷12
C /T 0 TL0 TH0 INTERRUPT
C /T 1 TF0
T 0PIN
(8 Bit) (8 Bit)
TR0
Gate Reload
INT 0 PIN
TH0
(8 Bit)
OSC ÷12
C /T 0 TL0 INTERRUPT
C /T 1 TF0
T 0PIN
(8 Bit)
TR0
Gate
INT 0 PIN
TR1
8051 Microcontroller Sukesh Rao Muligar, Asst. Prof. - ECE 51
TIMER 1
OSC ÷12
C /T 0
TL1 TH1 TF1
C /T 1
T1PIN
INTERRUPT
TR1
Gate
INT1 PIN
OSC ÷12
C /T 0 TL1 TH1 INTERRUPT
C /T 1 TF1
T1PIN
(5 Bit) (8 Bit)
TR1
Gate
INT1 PIN
OSC ÷12
C /T 0 TL1 TH1 INTERRUPT
C /T 1 TF1
T1PIN
(8 Bit) (8 Bit)
TR1
Gate
INT1 PIN
OSC ÷12
C /T 0 TL1 TH1 INTERRUPT
C /T 1 TF1
T1PIN
(8 Bit) (8 Bit)
TR1
Gate Reload
INT1 PIN
TH1
(8 Bit)
• Solution:
• The start bit is always one bit, but the stop bit can be
one or two bits
1. SBUF Register
2. SCON Register
3. PCON Register
•We can set it to high by software and thereby double the baud rate.
– Timer 0 Overflow.
– Timer 1 Overflow.
– Reception/Transmission of Serial Character.
– External Event 0.
– External Event 1.
--
• EA : Global enable/disable.
• --- : Reserved for additional interrupt hardware.
Serial Port
INT 0 Pin
Timer 1 Pin
1. Immediate
2. Register
3. Direct
4. Register indirect
5. External Direct
• PUSH A is invalid.
ORG 500H
DATA1: DB 28 ;DECIMAL (1C in Hex)
DATA2: DB 00110101B ;BINARY (35 in Hex)
DATA3: DB 39H ;HEX
ORG 510H
DATA4: DB “2591” ; ASCII NUMBERS
ORG 518H
DATA6: DB “My name is Joe” ;ASCII CHARACTERS