Intel (Microprocessor)
Intel (Microprocessor)
4/8/16/32/
Interrupt ROM/EPROM/ 128/256/512/ Timer
control OTPROM 1KB RAM
CPU
Bus VO Ports
FullDuplex
OSC Serial Port
Control
HE
PO P2 P1 P3 TxD RxD
Address/
Data
8051.
Fig. 10.1 Block Diagram of Intel
8051. The common features of 8051 series of
diagram of Intel
Fig. 10.1 shows the block
microcontrollers are:
(0 8-bit CHMOS CPU contain 256 bytes on-chip RAM which acts as
Most of the microcontrollers of 8051 family 8XC251SP/SQ contain 512 bytes, and the
(1) 8XC51RA/RB/RC and such as 80C51BH,
memory. The microcontrollers
data
contains 1 KBRAM., A few entry level
8XC251SA/SB
80C31BH and 87C51 contain 128 bytes RAM. capacity varies from version to version, see
ROM/EPROM/OTPROM. The ROMless versions external
case of
) 4/8/16/32 KB are also available. In applicatiorn.
Table 10.1. ROMless versions
depends on the particular timer/counters. The
isused. The capacity 16-bit
Program memorymicrocontrollers contain 3 multimode 2timers//counters.
(iv) Most of the contain
80C51BH, 80C31BH and87C51
i.e. four 8-bit ports. The
lines
8XC152JA/JB/JC,microcontrollers contain 32 I/0 controller contains 5 or7I/0 ports.
(o) Most of the communication
universal I/Oports.
8XC152JA/JB/JC/JD, thecontroller contains 3 multifunctionneeded in industrial control
The 8XC51SL, keyboard It is
capabilities.
(pi) (single-bit logic)
Boolean processing8 8XC152JA/JB/JC/JD contains UART.
applications. The may be 5, 6, 7,10 or 15.
(oi) Multimode,fulll duplexserial port.differs from versionto version.interrupt
It
sources are : one
sources important
(oii) The number of interrupt proyided. The
interrupt priorityhas been
evel
from the serial port when a
transmission or reception is Complete, two
from input pins INTO and INT1,
etc. from timners, twy
(ix) 64 KB external datamemory space.
(a) 64 KBexternal program memory space.
(xi) Power saving modes.
Some versions are designed for specific applications, and therefore, they are provided wit h spe
cial features requied by the typical applications. Special features are :
(i) Pulse-width modulation. Afew versions have this feature, for example,
(i)
8XC51GB, 8XC151SA/SB and 8XC251SA/SB/SP/SQ.
DMA channel. Afew versions havethis feature, for example
(ii) A/D converter. Afew versions have A/D converter, for example, 8XC51GB.
,8XC51FA/F
8XC152JA/JB/JC/JD.
B/FC
ir) Watchdog-timer. It is adedicated internal timer which resetsthe:system when the
does not operate properly. Some versions have been provided with this
example, 8XC51GB,8XC51RA/RB/RC, 8XC151 and 8XC251. featsofture,waefor
(o) Programmable counter array to provide features like high-speed output, compare/cap
operation, etc. Some versions have this feature, for example, 8XC51FA/FB/FC, 8XCS1C
8XC151 and 8XC251.
The 8051 microcontrollers have two versions : COMMERCIAL and EXPRESS. The onerahns
temperature range for commercial versions is 0°C to 70°C and that for the express version is 40°C to
+85°C.
10.1.1 Registers
The 8051 is an accumulator based microcontroller. Its registers are :
PSW, register B,8-bit stack pointer, 16-bit data pointer, program register A (an accumulator),
16-bit timer registers for timer/counters, instruction register, control counter, program address register,
serial data buffer, capture registers, special function registers, etc. registers, RAM address register,
and divide operations. For other instructions it is used as Register Bis used during muliply
another scratch pad register. The daa
pointer consists of ahigh byte and a low byte. It holds 16-bit address.
or two independent 8-bit registers. The serial data It can beused as a 16-bit register
buffer and a receive buffer register. buffer is actually two separate registers :atranst
The 8051 has been provided with 4 banks of
registers, RO-R7. Physically these banks occupy the working registers. Each bank consists of 8wOTKIS
hex). Only one bank is active at a time. Bits 3 first 32 bytes of on-chip data RAM (address
and 4 of PSW
As the 8051 is a bit as well as
byte microcontroller, some ofdecideits
which bank is to be made acue
addressable. registers are both bit as weu d
Besides working registers, there are a
are both bit-and number of special function registers (SFRs). Some o
Symbol byte-addressable.
Name
Alist of SFRs is given
below:
ACC Address
B Accumulator E0
Remarks
Both bit-and byte-addressable
Bregister
PSW FO
SP
Program Status Word DO
do
Stack Pointer do
DPTR Data Pointer (DPH & 81
PO Port 0 DPL) 83 and 82 Consists of DPH and DPb
P1 Port 1 80 and byte-addressable
90
Both bit-and
do
Port 2
A0 do
Port 3
BO do
Interrupt Priority Control
B8
Interrupt Enable Control do
IE Serial Control A8 do
KON
98
Serial Data Buffer Both bit-and byte-addressable
SBUF 99
Power Control
PCON 97
TMOD Timer/Counter 0&1 Mode Control 89
T2CON Timer/Counter 2 Control
88
Both bit-and byte-addressable.
TCON Timer/Counter 0&1 Control It is in 8052 only.
C8
TLO Timer/Counter 0(low byte) 8A
THO Timer/Counter 0 (high byte) 8C
Timer/Counter 1 (low byte) 8B
IHI Timer/Counter 1 (high byte) 8D
Timer/Counter 2 (low byte) CC
TH2 Timer/Counter 2(high byte) CD
RCAP2L Timer/Counter 2Capture CA
Register (low byte)
RCAP2H
Timer/Counter 2Capture CB
Register (high byte)
Description of some registers are given below:
Data Pointer. It consists of DPH (a high byte)and
be used as a 16-bit register or as two DPL(a low byte). It holds 16-bit address. It can
PO, P1, P2 and P3. These are SFRindependent &-bit registers.
latches for Port 0, 1,2 and 3 respectively.
Serial Data Buffer. It consists of two separate
bufer register. registers, a transmit buffer register and a receive
Timer Registers. (TLO,THO), (TL1, TH1) and (TL2, TH2) are
are 16-bit counting registers for Timer/Counter 0, 1 and 2 register pairs. These registerpairs
respectively.
Capture Registers. RCAP2Land RCAP2H is a register pair. These registers are
for
the Timer2 cpature capture registers
mode.
Control Registers. Special Function Registers IE, IP TMOD, TCON,T2CON and SCON hold
Control and status bitsfor the interrupt
system, timer/counters, and the serial port. PCON is power
Oregister. The 8051 is provided with power-saving modes of operation. For applications where
rCOnsumption is critical, both HMOSand CHMOS versions provide reduced power modes of
Operation. For CHMOS version of the 8051 microcontroller, the reduced popower modes, Idle and
Power
able. Down modes sarethe standardfeatures. In HMOS versions only reduced power mode is avail-
ig, 10.PSW (Program Status Word). PSW register contains program status information as shown in
2. Its bitssare indicated as PSW.0, PSW.1, PSW.2,..PSW.7.
7 6 5 4 3 2 1 0 Bit No
The external interrupts INT0 and INT1 can be programmned to act as afalling edge triggeredor
low level triggered interrupt by setting and clearing the bits ITO and IT1 respectively inthe register
TCON. f an external interrupt is made edge triggered IEO or IE1, interrupt tlag is cleared by
microcontroller's hardware when the service routine is vectored. If the external interruptislevel
triggered, IEO or IE1 is controlled by external requesting source of interrupt. The externalinterrupt
source has to hold the interrupt request until the requested interrupt is actually generated.Thenit
has to deactivate the request before the interrupt service routine is completed. When the service
routine is vectored, the interrupt flag is cleared by the
Enabling of 8051 Interrupts. The 8051 contains external interrupt requestngs It:is a
special
function register (SFR). Each of interrupt sources canan be interrupt enable register /IE.
disabled
by set
6 5 2 1
7 Bit No.
X ET2 ES ET1 EX1 ETO ÉX0
EA Syrnbol
Fia. 10.4 Interrupt Enable Register IE (Bit Addressable)
It is for External
Interrupt 0(INTO). When EX0 = 1, INTOis enabled provided EA
BitNo.0 EXO. disabled.
-0.INTO is
When EX0-0,
ETO. It is for Timer 0 Overflow interrupt. If ETO=1, the Timer 0 Overflow interrupt is
BANo. provided EA =1. IfETO= 0., Timer 0 Overflow interrupt is disabled.
1,
ealbled,
EXI. It isfor External Interrupt 1(INT1). If EX1 =1, INT1is enabled, providedEA =1. If
No. 2, disabled.
BI
EN=0,INTIis for Timer 1Overflow interrupt.If ET1 =1, Timer 1 Overflow interrupt is enabled,
3,ET1.Itis
No. =0,Timer 1 Overflow interrupt is disabled.
dEA=1.lfETI
BI
provided
ES. It is for serial port interrupt. If ES =1,thesserial portinterrupt is enabled, provided EA
BitNo.4, port interrupt isdisabled.
CES = 0, the serial
interrupt. If ET2 = 1, the Timer 2 Overflow or
ET2. Itis,for Timer 2 Overflow or captureOverflow
5,
Bit No.
interruptis
enabled. If ET2 =0, the Timer 2 or capture interrupt is disabled.
capture
Reserved.
BitNo.6. disable bit..If EA =0,all interrupts are disabled. If EA =1, each interrupt
EA. It is a global
Bit No. 7, or clearing its enable bit.
re is individually enabled or disabled by setting
Priority. By setting or clearing a bit in the special function register IP, the user can
Interrupt level or low-priority level. Alow-priority
program each interrupt individually in either high-priority
interrupted by a high-priority interrupt, but it can not be interrupted by any other
interrupt carn be interrupt can not be interrupted by alow-priority interrupt.
low-priority interrupt. Ahigh-priority
of various interrupts of Intel 8051series of microcontrollers. If
two
Table 10.2 shows priority level and another interrupt of
(i.e. one interrupt of high-priority level
interrupts of different priority level
simultaneously, the interrupt of the higher-priority level will be served first.
low-priority level) occur occur simultaneously, an internal polling determines
priority level given in the Table 10.2
i two interruptsof the same level on the basis of the priority level
Wnuch interruptis of higher-priority
details of the bits of Interrupt Priority
Register, IP.
Fig. 10.5 shows the Bit No.
3 2 1
7 6 5 4
PX0
Symbol
PT1 PX1 PTO
X X PT2 PS
Priority Register
Fig. 10.5 Interrupt PX0= 0,
priority level. PX0 = 1, higher-priority.
Bit No. 0,PX0. It is for External Interrupt 0 (INTO)
higher-priority. PTO =0, lower-
lower-priority.
Bit No, 1,
PTO. It is for Timer 0Interrupt
priority level. PTO =1,
higher-priority. PX1 = 0,
priornNo.ity.2,
Bit PX1. It is for External Interrupt 1(INT1) prioritylevel. PX1 = 1,
lower-
higher-priority. PTl =0,
ower-priority .
Bit No. 3, priority level. PT1 =1, lower-priority.
PT1. It is for Timer 11Interrupt higher-priority. PS =0,
piority. level. PS=1,
BitNo.4,PS. It is for Serial PorttInterruptpriority