8051 Microcontroller
8051 Microcontroller
CERTIFICATE
This is to certify that the Micro project report entitled
Course MAA
Submitted by :-
Comunication Engineering.
What is an 8051 Microcontroller?
The microcontroller like 8051 was designed in the year 1981 by Intel. The
microcontroller is one kind of integrated circuit that includes 40-pins with
dual inline package or DIP, RAM-128 bytes, ROM-4kb & 16-bit timers–2.
Based on the requirement, it includes addressable & programmable 4 –
parallel 8-bit ports. In the 8051 microcontroller architecture, the system bus
plays a key role to connect all the devices to the central processing unit.
This bus includes a data bus- an 8-bit, an address bus-16-bit & bus control
signals. Other devices can also be interfaced throughout the system bus
like ports, memory, interrupt control, serial interface, the CPU, timers.
There are two buses in 8051 Microcontroller one for the program and
another for data. As a result, it has two storage rooms for both programs
and data of 64K by 8 sizes. The microcontroller comprises of 8-bit
accumulator & an 8-bit processing unit. It also consists of 8 bit B register as
majorly functioning blocks and 8051 microcontroller programming is done
with embedded C language using Keil software. It also has several other 8 bit
and 16-bit registers.
For internal functioning & processing Microcontroller, 8051 comes with
integrated built-in RAM. This is prime memory and is employed for storing
temporary data. It is an unpredictable memory i.e. its data can get be lost
when the power supply to the Microcontroller switched OFF. This
microcontroller is very simple to use, affordable less computing power,
simple architecture & instruction set.
Features
The main features of the 8051 microcontroller architecture include the
following.
8-bit CPU through two Registers A & B.
8K Bytes – Internal ROM and it is a flash memory that supports while
programming the system.
256 Bytes – Internal RAM where the first RAM with 128 Bytes from 00H
to 7FH is once more separated into four banks through 8 registers in
every bank, addressable registers -16 bit & general-purpose registers –
80.
The remaining 128 bytes of the RAM from 80H to FFH include Special
Function Registers (SFRs). These registers control various peripherals
such as Serial Port, Timers, all I/O Ports, etc.
Interrupts like External-2 & Internal-3
Oscillator & CLK Circuit.
Control Registers like PCON, SCON, TMOD, TCON, IE, and IP.
16-bit Timers or Counters -2 like T0 & T1.
Program Counter – 16 bit & DPRT (Data Pointer).
I/O Pins – 32 which are arranged like four ports such as P0, P1, P2 &
P3.
Stack Pointer (SP) – 8bit & PSW (Processor Status Word).
Serial Data Tx & Rx for Full-Duplex Operation
As you may be familiar that the Central Processor Unit or CPU is the mind of
any processing machine. It scrutinizes and manages all processes that are
carried out in the Microcontroller. The user has no power over the functioning
of the CPU. It interprets the program printed in storage space (ROM) and
carries out all of them and does the projected duty. CPU manages different
types of registers in the 8051 microcontrollers.
Interrupts:
As the heading put forward, Interrupt is a subroutine call that reads the
Microcontroller’s key function or job and helps it to perform some other
program which is extra important then. The characteristic of 8051 Interrupt is
extremely constructive as it aids in emergency cases. Interrupts provide us
a method to postpone or delay the current process, carry out a sub-routine
task and then all over again restart standard program implementation.
The Micro-controller 8051 can be assembled in such a manner that it
momentarily stops or break the core program at the happening of the
interrupt. When the sub-routine task is finished then the implementation of
the core program initiates automatically as usual. There are 5 interrupt
supplies in the 8051 Microcontroller, two out of five are peripheral interrupts,
two are timer interrupts and one is serial port interrupt.
Memory
The microcontroller also needs memory to amass data or operands for the
short term. The storage space which is employed to momentarily data
storage for functioning is acknowledged as Data Memory and we employ
Random Access Memory or RAM for this principle reason. Microcontroller
8051 contains code memory or program memory 4K so which has 4KB Rom
and it also comprises data memory (RAM) of 128 bytes.
Bus
Fundamentally Bus is a group of wires which function as a communication
canal or means for the transfer of Data. These buses comprise 8, 16, or more
cables. As a result, a bus can bear 8 bits, 16 bits altogether. There are two
types of buses:
1. Address Bus: Microcontroller 8051 consists of a 16-bit address bus. It is
brought into play to address memory positions. It is also utilized to transmit
the address from the Central Processing Unit to Memory.
2. Data Bus: Microcontroller 8051 comprise of 8 bits data bus. It is employed
to cart data.
Oscillator
As we all make out the Microcontroller is a digital circuit piece of equipment,
thus it needs a timer for its function. For this function, Microcontroller 8051
consists of an on-chip oscillator that toils as a time source for the CPU
(Central Processing Unit). As the productivity thumps of the oscillator are
steady as a result, it facilitates harmonized employment of all pieces of the
8051 Microcontroller. Input/Output Port: As we are acquainted with that
Microcontroller is employed in embedded systems to manage the functions
of devices.
The main function of a timer is to make a delay otherwise time gap among
two events. This microcontroller includes two timers where each timer is
16-bit where the system can generate two delays concurrently to produce
the suitable delay. Generally, every microcontroller uses hardware delays
where a physical device can be used through the processor to generate the
particular delay which is called a timer.
The delay can be generated through the timer based on the requirement of
the processor & transmits the signal to the processor whenever the
particular delay gets generated.
The microcontroller also includes a program counter, data pointer, stack &
stack pointer, instruction registers including latches, temporary registers &
buffers for the I/O ports.
Registers
To make the data process better than 8-bit, then it must be separated into
eight different bit parts. It includes several registers however general-
purpose type registers are frequently available to programmers. There are
classified into two types like General purpose & Special purpose. So, most
of the general-purpose registers are listed below.
This microcontroller includes simply one 8 bit data type where the size of
each register is 8-bit. If the data is better than 8-bit, then is the programmer
accountable to separate data into 8-bit parts before processing. For
assemblers, the most widely used data directive is the DB directive in
assembly language.
PSW Register
The term PSW stands for Program status word and it is one kind of register
in the microcontroller. It is also called a flag register, used to demonstrate
the position of arithmetic logic instructions such as zero carry bit, carry bit,
etc. PSW or flag register is an 8-bit register where 6-bits are used. 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.
Register Banks
For stacks & register banks, Ram with 32 Bytes is used and these are
separated in four types of banks. So, every back includes 8-registers which
range from R0 to R7. Here, R0 & R7 denotes the locations of RAM like
zero location and seventh location. The second bank register begins from
location 8 & ends 05H. The third bank register begins from 10H &
completed at the 17H location. The final bank can be placed among the
18H-1FH.
Stack
The part of RAM like Stack is mainly used through the processor for data
storage otherwise address momentarily. In a microprocessor, it is a very
significant part because there are extremely restricted numbers of registers
for storing addresses and data.
In the 8051 microcontrollers, the stack is 8-bit wide and it can hold data
from 00 – FFH. The stack pointer can be used through the CPU to allow
the stack. This microcontroller includes an 8-bit stack pointer that means it
can allow values from 00H to FFH. Once it is activated, then the stack
pointer includes the 07 value.
Organization of Memory
Addressing Modes
Register
Register indirect
Immediate
Indexed
Direct