Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

8051 MICROCONTROLLER

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 12MHz.
In the following diagram, the system bus connects all the support devices to the CPU. The
system bus consists of an 8-bit data bus, a 16-bit address bus and bus control signals. All other
devices like program memory, ports, data memory, serial interface, interrupt control, timers, and
the CPU are all interfaced together through the system bus.

Features of 8051:
The main features of the 8051 microcontroller architecture include the following.
 8-bit CPU through two Registers A & B.
 4K Bytes – Internal ROM.
 128Bytes – Internal RAM from 00H to 7FH.
It is separated into 3-parts
1) 32 Bytes of 4-Register Banks (R0, R1, R2, R3).
2) 16 Bytes of Bit-addressable Memory.
3) 80 Bytes of General-purpose Memory.
 There exists Special Function Registers (SFRs) from address 80H to FFH.
These registers control various peripherals such as Serial Port, Timers, all I/O Ports, etc.
 Control Registers like PCON, SCON, TMOD, TCON, IE, and IP.
 It has 5-Interrupts (External-2 & Internal-3)
 Oscillator & CLK Circuit.
 16-bit Timers or Counters -2 like T0 & T1.
 16-bit Program Counter &16-bit DPTR (Data Pointer).
 It consists of four 8-bit I/O ports (P0, P1, P2, and P3).
 8-bit Stack Pointer (SP) & 8-bit PSW (Processor Status Word).
 Serial Data Tx & Rx for Full-Duplex Operation

8051 Microcontroller Architecture:


The 8051 microcontroller architecture is shown below.
1. Address Bus: 8051Microcontroller consists of a 16-bit address bus. It is used to carry the
address from the Central Processing Unit to Memory/ports.
2. Data Bus: 8051Microcontroller comprise of 8-bit data bus. It is used to carry the data.

Registers:
Registers are used to store data.
 The 8051microcontroller has 8-bit registers (D0 to D7).
 An accumulator is mainly used to execute arithmetic & logic instructions.
 Registers like B, R0 toR7 are used for storing instruction addresses & data.
 Data Pointers (DPTR) is a 16-bit register used to store the address of RAM.
 Program counter (PC) is a 16-bit register used to store the address of ROM.
a) It is used to store the address of the next instruction to be performed.
Memory
The memories of the 8051 microcontroller consists of a program memory and data memory.
 The instructions of the CPU are stored in the Program Memory. It is usually implemented
as Read-Only Memory or ROM.
 Data Memory is used for storing values of variables, temporary data, intermediate results,
and other data for the proper operation of the program.

Oscillator:
As the Microcontroller is a digital circuit, it needs a timer for its function.
Thus 8051Microcontroller consists of an on-chip oscillator.

I/O Ports:
To connect Peripherals, we need I/O (input/output) interfacing ports.
IC 8051 consists of 4 input/output ports to connect it with other peripherals.
Timers/Counters:
 In Intel 8051, there are two 16-bit timer registers. These registers are known as Timer-0
and Timer-1.
 The timer registers can be used in two modes. These modes are Timer mode and the
Counter mode.
 The only difference between these two modes is the source for incrementing the timer
registers.
Timer Mode:
In the timer mode, the internal machine cycles are counted. So this register is
incremented in each machine cycle. So when the clock frequency is 12MHz, then the timer
register is incremented in each millisecond.
Counter Mode:
 In the counter mode, the external events are counted.
 In this mode, the timer register is incremented for each 1 to 0 transition of the external
input pin. This type of transitions is treated as events.
 There is a register called TMOD Register. This register can be programmed to
configure these timers or counters.
 TMOD Register (Timer Mode Register):
TMOD (Timer Mode) is an 8-bit Register.
It is a SFR with address 89H.
GAT C/T M1 M0 GAT C/T M1 M0
E E

Timer-1 Timer-0

Gate (G): Start &Stop of the Timer/Counter


i.e. When G=1, Software way of Start/Stop.
When G=0, Hardware way of Start/Stop.
C/T: Counter/Timer. i.e. When C=0, It will act as Timer.
When C=1, It will act as Counter.
M1, M0: Mode selection Bits.
There are four different modes of the Timer or Counter.
S.N Mode Mode of Operation
o
1. Mode- 0 13-bit Timer

2. Mode -1 16-bit Timer

3. Mode -2 8-bit Auto Reload Timer

4. Mode -3 Split Timer Mode

 TCON Register (Timer Control Register):


It is an 8-bit Register and is bit addressable.
TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0

-The upper 4-bits store TR, TF bits of Timer-0,1. (TR=Timer Run bit, TF= Timer Flag bit).
-The Lower 4-bits store IE, IT bits of Timer-0,1.(IE= Interrupt Enable bit, IT= Interrupt Flag
bit).
-Timer Run bit(TR) is used to ON/OFF the Timer.
Ex: SETB TR0 or SETB TCON.4
CLR TR0 CLR TCON.4

Types of Interrupts:
The interrupts of the 8051 microcontrollers are:
 TF0 (Timer 0 Overflow Interrupt)
 TF1 (Timer 1 Overflow Interrupt)
 INT0 (External Hardware Interrupt)
 INT1 (External Hardware Interrupt)
 RI/TI (Serial Communication Interrupt)

PSW Register (Program status word/ flag register):


It is used to indicate the status of arithmetic, logic instructions such as zero carry bit, carry bit,
etc.
D7 D6 D5 D4 D3 D2 D1 D0
CY AC F0 RS1 RS0 O - P
V

 The PSW is an 8-bit register, where 6-bits are used.


 It is BIT ADDRESSIBLE and is used for Decision making.
 This register includes 8-flags where these flags are known as conditional flags. These
flags will perform instruction simply if the condition is satisfied.
 These conditional flags are overflow, parity, auxiliary carry & carry. The Program status
word registers bit numbers like 3 & 4 are used to alter the bank registers whereas 1 & 5
are not used but they can be used by the programmer for executing a specific task.

Applications of 8051 Microcontroller:

Some of the applications of 8051 is mainly used in daily life & industrial applications also some
of that applications are shown below
 Light sensing and controlling devices
 Temperature sensing and controlling devices
 Fire detections and safety devices
 Automobile applications
 Defense applications
Some industrial applications of micro controller and its applications
 Industrial instrumentation devices
 Process control devices
Some of 8051 microcontroller devices are used in measurement applications
 Voltmeter applications
 Measuring and revolving objects
 Current meter objects
 Hand held metering system.

Comparision between Microprocessor and Microcontroller:

S.No Microprocessor Microcontroller


1. Heart of the system. Heart of the embedded system.
2. Externally connected with input- input-output components are
output components. embedded.
3. The circuit may be large depending
The circuit is very small.
upon usage.
4. Not cost-effective. Cost-effective.
5. The total consumption of power is Total consumption of power is
high. less.
6. Power saving mode is not generally Power saving mode is generally
available. offered.
7. Used in MP3 players, washing
Used in PC.
machines, etc.
8. Memories like RAM and ROM are
Carries RAM, ROM, etc.
absent.
9. Runs at a very high speed. Runs at a relatively lower speed.
10. It is complex and costly. Simple and cheap.
11. Example: DEC Alpha 21164, IBM Example: Intel 8031/8051,
RS6000, etc PIC1x, etc.

S.No MICROCONTROLLER MICROPROCESSOR


1.

2. The microcontroller is the heart of an The microprocessor is the heart of a


embedded system. Computer system.
3. It has an external processor along with -It is just a processor.
internal memory and i/O components. -Memory and I/O components have to be
connected externally.
4. Since memory and I/0 are present Since memory and I/O have to be
internally, the circuit is small. connected externally, the circuit becomes
large.
5. Can be used in compact systems. used in complex systems .

6. The cost of the entire system is low. Cost of the entire system is high.

7. Since external components are low, total Due to external components, the entire
power consumption is less and can be power consumption is high. Hence it is
used with devices running on batteries. not suitable to run on batteries.

8. Most of the microcontrollers have power- Most microprocessors do not have


saving modes like idle mode and power- power-saving features.
saving mode. This helps to reduce power
consumption even further.

Since components are internal, most of


the operations are internal instruction,
hence speed is fast.

9. Microcontrollers have more number of Microprocessors have less number of


registers, hence the programs are easier to registers, hence more operations are
write. memory based

10. Microcontrollers are based on Harvard Microprocessors are based on the von
architecture where program memory and Neumann model/architecture where
Data memory are separate programs and data are stored in the same
memory module

11. Used mainly in washing machines, MP3 Mainly used in personal computers
players

You might also like