SlideShare a Scribd company logo
UNIT IV MICROCONTROLLER
• Architecture of 8051 – Special Function
Registers(SFRs) - I/O Pins Ports and Circuits -
Instruction set - Addressing modes - Assembly
language programming.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
1
INTRODUCTION
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
2
• Microcontrollers as the name suggests, are small
controllers. They are like single chip computers
that often embedded into other systems to
function as processing / controlling unit.
• Microcontrollers are single - chip
Microcomputers.
• A microcontroller has a CPU (a microprocessor) in
addition to a fixed amount of RAM, ROM and I/O
parts and a timer on a single chip.
• The fixed amount of on - chip RAM, ROM, timer
and I/O parts in microcontrollers makes them
ideal for many applications in which cost and
space are less.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
3
• The word microprocessor means a CPU only.
• The functional blocks like memory and other
peripherals are to be connected externally to
a microprocessor chip to make a complete
microcomputer.
• But the microcontrollers are having all these
facilities in a single chip.
• The examples for microcontrollers are Intel
MCS - 51 (8051), Atmel 89 C XX, Motorola
68HC X 11XX, PIC family by microchip (PIC
16C64X).
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
4
Differences between microprocessors
and microcontrollers
• Microprocessors are intended to be general -
purpose digital computers whereas
microcontrollers are intended to be special -
purpose digital controllers.
• Microprocessors contain a CPU, memory
addressing circuits and interrupt handling
circuits. Microcontrollers have these features
as well as timers, parallel and serial I/O and
internal RAM and ROM.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
5
Features of microcontrollers
• High integration of functionality : Microcontrollers are
called as single chip computers because they have on -
chip memory and I/O circuitry and other circuitries that
enable them to function as small stand - alone
computers without other supporting circuitry.
• Field programmability, flexibility : Microcontrollers
often use EPROM or E2PROM as their storage device to
allow field programmability so they are flexible to use.
Once the program is tested to be correct then large
quantities of microcontrollers can be programmed to
be used in embedded systems.
• Easy to use.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
6
Advantages of microcontrollers
• The overall system cost is low, as the peripherals
are integrated in a single chip.
• The product is of small size as compared to the
microprocessor based system and is very handy.
• The system is more reliable.
• The system is easy to troubleshoot and maintain.
• If required additional RAM, ROM and I/O ports
may be interfaced.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
7
Intel 8051 microcontroller
• The 8 bit microcontroller 8051 family has
numbers ranging from 8031 to 8751 and are
available in N-channel Metal Oxide
Semiconductor (NMOS) and Complementary
MOS [CMOS] construction in a variety of package
types.
• The intel corporation introduced an 8 bit
microcontroller 8051 in 1981.
• This microcontroller had 128 bytes of RAM, 4k
bytes of on - chip ROM, two timers, one serial
port and 4 eight bit ports all on a single chip.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
8
Comparison between 8051 and 8031
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
9
ARCHITECTURE OF 8051
The features of the 8051 are :
• 8 bit CPU with registers A (the accumulator) and B
• 16 bit Program Counter (PC) and Data Pointer (DPTR)
• 8 bit Program Status Word (PSW)
• 64K Program memory address space
• 64K Data memory address space
• 128 bytes of on chip data memory
• 32 I/O pins for four 8 bit ports : Port 0, Port 1, Port 2,
Port 3
• Two 16 bit timers / counters : T0 and T1
• Full duplex UART : SBUF
• Two external and three internal interrupt sources
• On chip clock oscillator.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
10
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
11
• The intel 8051 contains two separate buses for
both program and data. So, it has two distinctive
memory spaces of 64K x 8 size for both program
and data.
• It is based on an 8 bit central processing unit with
an 8 bit accumulator and another 8 bit B register
as main processing blocks.
• Other portions of the architecture include few 8
bit and 16 bit registers and 8 bit memory
locations.
• It has some amount of data RAM built in the
device for internal processing.
• 8051 is supported with on-chip peripheral
functions like I/O ports, Timers / Counters, serial
communication port.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
12
Central processing unit
• The CPU is the brain of the microcontrollers reading user’s
programs and executing the expected task as per
instructions stored there in.
• It’s primary elements are an Accumulator (ACC), B register
(B), Stack pointer (SP), Program counter (PC), Program
status word (PSW), Data pointer register (DPTR) and few
more 8 bit registers.
Accumulator
• The accumulator performs arithmetic and logic functions
on 8 bit input variables. Arithmetic operations include
basic addition, subtraction, multiplication and division.
Logical operations are AND, OR XOR as well as rotate,
clear, complement.
• accumulator is responsible for conditional branching
decisions and provides a temporary place in a data
transfer operations within the device.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
13
B Register
• B register is used in multiply and divide
operations. During execution B register either
keeps one of the two inputs and then retains a
portion of the result. For other instructions it is
used as general purpose register.
Stack Pointer
• Stack Pointer (SP) is an 8 bit register. This pointer
keeps track of memory space where the
important register information are stored when
the program flow gets into executing a
subroutine.
• The SP is automatically incremented or
decremented for all PUSH or POP instructions
and for all subroutine calls and returns.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
14
Program Counter
• The Program Counter (PC) is the 16 bit register
giving address of next instruction to be
executed during program execution and it
always points to the program memory space.
Data Pointer Register
• The Data Pointer Register (DPTR) is the 16 bit
addressing register that can be used to fetch
any 8 bit data from the data memory space.
When it is not being used for this purpose, it
can be used as two eight bit registers, DPH and
DPL.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
15
Program Status Word
• The Program Status Word (PSW) keeps the
current status of the arithmetic and logic
operations in different bits. The 8051 has four
math flags that respond automatically to the
outcomes of arithmetic and logic operations and
3 general purpose user flags that can be set 1 or
cleared to 0 by the programmer as desired.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
16
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
17
Input / Output Ports
• 8051 has 32 I/O pins configured as 4 eight bit parallel ports
(P0, P1, P2 and P3).
• Each pin can be used as an input or as an output under the
software control. These I/O pins can be accessed directly by
memory instructions during program execution to get
require flexibility.
• These port lines can be operated in different modes and all
the pins can be made to do many different tasks apart from
their regular I/O function executions.
• Any instruction that accesses external program memory
will output the higher order byte (A8 - A15) on Port 2
during read cycle.
• Port 1 and Port 3 are available for standard I/O functions.
• Port 3 pins has the additional functions : 2 external
interrupt lines, 2 counter inputs, 2 serial port data lines and
2 timing control storbe lines.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
18
Timers / Counters
• 8051 has two 16 bit Timers / Counters, T0 and
T1 capable of working in different modes.
Each consists of a ‘HIGH’ byte and a ‘LOW’
byte which can be accessed under software.
• There is a mode control register (TMOD) and a
control register (TCON) to configure these
timers / counters in number of ways.
• These timers are used to measure time
intervals, determine pulse widths or initiate
events with one microsecond resolution upto
a maximum 65ms. Use software to get longer
delays.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
19
Serial Port
• The 8051 has a high speed full duplex serial port which is
software configurable in 4 basic modes :
• Shift register mode
• Standard UART mode
• Multiprocessor mode
• 9 bit UART mode.
• Full duplex means the data can go both ways at the same time.
Interrupts
• The 8051 has five interrupt sources : One from the serial port
(RI / TI) when a transmission or reception operation is
executed.
• two from the timers (TF0, TF1) when overflow occurs and two
come from the two input pins INT0, INT1. Each interrupt may
be independently enabled or disabled to allow polling on same
sources and each may be classified as high or low priority.
• These operations are selected by Interrupt Enable (IE) and
Interrupt Priority (IP) registers.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
20
Oscillator and Clock
• The 8051 generates the clock pulses by which all
internal operations are synchronized.
• Pins XTAL 1 and XTAL 2 are provided for
connecting a resonant network to form an
oscillator. A quartz crystal is used for oscillator.
• The crystal frequency is the basic internal clock
frequency of the microcontroller
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
21
MEMORY ORGANIZATION
• The 8051 architecture provide both on chip
memory expansion capabilities. It supports
several distinctive ‘physical’ address spaces,
functionally separated at the hardware level by
different addressing mechanisms, read and write
controls signals or both :
• On chip Program Memory
• On chip Data Memory
• Off chip Program Memory
• Off chip Data Memory
• On chip Special Function Registers
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
22
• The Program Memory area (EPROM incase of
external memory or Flash / EPROM incase of
internal one) is extremely large and never lose
information when the power is removed.
• On chip data memory is smaller and therefore
quicker than Program Memory and it goes into a
random state when power is removed. On chip
RAM is used for variables which are calculated
when the program is executed.
• Different addressing mechanisms are used to
access these different memory spaces and this
greatly contributes to microcomputer’s operating
efficiency.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
23
Total internal Data Memory is divided into three blocks :
Lower 128 bytes
Higher 128 bytes.
Special Function Register Space.
Higher 128 bytes are available only in 8032 / 8052 devices.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
24
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
25
SPECIAL FUNCTION REGISTERS (SFRS)
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
26
Physical view
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
27
PINOUTS OF 8051
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
28
Signals of 8051
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
29
• The remaining 8 pins are VCC, GND, XTAL1, XTAL2, RST,
EA , PSEN and ALE / PROG and ALE / . The functions
of these pins are described as follows :
1. Vcc
• Pin 40 of 8051 provides supply voltage to the chip
from the +5V voltage source.
2. GND
• Pin 20 is the ground for the chip,
3. RST
• Pin 9 is the RESET pin. This is referred as a power-on
reset. When activating (high pulse) this pin the
microcontroller will reset and all values in the
registers to be lost. Table 4.4 gives the reset values of
some registers.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
30
4.EA (External Access)
• This input pin is connected to either Vcc or GND. The 8051
family members has ON – CHIP ROM to store programs. EA
pin (31) is connected to Vcc in 8051 Here, EA pin is
connected to GND to indicate that the code is stored
externally.
5. PSEN (Program Store Enable)
• This is an output pin and pin number is 29. In an 8051 -
based system in which an external ROM holds the program
code, this pin is connected to the OE pin of the ROM.
6. ALE (Addres Latch Enable)
This is an output pin (30) and is active high. When
connecting an 8051 to external memory, port 0 provides
both address and data. In other words, 8051 multiplexes
address and data through port 0 to save pins. If ALE = 0,
port 0 provides data (D0 - D7). If ALE=1, it has address (A0-
A7).
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
31
7. XTAL 1 and XTAL 2
• The 8051 has an on - chip oscillator and it requires
an external clock to return it. The quartz crystal
oscillator (12 MHz / 20 MHz) is connected to XTAL 1
(pin 19) and XTAL 2 (pin 18) with two 30pF capacitors
as shown in Fig.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
32
I/O PORTS
Port 0 (P0.0 - 0.7)
• Port 0 is used for both address and data bus (AD0 – AD7).
When the microcontroller chip is connected to an external
memory, Port 0 provides both address and data. ALE pin
indicates if Port 0 has address or data.
• When ALE = 0, Port 0 provides data (D0 – D7)
• = 1, Port 0 provides address (A0 – A7)
• ALE is used for demultiplexing address and data with the
help of a latch.
Port 1 (P1.0 - P1.7)
• Port 1 pins are used as input or output. To make port 1 as
an input port, write 1 to all its 8 bits. To make port 1 as
output port, write 0 to all its 8 bits. Thus port 1 pins have
no dual functions.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
33
Port 2 (P2.0 - P2.7)
• Port 2 pins are used as input / output pins similar in operation to port 1.
The alternate use of port 2 is to supply a high order address byte (A8 –
A15) when the microcontroller is connected to external memory.
Port 3 (P3.0 - P3.7)
• Port 3 pins are used as input or output. Port 3 has the additional
functions
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
34
ADDRESSING MODES
• The addressing modes are the ways of accessing data in
register or in memory or be provided as an immediate
value. The 8051 mnemonics are written with the
destination address named first, followed by the source
address.
The following addressing modes are used to access data :
• Immediate addressing mode
• Register addressing mode
• Direct addressing mode
• Register indirect addressing mode
• Indexed addressing mode.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
35
Immediate Addressing Mode
• When a source operand is a constant rather than a
variable, then the constant can be embedded into the
instruction itself.
• This kind of instructions take two bytes and first one
specifies the opcode and second byte gives the required
constant.
• The operand comes immediately after the opcode. The
mnemonic for immediate data is the pound sign (#).
• This addressing mode can be used to load information into
any of the registers including DPTR register.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
36
Register Addressing Mode
• Register addressing accesses the eight working
registers (R0 - R7) of the selected register bank. The
least significant three bits of the instruction opcode
indicate which register is to be used for the operation.
• One of the four banks of registers is to be predefined in
the PSW before using register addressing instruction.
ACC, B and DPTR can also be addressed in this mode.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
37
Direct Addressing Mode
• In the direct addressing mode, all 128 bytes of
internal RAM and the SFRs may be addressed directly
using the single - byte address assigned to each RAM
location and each SFR.
• Internal RAM uses address from 00H to 7FH to
address each byte. The SFR addresses exist from 80H
to FFH.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
38
• Register Indirect Addressing Mode
• In this mode a register is used as a pointer to the data. If
the data is inside the CPU, only registers R0 and R1 are used
for this purpose. When R0 and R1 hold the addresses of
RAM locations, they must be preceded by the “@” sign.
Indexed Addressing Mode
Only the program memory can be accessed by this mode. This mode is intended
for reading lookup tables in the program memory. A 16 bit base register (DPTR or
PC) points to the base of the lookup tables and accumulator carries the constant
indicating table entry number. The address of the exact location of the table is
formed by adding the accumulator data to the base pointer.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
39
INSTRUCTION SET
• An instruction is a command given to the computer to
perform a specified operation on given data. The
instruction set is the collection of instructions that the
microcontroller is designed to execute.
• These instructions have been classified into the following
groups.
Data transfer group
Arithmetic group
Logical group
Boolean variable manipulation
Program branching
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
40
Data Transfer Instructions
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
41
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
42
Note :
• Rn = Any of the eight registers, R0 to R7, in the
selected bank.
• Ri = Either of the pointing registers R0 to R1 in the
selected bank.
• addr = Address of the internal RAM from 00H to
FFH.
• L = Least significant nibble.
• ^ = External memory location.
• ( ) = Contents of the location inside the
parentheses.
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
43
Arithmetic Instructions
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
44
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
45
Logical Instructions
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
46
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
47
Boolean Variable Manipulation
Instructions
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
48
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
49
Program Branching Instructions
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
50
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
51
PROGRAMS
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
52
8 bit subtraction
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
53
8 Bit Multiplication
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
54
8 Bit Division
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
55
5/25/2021
Kongunadu College of Engineering and
Technology(Autonomous)
56

More Related Content

What's hot

Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
Aarav Soni
 
8255 presentaion.ppt
8255 presentaion.ppt8255 presentaion.ppt
8255 presentaion.ppt
kamlesh deshmukh
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adcPRADEEP
 
I/O port programming in 8051
I/O port programming in 8051I/O port programming in 8051
I/O port programming in 8051
ssuser3a47cb
 
Question paper with solution the 8051 microcontroller based embedded systems...
Question paper with solution  the 8051 microcontroller based embedded systems...Question paper with solution  the 8051 microcontroller based embedded systems...
Question paper with solution the 8051 microcontroller based embedded systems...
manishpatel_79
 
LCD Interacing with 8051
LCD Interacing with 8051LCD Interacing with 8051
LCD Interacing with 8051
Sudhanshu Janwadkar
 
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller
abhikalmegh
 
ARM CORTEX M3 PPT
ARM CORTEX M3 PPTARM CORTEX M3 PPT
ARM CORTEX M3 PPT
Gaurav Verma
 
Microprocessor 8085 complete
Microprocessor 8085 completeMicroprocessor 8085 complete
Microprocessor 8085 complete
Shubham Singh
 
Memory organization of 8051
Memory organization of 8051Memory organization of 8051
Memory organization of 8051Muthu Manickam
 
8255 PPI
8255 PPI8255 PPI
8255 PPI
deval patel
 
Communication protocols - Embedded Systems
Communication protocols - Embedded SystemsCommunication protocols - Embedded Systems
Communication protocols - Embedded Systems
Emertxe Information Technologies Pvt Ltd
 
Module 1 8086
Module 1 8086Module 1 8086
Module 1 8086
Deepak John
 
Unit 5
Unit 5Unit 5
Unit 5
tamilnesaner
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
 8051 MICROCONTROLLER ARCHITECTURE.pptx 8051 MICROCONTROLLER ARCHITECTURE.pptx
8051 MICROCONTROLLER ARCHITECTURE.pptx
MemonaMemon1
 
Microcontroller 8051 and its interfacing
Microcontroller 8051 and its interfacingMicrocontroller 8051 and its interfacing
Microcontroller 8051 and its interfacing
Ankur Mahajan
 
8155 PPI
8155 PPI8155 PPI
8155 PPI
ShivamSood22
 
8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER
THANDAIAH PRABU
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
Poojith Chowdhary
 

What's hot (20)

Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
 
8255 presentaion.ppt
8255 presentaion.ppt8255 presentaion.ppt
8255 presentaion.ppt
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adc
 
I/O port programming in 8051
I/O port programming in 8051I/O port programming in 8051
I/O port programming in 8051
 
8255
82558255
8255
 
Question paper with solution the 8051 microcontroller based embedded systems...
Question paper with solution  the 8051 microcontroller based embedded systems...Question paper with solution  the 8051 microcontroller based embedded systems...
Question paper with solution the 8051 microcontroller based embedded systems...
 
LCD Interacing with 8051
LCD Interacing with 8051LCD Interacing with 8051
LCD Interacing with 8051
 
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller
 
ARM CORTEX M3 PPT
ARM CORTEX M3 PPTARM CORTEX M3 PPT
ARM CORTEX M3 PPT
 
Microprocessor 8085 complete
Microprocessor 8085 completeMicroprocessor 8085 complete
Microprocessor 8085 complete
 
Memory organization of 8051
Memory organization of 8051Memory organization of 8051
Memory organization of 8051
 
8255 PPI
8255 PPI8255 PPI
8255 PPI
 
Communication protocols - Embedded Systems
Communication protocols - Embedded SystemsCommunication protocols - Embedded Systems
Communication protocols - Embedded Systems
 
Module 1 8086
Module 1 8086Module 1 8086
Module 1 8086
 
Unit 5
Unit 5Unit 5
Unit 5
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
 8051 MICROCONTROLLER ARCHITECTURE.pptx 8051 MICROCONTROLLER ARCHITECTURE.pptx
8051 MICROCONTROLLER ARCHITECTURE.pptx
 
Microcontroller 8051 and its interfacing
Microcontroller 8051 and its interfacingMicrocontroller 8051 and its interfacing
Microcontroller 8051 and its interfacing
 
8155 PPI
8155 PPI8155 PPI
8155 PPI
 
8051 MICROCONTROLLER
8051 MICROCONTROLLER 8051 MICROCONTROLLER
8051 MICROCONTROLLER
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
 

Similar to Unit 4

UNIT 4 8051Microcontroller.pptx
UNIT 4 8051Microcontroller.pptxUNIT 4 8051Microcontroller.pptx
UNIT 4 8051Microcontroller.pptx
Gowrishankar C
 
8051 slide
8051 slide8051 slide
8051 slide
VenugopalaRaoAS
 
20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notesRavali Sunki
 
8051 dev board guide
8051 dev board guide8051 dev board guide
8051 dev board guide
Murali Krishna
 
UNIT 4.pptx
UNIT 4.pptxUNIT 4.pptx
UNIT 4.pptx
BASKARS53
 
8051 microcontroller Microcontroller _2024.pptx
8051 microcontroller Microcontroller _2024.pptx8051 microcontroller Microcontroller _2024.pptx
8051 microcontroller Microcontroller _2024.pptx
rohithansaliya2
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
nitugatkal
 
Microcontroller Electronics Engineering Sem 4MODULE 1.pptx
Microcontroller Electronics Engineering Sem 4MODULE 1.pptxMicrocontroller Electronics Engineering Sem 4MODULE 1.pptx
Microcontroller Electronics Engineering Sem 4MODULE 1.pptx
itsmeaswin03
 
20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes
Manikanteswar Madala
 
Download
DownloadDownload
Downloadjaihooo
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
Jai Sudhan
 
Embeded system
Embeded systemEmbeded system
Embeded system
SUneel Gupta
 
Embedded training report(mcs 51)
Embedded training report(mcs 51)Embedded training report(mcs 51)
Embedded training report(mcs 51)Gurwinder Singh
 
micro controllers 1.ppt
micro controllers 1.pptmicro controllers 1.ppt
micro controllers 1.ppt
siminkhan
 
8051 Architecture
8051 Architecture8051 Architecture
8051 Architecture
ShinuMMAEI
 
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentsEMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
eceprinter6
 
8051 microcontroller and embedded training (sahil gupta 9068557926)
8051 microcontroller and embedded training  (sahil gupta   9068557926)8051 microcontroller and embedded training  (sahil gupta   9068557926)
8051 microcontroller and embedded training (sahil gupta 9068557926)
Sahil Gupta
 
Solution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systemsSolution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systems
manishpatel_79
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
MeghdeepSingh
 
Module 1.pdf
Module 1.pdfModule 1.pdf
Module 1.pdf
VenugopalaRaoAS
 

Similar to Unit 4 (20)

UNIT 4 8051Microcontroller.pptx
UNIT 4 8051Microcontroller.pptxUNIT 4 8051Microcontroller.pptx
UNIT 4 8051Microcontroller.pptx
 
8051 slide
8051 slide8051 slide
8051 slide
 
20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes
 
8051 dev board guide
8051 dev board guide8051 dev board guide
8051 dev board guide
 
UNIT 4.pptx
UNIT 4.pptxUNIT 4.pptx
UNIT 4.pptx
 
8051 microcontroller Microcontroller _2024.pptx
8051 microcontroller Microcontroller _2024.pptx8051 microcontroller Microcontroller _2024.pptx
8051 microcontroller Microcontroller _2024.pptx
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
Microcontroller Electronics Engineering Sem 4MODULE 1.pptx
Microcontroller Electronics Engineering Sem 4MODULE 1.pptxMicrocontroller Electronics Engineering Sem 4MODULE 1.pptx
Microcontroller Electronics Engineering Sem 4MODULE 1.pptx
 
20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes
 
Download
DownloadDownload
Download
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
 
Embeded system
Embeded systemEmbeded system
Embeded system
 
Embedded training report(mcs 51)
Embedded training report(mcs 51)Embedded training report(mcs 51)
Embedded training report(mcs 51)
 
micro controllers 1.ppt
micro controllers 1.pptmicro controllers 1.ppt
micro controllers 1.ppt
 
8051 Architecture
8051 Architecture8051 Architecture
8051 Architecture
 
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentsEMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
 
8051 microcontroller and embedded training (sahil gupta 9068557926)
8051 microcontroller and embedded training  (sahil gupta   9068557926)8051 microcontroller and embedded training  (sahil gupta   9068557926)
8051 microcontroller and embedded training (sahil gupta 9068557926)
 
Solution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systemsSolution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systems
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
 
Module 1.pdf
Module 1.pdfModule 1.pdf
Module 1.pdf
 

More from tamilnesaner

BEEME UNIT V.ppt
BEEME UNIT V.pptBEEME UNIT V.ppt
BEEME UNIT V.ppt
tamilnesaner
 
Unit 2 mpmc
Unit 2 mpmcUnit 2 mpmc
Unit 2 mpmc
tamilnesaner
 
Unit 1 MPMC
Unit 1 MPMCUnit 1 MPMC
Unit 1 MPMC
tamilnesaner
 
Smart meter
Smart meterSmart meter
Smart meter
tamilnesaner
 
Lcr meter
Lcr meterLcr meter
Lcr meter
tamilnesaner
 
Tachometer and clamp meter
Tachometer and clamp meterTachometer and clamp meter
Tachometer and clamp meter
tamilnesaner
 
Unit 5
Unit 5Unit 5
Unit 5
tamilnesaner
 
Unit 4
Unit 4Unit 4
Unit 4
tamilnesaner
 
Unit 3
Unit 3Unit 3
Unit 3
tamilnesaner
 
Unit 2
Unit 2Unit 2
Unit 2
tamilnesaner
 
Unit 1
Unit 1Unit 1
Unit 1
tamilnesaner
 
Unit 1 static and dynamic
Unit 1 static and dynamicUnit 1 static and dynamic
Unit 1 static and dynamic
tamilnesaner
 
Three phase voltage source inverter
Three phase voltage source inverterThree phase voltage source inverter
Three phase voltage source inverter
tamilnesaner
 

More from tamilnesaner (13)

BEEME UNIT V.ppt
BEEME UNIT V.pptBEEME UNIT V.ppt
BEEME UNIT V.ppt
 
Unit 2 mpmc
Unit 2 mpmcUnit 2 mpmc
Unit 2 mpmc
 
Unit 1 MPMC
Unit 1 MPMCUnit 1 MPMC
Unit 1 MPMC
 
Smart meter
Smart meterSmart meter
Smart meter
 
Lcr meter
Lcr meterLcr meter
Lcr meter
 
Tachometer and clamp meter
Tachometer and clamp meterTachometer and clamp meter
Tachometer and clamp meter
 
Unit 5
Unit 5Unit 5
Unit 5
 
Unit 4
Unit 4Unit 4
Unit 4
 
Unit 3
Unit 3Unit 3
Unit 3
 
Unit 2
Unit 2Unit 2
Unit 2
 
Unit 1
Unit 1Unit 1
Unit 1
 
Unit 1 static and dynamic
Unit 1 static and dynamicUnit 1 static and dynamic
Unit 1 static and dynamic
 
Three phase voltage source inverter
Three phase voltage source inverterThree phase voltage source inverter
Three phase voltage source inverter
 

Recently uploaded

LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 

Recently uploaded (20)

LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 

Unit 4

  • 1. UNIT IV MICROCONTROLLER • Architecture of 8051 – Special Function Registers(SFRs) - I/O Pins Ports and Circuits - Instruction set - Addressing modes - Assembly language programming. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 1
  • 2. INTRODUCTION 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 2
  • 3. • Microcontrollers as the name suggests, are small controllers. They are like single chip computers that often embedded into other systems to function as processing / controlling unit. • Microcontrollers are single - chip Microcomputers. • A microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM, ROM and I/O parts and a timer on a single chip. • The fixed amount of on - chip RAM, ROM, timer and I/O parts in microcontrollers makes them ideal for many applications in which cost and space are less. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 3
  • 4. • The word microprocessor means a CPU only. • The functional blocks like memory and other peripherals are to be connected externally to a microprocessor chip to make a complete microcomputer. • But the microcontrollers are having all these facilities in a single chip. • The examples for microcontrollers are Intel MCS - 51 (8051), Atmel 89 C XX, Motorola 68HC X 11XX, PIC family by microchip (PIC 16C64X). 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 4
  • 5. Differences between microprocessors and microcontrollers • Microprocessors are intended to be general - purpose digital computers whereas microcontrollers are intended to be special - purpose digital controllers. • Microprocessors contain a CPU, memory addressing circuits and interrupt handling circuits. Microcontrollers have these features as well as timers, parallel and serial I/O and internal RAM and ROM. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 5
  • 6. Features of microcontrollers • High integration of functionality : Microcontrollers are called as single chip computers because they have on - chip memory and I/O circuitry and other circuitries that enable them to function as small stand - alone computers without other supporting circuitry. • Field programmability, flexibility : Microcontrollers often use EPROM or E2PROM as their storage device to allow field programmability so they are flexible to use. Once the program is tested to be correct then large quantities of microcontrollers can be programmed to be used in embedded systems. • Easy to use. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 6
  • 7. Advantages of microcontrollers • The overall system cost is low, as the peripherals are integrated in a single chip. • The product is of small size as compared to the microprocessor based system and is very handy. • The system is more reliable. • The system is easy to troubleshoot and maintain. • If required additional RAM, ROM and I/O ports may be interfaced. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 7
  • 8. Intel 8051 microcontroller • The 8 bit microcontroller 8051 family has numbers ranging from 8031 to 8751 and are available in N-channel Metal Oxide Semiconductor (NMOS) and Complementary MOS [CMOS] construction in a variety of package types. • The intel corporation introduced an 8 bit microcontroller 8051 in 1981. • This microcontroller had 128 bytes of RAM, 4k bytes of on - chip ROM, two timers, one serial port and 4 eight bit ports all on a single chip. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 8
  • 9. Comparison between 8051 and 8031 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 9
  • 10. ARCHITECTURE OF 8051 The features of the 8051 are : • 8 bit CPU with registers A (the accumulator) and B • 16 bit Program Counter (PC) and Data Pointer (DPTR) • 8 bit Program Status Word (PSW) • 64K Program memory address space • 64K Data memory address space • 128 bytes of on chip data memory • 32 I/O pins for four 8 bit ports : Port 0, Port 1, Port 2, Port 3 • Two 16 bit timers / counters : T0 and T1 • Full duplex UART : SBUF • Two external and three internal interrupt sources • On chip clock oscillator. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 10
  • 11. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 11
  • 12. • The intel 8051 contains two separate buses for both program and data. So, it has two distinctive memory spaces of 64K x 8 size for both program and data. • It is based on an 8 bit central processing unit with an 8 bit accumulator and another 8 bit B register as main processing blocks. • Other portions of the architecture include few 8 bit and 16 bit registers and 8 bit memory locations. • It has some amount of data RAM built in the device for internal processing. • 8051 is supported with on-chip peripheral functions like I/O ports, Timers / Counters, serial communication port. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 12
  • 13. Central processing unit • The CPU is the brain of the microcontrollers reading user’s programs and executing the expected task as per instructions stored there in. • It’s primary elements are an Accumulator (ACC), B register (B), Stack pointer (SP), Program counter (PC), Program status word (PSW), Data pointer register (DPTR) and few more 8 bit registers. Accumulator • The accumulator performs arithmetic and logic functions on 8 bit input variables. Arithmetic operations include basic addition, subtraction, multiplication and division. Logical operations are AND, OR XOR as well as rotate, clear, complement. • accumulator is responsible for conditional branching decisions and provides a temporary place in a data transfer operations within the device. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 13
  • 14. B Register • B register is used in multiply and divide operations. During execution B register either keeps one of the two inputs and then retains a portion of the result. For other instructions it is used as general purpose register. Stack Pointer • Stack Pointer (SP) is an 8 bit register. This pointer keeps track of memory space where the important register information are stored when the program flow gets into executing a subroutine. • The SP is automatically incremented or decremented for all PUSH or POP instructions and for all subroutine calls and returns. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 14
  • 15. Program Counter • The Program Counter (PC) is the 16 bit register giving address of next instruction to be executed during program execution and it always points to the program memory space. Data Pointer Register • The Data Pointer Register (DPTR) is the 16 bit addressing register that can be used to fetch any 8 bit data from the data memory space. When it is not being used for this purpose, it can be used as two eight bit registers, DPH and DPL. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 15
  • 16. Program Status Word • The Program Status Word (PSW) keeps the current status of the arithmetic and logic operations in different bits. The 8051 has four math flags that respond automatically to the outcomes of arithmetic and logic operations and 3 general purpose user flags that can be set 1 or cleared to 0 by the programmer as desired. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 16
  • 17. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 17
  • 18. Input / Output Ports • 8051 has 32 I/O pins configured as 4 eight bit parallel ports (P0, P1, P2 and P3). • Each pin can be used as an input or as an output under the software control. These I/O pins can be accessed directly by memory instructions during program execution to get require flexibility. • These port lines can be operated in different modes and all the pins can be made to do many different tasks apart from their regular I/O function executions. • Any instruction that accesses external program memory will output the higher order byte (A8 - A15) on Port 2 during read cycle. • Port 1 and Port 3 are available for standard I/O functions. • Port 3 pins has the additional functions : 2 external interrupt lines, 2 counter inputs, 2 serial port data lines and 2 timing control storbe lines. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 18
  • 19. Timers / Counters • 8051 has two 16 bit Timers / Counters, T0 and T1 capable of working in different modes. Each consists of a ‘HIGH’ byte and a ‘LOW’ byte which can be accessed under software. • There is a mode control register (TMOD) and a control register (TCON) to configure these timers / counters in number of ways. • These timers are used to measure time intervals, determine pulse widths or initiate events with one microsecond resolution upto a maximum 65ms. Use software to get longer delays. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 19
  • 20. Serial Port • The 8051 has a high speed full duplex serial port which is software configurable in 4 basic modes : • Shift register mode • Standard UART mode • Multiprocessor mode • 9 bit UART mode. • Full duplex means the data can go both ways at the same time. Interrupts • The 8051 has five interrupt sources : One from the serial port (RI / TI) when a transmission or reception operation is executed. • two from the timers (TF0, TF1) when overflow occurs and two come from the two input pins INT0, INT1. Each interrupt may be independently enabled or disabled to allow polling on same sources and each may be classified as high or low priority. • These operations are selected by Interrupt Enable (IE) and Interrupt Priority (IP) registers. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 20
  • 21. Oscillator and Clock • The 8051 generates the clock pulses by which all internal operations are synchronized. • Pins XTAL 1 and XTAL 2 are provided for connecting a resonant network to form an oscillator. A quartz crystal is used for oscillator. • The crystal frequency is the basic internal clock frequency of the microcontroller 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 21
  • 22. MEMORY ORGANIZATION • The 8051 architecture provide both on chip memory expansion capabilities. It supports several distinctive ‘physical’ address spaces, functionally separated at the hardware level by different addressing mechanisms, read and write controls signals or both : • On chip Program Memory • On chip Data Memory • Off chip Program Memory • Off chip Data Memory • On chip Special Function Registers 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 22
  • 23. • The Program Memory area (EPROM incase of external memory or Flash / EPROM incase of internal one) is extremely large and never lose information when the power is removed. • On chip data memory is smaller and therefore quicker than Program Memory and it goes into a random state when power is removed. On chip RAM is used for variables which are calculated when the program is executed. • Different addressing mechanisms are used to access these different memory spaces and this greatly contributes to microcomputer’s operating efficiency. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 23
  • 24. Total internal Data Memory is divided into three blocks : Lower 128 bytes Higher 128 bytes. Special Function Register Space. Higher 128 bytes are available only in 8032 / 8052 devices. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 24
  • 25. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 25
  • 26. SPECIAL FUNCTION REGISTERS (SFRS) 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 26
  • 27. Physical view 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 27
  • 28. PINOUTS OF 8051 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 28
  • 29. Signals of 8051 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 29
  • 30. • The remaining 8 pins are VCC, GND, XTAL1, XTAL2, RST, EA , PSEN and ALE / PROG and ALE / . The functions of these pins are described as follows : 1. Vcc • Pin 40 of 8051 provides supply voltage to the chip from the +5V voltage source. 2. GND • Pin 20 is the ground for the chip, 3. RST • Pin 9 is the RESET pin. This is referred as a power-on reset. When activating (high pulse) this pin the microcontroller will reset and all values in the registers to be lost. Table 4.4 gives the reset values of some registers. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 30
  • 31. 4.EA (External Access) • This input pin is connected to either Vcc or GND. The 8051 family members has ON – CHIP ROM to store programs. EA pin (31) is connected to Vcc in 8051 Here, EA pin is connected to GND to indicate that the code is stored externally. 5. PSEN (Program Store Enable) • This is an output pin and pin number is 29. In an 8051 - based system in which an external ROM holds the program code, this pin is connected to the OE pin of the ROM. 6. ALE (Addres Latch Enable) This is an output pin (30) and is active high. When connecting an 8051 to external memory, port 0 provides both address and data. In other words, 8051 multiplexes address and data through port 0 to save pins. If ALE = 0, port 0 provides data (D0 - D7). If ALE=1, it has address (A0- A7). 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 31
  • 32. 7. XTAL 1 and XTAL 2 • The 8051 has an on - chip oscillator and it requires an external clock to return it. The quartz crystal oscillator (12 MHz / 20 MHz) is connected to XTAL 1 (pin 19) and XTAL 2 (pin 18) with two 30pF capacitors as shown in Fig. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 32
  • 33. I/O PORTS Port 0 (P0.0 - 0.7) • Port 0 is used for both address and data bus (AD0 – AD7). When the microcontroller chip is connected to an external memory, Port 0 provides both address and data. ALE pin indicates if Port 0 has address or data. • When ALE = 0, Port 0 provides data (D0 – D7) • = 1, Port 0 provides address (A0 – A7) • ALE is used for demultiplexing address and data with the help of a latch. Port 1 (P1.0 - P1.7) • Port 1 pins are used as input or output. To make port 1 as an input port, write 1 to all its 8 bits. To make port 1 as output port, write 0 to all its 8 bits. Thus port 1 pins have no dual functions. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 33
  • 34. Port 2 (P2.0 - P2.7) • Port 2 pins are used as input / output pins similar in operation to port 1. The alternate use of port 2 is to supply a high order address byte (A8 – A15) when the microcontroller is connected to external memory. Port 3 (P3.0 - P3.7) • Port 3 pins are used as input or output. Port 3 has the additional functions 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 34
  • 35. ADDRESSING MODES • The addressing modes are the ways of accessing data in register or in memory or be provided as an immediate value. The 8051 mnemonics are written with the destination address named first, followed by the source address. The following addressing modes are used to access data : • Immediate addressing mode • Register addressing mode • Direct addressing mode • Register indirect addressing mode • Indexed addressing mode. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 35
  • 36. Immediate Addressing Mode • When a source operand is a constant rather than a variable, then the constant can be embedded into the instruction itself. • This kind of instructions take two bytes and first one specifies the opcode and second byte gives the required constant. • The operand comes immediately after the opcode. The mnemonic for immediate data is the pound sign (#). • This addressing mode can be used to load information into any of the registers including DPTR register. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 36
  • 37. Register Addressing Mode • Register addressing accesses the eight working registers (R0 - R7) of the selected register bank. The least significant three bits of the instruction opcode indicate which register is to be used for the operation. • One of the four banks of registers is to be predefined in the PSW before using register addressing instruction. ACC, B and DPTR can also be addressed in this mode. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 37
  • 38. Direct Addressing Mode • In the direct addressing mode, all 128 bytes of internal RAM and the SFRs may be addressed directly using the single - byte address assigned to each RAM location and each SFR. • Internal RAM uses address from 00H to 7FH to address each byte. The SFR addresses exist from 80H to FFH. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 38
  • 39. • Register Indirect Addressing Mode • In this mode a register is used as a pointer to the data. If the data is inside the CPU, only registers R0 and R1 are used for this purpose. When R0 and R1 hold the addresses of RAM locations, they must be preceded by the “@” sign. Indexed Addressing Mode Only the program memory can be accessed by this mode. This mode is intended for reading lookup tables in the program memory. A 16 bit base register (DPTR or PC) points to the base of the lookup tables and accumulator carries the constant indicating table entry number. The address of the exact location of the table is formed by adding the accumulator data to the base pointer. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 39
  • 40. INSTRUCTION SET • An instruction is a command given to the computer to perform a specified operation on given data. The instruction set is the collection of instructions that the microcontroller is designed to execute. • These instructions have been classified into the following groups. Data transfer group Arithmetic group Logical group Boolean variable manipulation Program branching 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 40
  • 41. Data Transfer Instructions 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 41
  • 42. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 42
  • 43. Note : • Rn = Any of the eight registers, R0 to R7, in the selected bank. • Ri = Either of the pointing registers R0 to R1 in the selected bank. • addr = Address of the internal RAM from 00H to FFH. • L = Least significant nibble. • ^ = External memory location. • ( ) = Contents of the location inside the parentheses. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 43
  • 44. Arithmetic Instructions 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 44
  • 45. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 45
  • 46. Logical Instructions 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 46
  • 47. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 47
  • 48. Boolean Variable Manipulation Instructions 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 48
  • 49. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 49
  • 50. Program Branching Instructions 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 50
  • 51. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 51
  • 52. PROGRAMS 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 52
  • 53. 8 bit subtraction 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 53
  • 54. 8 Bit Multiplication 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 54
  • 55. 8 Bit Division 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 55
  • 56. 5/25/2021 Kongunadu College of Engineering and Technology(Autonomous) 56