0% found this document useful (0 votes)
32 views27 pages

MPMC U 4

Material mpmc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views27 pages

MPMC U 4

Material mpmc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 27

A microcontroller is a small and low-cost microcomputer, which is designed to

perform the specific tasks of embedded systems like displaying microwave’s


information, receiving remote signals, etc.
The general microcontroller consists of the processor, the memory (RAM, ROM,
EPROM), Serial ports, peripherals (timers, counters), etc.

Difference between Microprocessor and Microcontroller

The following table highlights the differences between a microprocessor and a


microcontroller −

Microcontroller Microprocessor

Microcontrollers are used to execute a Microprocessors are used for big


single task within an application. applications.

Its designing and hardware cost is low. Its designing and hardware cost is high.

Easy to replace. Not so easy to replace.

It is built with CMOS technology, which Its power consumption is high because it
requires less power to operate. has to control the entire system.

It consists of CPU, RAM, ROM, I/O ports. It doesn’t consist of RAM, ROM, I/O ports.
It uses its pins to interface to peripheral
devices.

Types of Microcontrollers

Microcontrollers are divided into various categories based on memory,


architecture, bits and instruction sets. Following is the list of their types −
Bit
Based on bit configuration, the microcontroller is further divided into three
categories.
 8-bit microcontroller − This type of microcontroller is used to execute
arithmetic and logical operations like addition, subtraction,
multiplication division, etc. For example, Intel 8031 and 8051 are 8
bits microcontroller.
 16-bit microcontroller − This type of microcontroller is used to
perform arithmetic and logical operations where higher accuracy and
performance is required. For example, Intel 8096 is a 16-bit
microcontroller.
 32-bit microcontroller − This type of microcontroller is generally used
in automatically controlled appliances like automatic operational
machines, medical appliances, etc.
Memory
Based on the memory configuration, the microcontroller is further divided into
two categories.
 External memory microcontroller − This type of microcontroller is
designed in such a way that they do not have a program memory on
the chip. Hence, it is named as external memory microcontroller. For
example: Intel 8031 microcontroller.
 Embedded memory microcontroller − This type of microcontroller is
designed in such a way that the microcontroller has all programs and
data memory, counters and timers, interrupts, I/O ports are
embedded on the chip. For example: Intel 8051 microcontroller.
Instruction Set
Based on the instruction set configuration, the microcontroller is further divided
into two categories.
 CISC − CISC stands for complex instruction set computer. It allows the
user to insert a single instruction as an alternative to many simple
instructions.
 RISC − RISC stands for Reduced Instruction Set Computers. It reduces
the operational time by shortening the clock cycle per instruction.

Applications of 8051:

 Consumer Appliances (TV Tuners, Remote controls, Computers, etc.)


 Home Applications (TVs, VCR, Video Games, Music Instruments, Home
Security Systems, etc.)
 Communication Systems (Mobile Phones, Intercoms, etc.)
 Office (Fax Machines, Printers, Copiers, Laser Printers, etc.)
 Automobiles (Air Bags, ABS, Engine Control, Temperature Control, Keyless
Entry, etc)
 Aeronautical and Space
 Medical Equipment
 Defense Systems
 Robotics

Features of 8051:
 8-bit ALU, Accumulator, 8-bit Registers and 8-bit data bus; hence it is an 8-
bit microcontroller
 16-bit program counter (PC) and Data Pointer (DPTR)
 8-bit Processor Status Word (PSW)
 8-bit Stack Pointer
 Internal RAM of 128bytes
 Special Function Registers (SFRs) of 128 bytes
 On chip ROM is 4KB
 Special Function Registers (SFRs) of 128bytes
 32 I/O pins arranged as four 8-bit ports (P0 -P3)
 Two 16-bit timer/counters : T0 andT1
 Two external and three internal vectored interrupts
 Full duplex UART (serial port)

8051 Microcontroller Architecture

8051 microcontroller is designed by Intel in 1981. It is an 8-bit microcontroller. It


is built with 40 pins DIP (dual inline package), 4kb of ROM storage and 128 bytes
of RAM storage, 2 16-bit timers. It consists of are four parallel 8-bit ports, which
are programmable as well as addressable as per the requirement. An on-chip
crystal oscillator is integrated in the microcontroller having crystal frequency of
12 MHz.

Following diagram is 8051 Microcontroller architecture . Let us have a look at


each part or block of this Architecture of microcontroller.
8051 Microcontroller Architecture

1. Central Processor Unit (CPU)


2. Interrupt Controller- INT0 ,INT1,TF0,TF1 and SI
3. Internal Memory– RAM (128 bytes) and ROM (4KB)
4. Bus Control- Data Bus(8-bit) and Address Bus(16-bit)
5. Timers/Counters- Timer0 and Timer1
6. Oscillator- 12KHZ clock Frequency
7. 4 Parallel I/O ports- P0,P1,P2 and P3
8. Serial Port(UART)-TxD and Rxd

Central Processor Unit (CPU)

As we know that the CPU is the brain of any processing device of the
microcontroller. It monitors and controls all operations that are performed on the
Microcontroller units. The User has no control over the work of the CPU directly .
It reads program written in ROM memory and executes them and do the expected
task of that application.

Interrupts

As its name suggests, Interrupt is a subroutine call that interrupts of the


microcontrollers main operations or work and causes it to execute any other
program, which is more important at the time of operation. The feature of
Interrupt is very useful as it helps in case of emergency operations. An Interrupts
gives us a mechanism to put on hold the ongoing operations, execute a
subroutine and then again resumes to another type of operations.
The Microcontroller 8051 can be configured in such a way that it temporarily
terminates or pause the main program at the occurrence of interrupts. When a
subroutine is completed, Then the execution of main program starts. Generally,
five interrupt sources are there in 8051 Microcontroller. There are 5 vectored
interrupts are shown in below

 Timer 0 overflow interrupt - TF0


 Timer 1 overflow interrupt - TF1
 External hardware interrupt - INT0
 External hardware interrupt - INT1
 Serial communication interrupt - RI/TI

Out of these, (INT0) ̅ and (INT1) ̅ are external interrupts that could be
negative edge triggered or low level triggered. When All these interrupts
are activated, set the corresponding flogs except for serial interrupt,. The
interrupt flags are cleared when the processor branches to the interrupt
service routine (ISR). The external interrupt flags are cleared when the
processor branches to the interrupt service routine, provides the interrupt
is a negative edge triggered whereas the timers and serial port interrupts
two of them are external interrupts, two of them are timer interrupts and
one serial port interrupt terminal in general.

Memory

Microcontroller requires a program which is a collection of instructions. This


program tells microcontroller to do specific tasks. These programs require a
memory on which these can be saved and read by Microcontroller to perform
specific operations of a particular task. The memory which is used to store
the program of the microcontroller is known as code memory or Program
memory of applications. It is known as ROM memory of microcontroller also
requires a memory to store data or operands temporarily of the micro controller.
The data memory of the 8051 is used to store data temporarily for operation is
known RAM memory. 8051 microcontroller has 4K of code memory or program
memory,that has 4KB ROM and also 128 bytes of data memory of RAM.

BUS

Basically Bus is a collection of wires which work as a communication channel or


medium for transfer of Data. These buses consists of 8, 16 or more wires of the
microcontroller. Thus, these can carry 8 bits,16 bits simultaneously. Hire two
types of buses that are shown in below

 Address Bus
 Data Bus
Address Bus: Microcontroller 8051 has a 16 bit address bus for transferring the
data. It is used to address memory locations and to transfer the address from CPU
to Memory of the microcontroller. It has four addressing modes that are

 Immediate addressing modes.


 Bank address (or) Register addressing mode.
 Direct Addressing mode.
 Register indirect addressing mode.

Data Bus: Microcontroller 8051 has 8 bits of the data bus, which is used to carry
data of particular applications.

Oscillator

Generally, we know that the microcontroller is a device, therefore it requires


clock pulses for its operation of microcontroller applications. For this purpose,
microcontroller 8051 has an on-chip oscillator which works as a clock source for
Central Processing Unit of the microcontroller. The output pulses of oscillator are
stable. Therefore, it enables synchronized work of all parts of the 8051
Microcontroller.

Input/Output Port

Normally microcontroller is used in embedded systems to control the operation


of machines in the microcontroller. Therefore, to connect it to other machines,
devices or peripherals we require I/O interfacing ports in the microcontroller
interface. For this purpose microcontroller 8051 has 4 input, output ports to
connect it to the other peripherals

Timers/Counters

8051 microcontroller has two 16-bit timers and counters. These counters are
again divided into a 8 bit register. The timers are used for measurement of
intervals to determine the pulse width of pulses.

Serial Port

TXD and RXD are utilized for serial port. Each pin has separate buffer registers
named as SBUF.

The pin diagram of 8051 microcontroller looks as follows −


 Pins 1 to 8 − These pins are known as Port 1. This port doesn’t serve
any other functions. It is internally pulled up, bi-directional I/O port.
 Pin 9 − It is a RESET pin, which is used to reset the microcontroller to
its initial values.
 Pins 10 to 17 − These pins are known as Port 3. This port serves some
functions like interrupts, timer input, control signals, serial
communication signals RxD and TxD, etc.
 Pins 18 & 19 − These pins are used for interfacing an external crystal
to get the system clock.
 Pin 20 − This pin provides the power supply to the circuit.
 Pins 21 to 28 − These pins are known as Port 2. It serves as I/O port.
Higher order address bus signals are also multiplexed using this port.
 Pin 29 − This is PSEN pin which stands for Program Store Enable. It is
used to read a signal from the external program memory.
 Pin 30 − This is EA pin which stands for External Access input. It is
used to enable/disable the external memory interfacing.
 Pin 31 − This is ALE pin which stands for Address Latch Enable. It is
used to demultiplex the address-data signal of port.
 Pins 32 to 39 − These pins are known as Port 0. It serves as I/O port.
Lower order address and data bus signals are multiplexed using this
port.
 Pin 40 − This pin is used to provide power supply to the circuit.

Microcontrollers 8051 Input Output Ports


8051 microcontrollers have 4 I/O ports each of 8-bit, which can be configured as
input or output. Hence, total 32 input/output pins allow the microcontroller to be
connected with the peripheral devices.
 Pin configuration, i.e. the pin can be configured as 1 for input and 0
for output as per the logic state.
Input/Output (I/O) pin − All the circuits within the
o
microcontroller must be connected to one of its pins
except P0 port because it does not have pull-up resistors
built-in.
o Input pin − Logic 1 is applied to a bit of the P register. The
output FE transistor is turned off and the other pin
remains connected to the power supply voltage over a
pull-up resistor of high resistance.
 Port 0 − The P0 (zero) port is characterized by two functions −
o When the external memory is used then the lower
address byte (addresses A0A7) is applied on it, else all
bits of this port are configured as input/output.
o When P0 port is configured as an output then other ports
consisting of pins with built-in pull-up resistor connected
by its end to 5V power supply, the pins of this port have
this resistor left out.
Input Configuration
If any pin of this port is configured as an input, then it acts as if it “floats”, i.e. the
input has unlimited input resistance and in-determined potential.
Output Configuration
When the pin is configured as an output, then it acts as an “open drain”. By
applying logic 0 to a port bit, the appropriate pin will be connected to ground
(0V), and applying logic 1, the external output will keep on “floating”.
In order to apply logic 1 (5V) on this output pin, it is necessary to build an external
pullup resistor.
Port 1
P1 is a true I/O port as it doesn’t have any alternative functions as in P0, but this
port can be configured as general I/O only. It has a built-in pull-up resistor and is
completely compatible with TTL circuits.
Port 2
P2 is similar to P0 when the external memory is used. Pins of this port occupy
addresses intended for the external memory chip. This port can be used for
higher address byte with addresses A8-A15. When no memory is added then this
port can be used as a general input/output port similar to Port 1.
Port 3
In this port, functions are similar to other ports except that the logic 1 must be
applied to appropriate bit of the P3 register.

Pins Current Limitations


 When pins are configured as an output (i.e. logic 0), then the single
port pins can receive a current of 10mA.
 When these pins are configured as inputs (i.e. logic 1), then built-in
pull-up resistors provide very weak current, but can activate up to 4
TTL inputs of LS series.
 If all 8 bits of a port are active, then the total current must be limited
to 15mA (port P0: 26mA).
 If all ports (32 bits) are active, then the total maximum current must
be limited to 71mA.

8051 Microcontroller Special Function


Registers (SFRs)

The 8051 Microcontroller Special Function Registers act as a control


table that monitor and control the operation of the 8051
Microcontroller. If you observe in Internal RAM Structure, the Address
Space from 80H to FFH is allocated to SFRs.

Out of these 128 Memory Locations (80H to FFH), there are only 21
locations that are actually assigned to SFRs. Each SFR has one Byte
Address and also a unique name which specifies its purpose.

Since the SFRs are a part of the Internal RAM Structure, you can access
SFRs as if you access the Internal RAM. The main difference is the
address space: first 128 Bytes (00H to 7FH) is for regular Internal RAM
and next 128 Bytes (80H to FFH) is for SFRs.

TIP: As only 21 of the possible 128 SFR memory locations are


assigned, it is recommended that the remaining registers or memory
locations are not accessed during programming.

Before going further, get an idea on 8051 MICROCONTROLLER


ARCHITECTURE.
List of 8051 Microcontroller Special Function Registers

 A or ACC
 B
 DPL
 DPH
 IE
 IP
 P0
 P1
 P2
 P3
 PCON
 PSW
 SCON
 SBUF
 SP
 TMOD
 TCON
 TL0
 TH0
 TL1
 TH1

Categories of 8051 Microcontroller Special Function


Registers

All the 21 8051 Microcontroller Special Function Registers (SFRs) along


with their functions and Internal RAM Address is given in the following
table.
There are many ways to categorize these 21 Special Function Registers
but I find the following way as an appropriate one. The 21 Special
Function Registers of 8051 Microcontroller are categorized in to seven
groups. They are:

Math or CPU Registers: A and B

Status Register: PSW (Program Status Word)

Pointer Registers: DPTR (Data Pointer – DPL, DPH) and SP (Stack


Pointer)

I/O Port Latches: P0 (Port 0), P1 (Port 1), P2 (Port 2) and P3 (Port 3)

Peripheral Control Registers: PCON, SCON, TCON, TMOD, IE and IP


Peripheral Data Registers: TL0, TH0, TL1, TH1 and SBUF

CPU or Math Registers

A or Accumulator (ACC)

The Accumulator or Register A is the most important and most used


8051 Microcontroller SFRs. The Register A is located at the address
E0H in the SFR memory space. The Accumulator is used to hold the
data for almost all the ALU Operations.

Some of the operations where the Accumulator is used are:

 Arithmetic Operations like Addition, Subtraction, Multiplication


etc.
 Logical Operations like AND, OR, NOT etc.
 Data Transfer Operations (between 8051 and External Memory)
The name “Accumulator” came from the fact this register is used to
accumulate (or store) the result of all Arithmetic and most of the
Logical Operations.

B (Register B)

The B Register is used along with the ACC in Multiplication and Division
operations. These two operations are performed on data that are
stored only in Registers A and B. During Multiplication Operation, one
of the operand (multiplier or multiplicand) is stores in B Register and
also the higher byte of the result.

In case of Division Operation, the B Register holds the divisor and also
the remainder of the result. It can also be used as a General Purpose
Register for normal operations and is often used as an Auxiliary
Register by Programmers to store temporary results.

Register B is located at the address F0H of the SFR Address Space.

Program Status Word (PSW)

The PSW or Program Status Word Register is also called as Flag


Register and is one of the important SFRs. The PSW Register consists
of Flag Bits, which help the programmer in checking the condition of
the result and also make decisions.

Flags are 1-bit storage elements that store and indicate the nature of
the result that is generated by execution of certain instructions. The
following image shows the contents of the PSW Register.
The following table describes the function of each flag.

Pointer Registers

Data Pointer (DPTR – DPL and DPH)

The Data Pointer is a 16-bit Register and is physically the combination


of DPL (Data Pointer Low) and DPH (Data Pointer High) SFRs. The Data
Pointer can be used as a single 16-bit register (as DPTR) or two 8-bit
registers (as DPL and DPH).

DPTR doesn’t have a physical Memory Address but the DPL (Lower
Byte of DPTR) and DPH (Higher Byte of DPTR) have separate addresses
in the SFR Memory Space. DPL = 82H and DPH = 83H.

The DPTR Register is used by the programmer addressing external


memory (Program – ROM or Data – RAM).
Stack Pointer (SP)

SP or Stack Pointer points out to the top of the Stack and it indicates
the next data to be accessed. Stack Pointer can be accesses using
PUSH, POP, CALL and RET Instructions. The Stack Pointer is an 8-bit
register and upon reset, the Stack Pointer is initialized with 07H.

When writing a new data byte into the stack, the SP (Stack Pointer) is
automatically incremented by 1 and the new data is written at an
address SP+1. When reading data from stack, the data is retrieved
from the Address in SP and after that the SP is decremented by 1 (SP-
1).

I/O Port Registers (P0, P1, P2 and P3)


The 8051 Microcontroller four Ports which can be used as Input and/or
Output. These four ports are P0, P1, P2 and P3. Each Port has a
corresponding register with same names (the Port Registers are also
P0, P1, P2 and P3). The addresses of the Port Registers are as follows:
P0 – 80H, P1 – 90H, P2 – A0H and P2 – B0H.

Each bit in these SFRs corresponds to one physical Pin in the 8051
Microcontroller. All these Port Registers are both Bit Addressable and
Byte Addressable. Writing 1 or 0 on a Port Register Bit will reflect as an
appropriate voltage (5V and 0V) on the corresponding Pin.

If a Port Bit is SET (declared as 1), the corresponding Port Pin will be
configured as Input and similarly if a Port Bit is CLEARED (declared as
0), the corresponding Port Pin is configured as Output. Upon reset, all
the Port Bits are SET (1) and hence, all the Port Pins are configured as
Inputs.
Peripheral Control Registers

PCON (Power Control)

The PCON or Power Control register, as the name suggests is used to


control the 8051 Microcontroller’s Power Modes and is located at 87H
of the SFR Memory Space. Using two bits in the PCON Register, the
microcontroller can be set to Idle Mode and Power Down Mode.

NOTE: PCON register is not bit addressable.

During Idle Mode, the Microcontroller will stop the Clock Signal to the
ALU (CPU) but it is given to other peripherals like Timer, Serial,
Interrupts, etc. In order to terminate the Idle Mode, you have to use an
Interrupt or Hardware Reset.

In the Power Down Mode, the oscillator will be stopped and the power
will be reduced to 2V. To terminate the Power Down Mode, you have to
use the Hardware Reset.

Apart from these two, the PCON Register can also be used for few
additional purposes. The SMOD Bit in the PCON Register is used to
control the Baud Rate of the Serial Port.

There are two general purpose Flag Bits in the PCON Register, which
can be used by the programmer during execution.

Bit Symbol Description Additional Info

The
7 SMOD Serial Comm. Baud Rate If 1, doubles the baud rate
Modify Bit using Timer 1. If 0, normal following
timer 1 baud rate. table
describes
6– —- — the
4
function
of each
3 GF1 General Purpose User Flag (Bit
1) bit in the
PCON

2 GF0 General Purpose User Flag (Bit


Register.
0)

1 PD Power Down Bit To enter Power Down Mode,


set to 1

0 IDL Idle Mode Bit To enter Idle Down Mode, set


to 1
SCON (Serial Control)

The Serial Control or SCON SFR is used to control the 8051


Microcontroller’s Serial Port. It is located as an address of 98H. Using
SCON, you can control the Operation Modes of the Serial Port, Baud
Rate of the Serial Port and Send or Receive Data using Serial Port.

SCON Register also consists of bits that are automatically SET when a
byte of data is transmitted or received.

The following table describes the function of each bit in the SCON
Register.

Bit Symbol Description

7 SM0 Serial Port Mode Selection Bit 0

6 SM1 Serial Port Mode Selection Bit 1

5 SM2 Multiprocessor Comm. Bit

4 REN Receive Enable Bit

3 TB8 Transmitted Bit 8


2 RB8 Received Bit 8

1 TI Transmit Interrupt Flag

0 RI Receive Interrupt Flag

The Serial Port Mode Selection Bits (SM0 and SM1) determine the mode
of UART and also the baud rate. The following table gives an overview
of how the Serial Port Mode Selection Bits can be used to configure
Serial Port (UART) of 8051.

Serial Port Mode Selection Bits

SM SM1 Mod Description Baud Rate


0 e

0 0 0 8-Bit Synchronous Shift Register Fixed Baud Rate


Mode

(Frequency of oscillator
/ 12)

0 1 1 8-bit Standard UART Variable Baud Rate


mode (Can be set by Timer 1)

1 0 2 9-bit Multiprocessor Comm. Fixed Baud Rate


mode

(Frequency of oscillator
/ 32 or Frequency of
oscillator / 64

1 1 3 9-bit Multiprocessor Comm. Variable Baud Rate


mode (Can be set by Timer 1)
TCON (Timer Control)

Timer Control or TCON Register is used to start or stop the Timers of


8051 Microcontroller. It also contains bits to indicate if the Timers has
overflowed. The TCON SFR also consists of Interrupt related bits.

The following table gives the description of each bit in the TCON SFR.

Bit Symbol Description Additional Info

7 TF1 Timer 1 Overflow Flag Set when Timer 1 overflows


(all 1s to 0). Cleared when
processor executes ISR at
001BH.

6 TR1 Timer 1 Run Control Bit To enable Timer/Counter, set


to 1. Clear to halt the timer.

5 TF0 Timer 0 Overflow Flag Set when Timer 0 overflows


(all 1s to 0). Cleared when
processor executes ISR at
000BH.

4 TR0 Timer 0 Run Control Bit To enable Timer/Counter, set


to 1. Clear to halt the timer.

3 IE1 Ext. Interrupt 1 Edge Flag Set when HIGH to LOW is


received on INT1 (P3.3).
Cleared when processor
executes ISR at 0013H.

2 IT1 Ext. Interrupt 1 Type Control If 1, Interrupt 1 occurs on


Bit falling edge. If 0, Interrupt 1
occurs on low level.
1 IE0 Ext. Interrupt 0 Edge Flag Set to 1 when HIGH to LOW
is received on INT0 (P3.2).
Cleared when processor
executes ISR at 0003H.

0 IT0 Ext. Interrupt 0 Type Control If 1, Interrupt 0 occurs on


Bit falling edge. If 0, Interrupt 0
occurs on low level.

TMOD (Timer Mode)

The TMOD or Timer Mode register or SFR is used to set the Operating
Modes of the Timers T0 and T1. The lower four bits are used to
configure Timer0 and the higher four bits are used to configure Timer1.

The following table gives a brief description of each bit in the TMOD
SFR.

Bit Symbol Description

7/3 Gate OR Gate Enable Bit

6/2 C/Tx Select Timer or Counter Mode

5/1 TxM1 Timer / Counter Operating Mode Select Bit 1

4/0 TxM0 Timer / Counter Operating Mode Select Bit 0


The Gatex bit is used to operate the Timerx with respect to the INTx
pin or regardless of the INTx pin.

 GATE1 = 1 ==> Timer1 is operated only if TR1 (in TCON) is SET


and Signal on INT1 is HIGH.
 GATE1 = 0 ==> Timer1 is operated irrespective of Signal on INT1
pin but TR1 (in TCON) must be SET.
 GATE0 = 1 ==> Timer0 is operated only if TR0 (in TCON) is SET
and Signal on INT0 is HIGH.
 GATE0 = 0 ==> Timer0 is operated irrespective of Signal on INT0
pin but TR0 (in TCON) must be SET.
The C/Tx bit is used selects the source of pulses for the Timer to count.

 C/T1 = 1 ==> Timer1 counts pulses from Pin T1 (P3.5) (Counter


Mode)
 C/T1 = 0 ==> Timer1 counts pulses from internal oscillator
(Timer Mode)
 C/T0 = 1 ==> Timer0 counts pulses from Pin T0 (P3.4) (Counter
Mode)
 C/T0 = 0 ==> Timer0 counts pulses from internal oscillator
(Timer Mode)

TxM0 TxM1 Mode Description

0 0 0 13-bit Timer Mode (THx – 8-bit and TLx – 5-bit)

0 1 1 16-bit Timer Mode

1 0 2 8-bit Auto Reload Timer Mode

1 1 3 Two 8-bit Timer Mode or Split Timer Mode


NOTE: x = 0 for Timer 0 and x = 1 for Timer 1.

IE (Interrupt Enable)

The IE or Interrupt Enable Register is used to enable or disable


individual interrupts. If a bit is SET, the corresponding interrupt is
enabled and if the bit is cleared, the interrupt is disabled. The Bit7 of
the IE register i.e., EA bit is used to enable or disable all the interrupts.

The following table describes the functions of each bit in the IE


Register.

Bit Symbol Description Additional Info

7 EA Global Interrupt Enable Bit. If set to 1, individual interrupts


can be enabled. If set to 0, all
interrupts are disabled.

6 — —

5 ET2 Reserved

4 ES Serial Port Interrupt Enable Bit If set to 1, Serial Port interrupt


is enabled. If set to 0, Serial
Port interrupt is disabled.
3 ET1 Timer 1 Overflow Interrupt If set to 1, Timer 1 Overflow
Enable Bit interrupt is enabled. If set to 0,
Timer 1 Overflow interrupt is
disabled.

2 EX1 Ext. Interrupt 1 Enable Bit If set to 1, Ext. Interrupt 1 is


enabled. If set to 0, Ext.
Interrupt 1 is disabled.

1 ET0 Timer 0 Overflow Interrupt If set to 1, Timer 0 Overflow


Enable Bit interrupt is enabled. If set to 0,
Timer 0 Overflow interrupt is
disabled.

0 EX0 Ext. Interrupt 0 Enable Bit If set to 1, Ext. Interrupt 0 is


enabled. If set to 0, Ext.
Interrupt 0 is disabled.

NOTE: The Interrupt Enable (IE) SFR is bit addressable.

IP (Interrupt Priority)

The IP or Interrupt Priority Register is used to set the priority of the


interrupt as High or Low. If a bit is CLEARED, the corresponding
interrupt is assigned low priority and if the bit is SET, the interrupt is
assigned high priority.

The following table describes the functions of each bit in the IP


Register.

Bit Symbol Description


7 — —

6 — —

5 PT2 Reserved

4 PS Priority of Serial Port Interrupt

3 PT1 Priority of Timer 1 Overflow Interrupt

2 PX1 Priority of Ext. Interrupt 1

1 PT0 Priority of Timer 0 Overflow Interrupt

0 PX0 Priority of Ext. Interrupt 0

NOTE: The Interrupt Priority (IP) SFR is bit addressable.

Peripheral Data Registers

SBUF (Serial Data Buffer)

The Serial Buffer or SBUF register is used to hold the serial data while
transmission or reception.

TL0/TH0 (Timer 0 Low/High)


The Timer 0 consists of two SFRs: TL0 and TH0. The TL0 is the lower
byte and the TH0 is the higher byte and together they form a 16-bit
Timer0 Register.

TL1/TH1 (Timer 1 Low/High)

The TL1 and TH1 are the lower and higher bytes of the Timer 0.

You might also like