8051 Micrcontroller

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

8051 MICRCONTROLLER

Introduction:
A decade back the process and control operations were totally implemented by the
Microprocessors only. But now a days the situation is totally changed and it is occupied by
the new devices called Microcontroller. The development is so drastic that we can’t find any
electronic gadget without the use of a microcontroller. This microcontroller changed the
embedded system design so simple and advanced that the embedded market has become one
of the most sought after for not only entrepreneurs but for design engineers also.

What is a Microcontroller?

A single chip computer or A CPU with all the peripherals like RAM, ROM, I/O
Ports, Timers, ADCs etc... On the same chip. For ex: Motorola’s 6811, Intel’s 8051, Zilog’s
Z8 and PIC 16X etc…

MICROPROCESSORS & MICROCONTROLLERS:


Microprocessor:

A CPU built into a single VLSI chip is called a microprocessor. It is a general-purpose


device and additional external circuitry are added to make it a microcomputer. The
microprocessor contains arithmetic and logic unit (ALU), Instruction decoder and control
unit, Instruction register, Program counter (PC), clock circuit (internal or external), reset circuit
(internal or external) and registers. But the microprocessor has no on chip I/O Ports, Timers,
Memory etc.

For example, Intel 8085 is an 8-bit


microprocessor and Intel 8086/8088 a 16-bit
microprocessor. The block diagram of the
Microprocessor is shown in Fig.1

Fig (1)

M.L.N.Rao, Asst. Prof. in Electronics, St. Joseph’s Degree & PG College, Autonomous,
Affiliated Osmania University, Accredited by NAAC with Grade ‘A’. Page 1
MICROCONTROLLER:

A microcontroller is a highly integrated single chip, which consists of on chip CPU (Central
Processing Unit), RAM (Random Access Memory), EPROM/PROM/ROM (Erasable
Programmable Read Only Memory), I/O (input/output) – serial and parallel, timers, interrupt
controller. For example, Intel 8051 is 8-bit microcontroller and Intel 8096 is 16-bit
microcontroller. The block diagram of Microcontroller is shown in Fig.2.

Fig(2)

Distinguish between Microprocessor and Microcontroller


S.No Microprocessor Microcontroller
A microprocessor is a general A microcontroller is a dedicated chip which is
1 purpose device which is called a also called single chip computer.
CPU
A microprocessor do not contain A microcontroller includes RAM, ROM, serial
2 onchip I/OPorts, Timers, Memories and parallel interface, timers, interrupt
etc. circuitry (in addition to CPU) in a single chip.
Microprocessors are most Microcontrollers are used in small, minimum
3 commonly used as the CPU in component designs performing control-
microcomputer systems oriented applications.
Microprocessor instructions are Microcontroller instructions are both bit
4
mainly nibble or byte addressable addressable as well as byte addressable.
Microprocessor instruction sets are Microcontrollers have instruction sets catering
5 mainly intended for catering to large to the control of inputs and outputs.
volumes of data.

M.L.N.Rao, Asst. Prof. in Electronics, St. Joseph’s Degree & PG College, Autonomous,
Affiliated Osmania University, Accredited by NAAC with Grade ‘A’. Page 2
Microprocessor based system design Microcontroller based system design is rather
6
is complex and expensive simple and cost effective
The Instruction set of The instruction set of a Microcontroller is very
microprocessor is complex with simple with less number of instructions. For,
7
large number of instructions. ex: PIC microcontrollers have only 35
instructions.
A microprocessor has zero status A microcontroller has no zero flag.
8
flag

EVOLUTION OF MICROCONTROLLERS :

The first microcontroller TMS1000 was introduced by Texas Instrumentsin the year
1974. In the year 1976, Motorola designed a Microprocessor chip called 6801 which replaced
its earlier chip 6800 with certain add-on chips to make a computer. This paved the way for the
new revolution in the history of chip design and gave birth to a new entity called
“Microcontroller”. Later the Intel company produced its first Microcontroller 8048 with a
CPU and 1K bytes of EPROM, 64 Bytes of RAM an 8-Bit Timer and 27 I/O pins in 1976.
Then followed the most popular controller 8051 in the year 1980 with 4K bytes of ROM,128
Bytes of RAM , a serial port, two 16-bit Timers , and 32 I/O pins. The 8051 family has many
additions and improvements over the years and remains a most acclaimed tool for today’s
circuit designers. INTEL introduced a 16 bit microcontroller 8096 in the year 1982 . Later
INTEL introduced 80c196 series of 16-bit Microcontrollers for mainly industrial applications.
Microchip, another company has introduced an 8-bit Microcontroller PIC 16C64 in the year
1985.The 32-bit microcontrollers have been developed by IBM and Motorola. MPC 505 is a
32-bit RISC controller of Motorola. The 403 GA is a 32 -bit RISC embedded controller of
IBM.

In recent times ARM company (Advanced RISC machines) has developed and
introduced 32 bit controllers for high-end application devices like mobiles , Ipods etc...

TYPES OF MICROCONTROLLERS:

Microcontrollers can be classified on the basis of internal bus width, architecture,


memory and instruction set as 4-bit,8-bit,16-bit and 32-bit micrcontrollers.
4-bit Microcontrollers: These 4-bit microcontrollers are small size, minimum pin count and
low cost controllers which are widely used for low end applications like LED & LCD display
drivers ,portable battery chargers etc.. Their power consumption is also low. The popular 4-bit
controllers are Renasa M34501 which is a 20 pin DIP chip with 4kB of ROM, 256 Bytes of
RAM,2-Counters and 14 I/O Pins. Similarly ATAM862 series from ATMEL.

8-bit Microcontrollers : These are the most popular and widely used microcontrollers .About
55% of all CPUs sold in the world are 8-bit microcontrollers only.The 8-bit microcontroller
has 8-bitinternal bus and the ALU performs all the arithmetic and logical operations on a byte
instruction. The well known 8-bit microcontroller is 8051 which was designed by Intel in the

M.L.N.Rao, Asst. Prof. in Electronics, St. Joseph’s Degree & PG College, Autonomous,
Affiliated Osmania University, Accredited by NAAC with Grade ‘A’. Page 3
year 1980 for the use in embedded systems. Other 8-bit microcontrollers are Intel 8031/8052
and Motorola MC68HC11 and AVR Microcontrollers, Microchip’s PIC Microcontrollers
12C5XX ,16C5X and 16C505 etc...

16-bit Microcontrollers: When the microcontroller performs 16-bit arithmetic and logical
operations at an instruction, the microcontroller is said to be a 16-bit microcontroller. The
internal bus width of 16-bit microcontroller is of 16-bit. These microcontrollers are having
increased memory size and speed of operation when compared to 8-bit microcontrollers.These
are most suitable for programming in Highlevel languages like C or C++ .They find applications
in disk drivers,modems,printers,scanners and servomotor control. Examples of 16-bit
microcontrollers are Intel 8096 family and Motorola MC68HC12 and MC68332 families, The
performance and computing capability of 16 bit microcontrollers are enhanced with greater
precision as compared to the 8-bit microcontrollers.

32-Bit Microcontrollers: These microcontrollers used in highend applications like


Automative control, Communication networks,Robotics,Cell phones,GPRS & PDAs etc..For
EX:PIC32, ARM 7,ARM9 ,SHARP LH79520 ,ATMEL 32 (AVR), Texas Instrument’s –.
TMS320F2802x/2803x etc.are some of the popular 32-bit microcontrollers.

INTEL MCS 51 Family

On chip On chip
Microcontroller RAM program Timers/Counters Interrupts Serial ports
(Bytes) memory

8031 128 None 2 5 1

8032 256 None 3 6 1

8051 128 4K ROM 2 5 1

8052 256 8K ROM 3 6 1

8751 128 4K EPROM 2 5 1

8752 256 8K EPROM 3 6 1

ARCHITECTURE & BLOCK DIAGRAM OF 8051 MICROCONTROLLER

The 8051 microcontroller is a very popular 8-bit microcontroller introduced by Intel in


the year 1981 and it has become almost the academic standard now a days. The 8051 is based
on an 8-bit CISC core with Harvard architecture. Its 8-bit architecture is optimized for control
applications with extensive Boolean processing. It is available as a 40-pin DIP chip and works
at +5 Volts DC. The salient features of 8051 controller are given below.

M.L.N.Rao, Asst. Prof. in Electronics, St. Joseph’s Degree & PG College, Autonomous,
Affiliated Osmania University, Accredited by NAAC with Grade ‘A’. Page 4
Fig 3: Block diagram of 8051 Microcontroller

The architecture of the 8051 microcontroller can be understood from the block
diagram. It has Harward architecture with RISC (Reduced Instruction Set Computer) concept.
The block diagram of 8051 microcontroller is shown in Fig 3. below1.It consists of an 8-bit
ALU, one 8-bit PSW(Program Status Register), A and B registers, one 16-bit Program
counter , one 16-bit Data pointer register(DPTR),128 bytes of RAM and 4kB of ROM and four
parallel I/O ports each of 8-bit width.

SALIENT FEATURES : The salient features of 8051 Microcontroller are

i. Two 8-bit registers, A (accumulator) and B register.


ii. Two 16-bit registers, program counter and (data pointer) DPTR
iii. 8-bit flag register or Program Status Word (PSW)
iv. One 8-bit stack pointer
v. Inter ROM of 4 KB
vi. 128 bytes on chip data memory (RAM).
Internal RAM consists of
Four register banks, each containing eight registers
16-bytes of Bit Address
80 bytes of general purpose data memory.
vii. 8-bit data bus
viii. 16-bit address bus
ix. Four Parallel ports each of 8-bits (PORT0, PORT1,PORT2,PORT3) with a total of
32 I/O lines
x. Two -16 bit timers: T0 and T1
xi. Serial Data Reciever and Serial Data Transmitter.

M.L.N.Rao, Asst. Prof. in Electronics, St. Joseph’s Degree & PG College, Autonomous,
Affiliated Osmania University, Accredited by NAAC with Grade ‘A’. Page 5
xii. Control registers TCON, TMOD, SCON, PCON, IP and IE.
xiii. Five Interrupts (3 internal and 2 external).
xiv. Oscillator and Clock circuits.
.
Register A: The register A is an 8-bit register that is part of the ALU. This register is used to
store 8-bit data and to perform arithmetic and logical operations. The result of an operation is
strored in the register A. Register A is also identified as Accumulator. Its address is 0E0H.

Register B: The register B is an 8-bit register. It is used with the register A for multiplication
and division operations. In otherwords it holds the 1-byte of data during multiplication and
division. Register B holds high order byte of the result in the multiplication and remainder in
the division operation.

Program Counter (PC) : 8051 has a 16-bit program counter .The program counter always
points to the address of the next instruction to be executed. After execution of one instruction
the program counter is incremented to point to the address of the next instruction to be
executed. Since the PC is 16-bit width,8051 can access program addresses from 0000H to
FFFFH, a total of 64 kB of code.

Stack Pointer Register (SP): It is an 8-bit register which stores the address of the stack top.
i.e the Stack Pointer is used to indicate where the next value to be removed from the stack
should be taken from. When a value is pushed onto the stack, the 8051 first increments the
value of SP and then stores the value. Similarly when a value is popped off the stack, the 8051
returns the value from the memory location indicated by SP, and then decrements the value of
SP. Since the SP is only 8-bit wide it is incremented or decremented by two. SP is modified
directly by the 8051 by six instructions: PUSH, POP, ACALL, LCALL, RET, and RETI. It is
also used intrinsically whenever an interrupt is triggered.

Data Pointer (DPTR): As the name indicates, the Data Pointer register points to the data in
the memory. It is 16-bit register. It can be used as two 8-bit registers DPH and DPL. DPH
holds the high order address and DPL holds the low order address.

Program Status Word (PSW): The 8051 has a 8-bit PSW register which is alsoknown as
Flag register. In the 8-bit register only 6-bits are used by 8051.The two unused bits are user
definable bits. In the 6-bits four of them are conditional flags .They are Carry –CY, Auxiliary
Carry-AC, Parity-P, and Overflow-OV. These flag SET or RESET after an operation according
to data conditions of the result in the register A and other registers. As shown below figure
PSW.3 and PSW.4 are designed as RS0 and RS1 and are used to select the register banks.

M.L.N.Rao, Asst. Prof. in Electronics, St. Joseph’s Degree & PG College, Autonomous,
Affiliated Osmania University, Accredited by NAAC with Grade ‘A’. Page 6
CY: PSW.7 Carry Flag

AC: PSW.6 Auxiliary Carry Flag

F0: PSW.5 General Purpose flag bit

RS1: PSW.4 Register Bank selector bit 1

RS0: PSW.3 Register Bank selector bit 0

OV: SW.2 Over flow flag

----: PSW.1 User defined bit

P: SW.0 Parity Flag

Carry Flag (CY): If an operation results in a carry at D7(MSB) position, then the carry flag is
SET or else it is RESET. It can also be set or reset directly by instruction such as “SETB C”
and “CLR C”, where “SETB C” stands for “Set Bit Carry” and “CLR C” for “Clear Carry”.

Auxiliary Flag (AC): If there is a carry form D3 to D4 during addition operation, this bit is set
other wise it is reset.

Parity Flag (P): The parity flag reflects the number of 1’s in the accumulator. If the register A
contains an odd number of 1’s the parity flag is set. If A has an even number of 1’s, the parity
flag is reset.

Overflow Flag (OV): This flag is set whenever the result of a signed number operation is too
large, causing the high order bit to overflow in to the sign bit. The overflow flag is only used to
detect errors in signed aithemetic operations. If OV=1, the result is erraneous, If=0, the result is
valid.

The Register Bank Selection: The following table shows register bank selection.

M.L.N.Rao, Asst. Prof. in Electronics, St. Joseph’s Degree & PG College, Autonomous,
Affiliated Osmania University, Accredited by NAAC with Grade ‘A’. Page 7

You might also like