SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
MICROCONTROLLER
Microprocessor Vs. Microcontroller:
Microprocessor
 CPU is stand-alone, RAM, ROM, I/O, timer are separate
 Designer can decide on the amount of ROM, RAM and I/O ports.
 Bulkier
 Expensive
 General-purpose
Microcontroller
 CPU, RAM, ROM, I/O and timer are all on a single chip
 Fix amount of on-chip ROM, RAM, I/O ports
 Bit addressable
 For applications in which cost, power and space are critical
 Single-purpose
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
Embedded Systems Examples
Salient features of 8051 microcontroller
8051 Microcontroller is designed by Intel in 1981.
A Microcontroller is a programmable digital processor with necessary peripherals.
 Eight bit CPU
 On chip clock oscillator
 4Kbytes of internal program memory (code memory) [ROM]
 128 bytes of internal data memory [RAM]
 64 Kbytes of external program memory address space.
 64 Kbytes of external data memory address space.
 32 bi directional I/O lines (can be used as four 8 bit ports or 32 individually
addressable I/O lines)
 Two 16 Bit Timer/Counter :T0, T1
 Full Duplex serial data receiver/transmitter
 Four Register banks with 8 registers in each bank.
 Sixteen bit Program counter (PC) and a data pointer (DPTR)
 8 Bit Program Status Word (PSW)
 8 Bit Stack Pointer
 Five vector interrupt structure (RESET not considered as an interrupt.)
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
 8051 CPU consists of 8 bit ALU with associated registers like accumulator ‘A’ , B
register,
 ALU can perform arithmetic and logic functions on 8 bit variables.
 8051 has 128 bytes of internal RAM which is divided into
1. Working registers [00 – 1F]
2. Bit addressable memory area [20 – 2F]
3. General purpose memory area (Scratch pad memory) [30-7F]
Pin Configuration
 Pins 1 to 8 − These pins are known as Port 1. Each of these pins can be configured as
an input or an output means bi-directional I/O port.
 Pin 9 − It is a RESET pin, which is used to reset the microcontroller to its initial
values.
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
 Pins 10 to 17 − These pins are known as Port 3. each of these pins can serve as
general input or output pins. Besides, all of them have alternative functions
o Pin 10 RXD. Serial asynchronous communication input or Serial
synchronous communication output.
o Pin 11 TXD. Serial asynchronous communication output or Serial
synchronous communication clock output.
o Pin 12 INT0.External Interrupt 0 input
o Pin 13 INT1. External Interrupt 1 input
o Pin 14 T0. Counter 0 clock input
o Pin 15 T1. Counter 1 clock input
o Pin 16 WR. Write to external (additional) RAM
o Pin 17 RD. Read from external RAM
 Pins 18 & 19 − These pins are used for interfacing an external crystal to get the
system clock.
 Pin 20 − This pin provides the power supply to the circuit.
 Pins 21 to 28 − These pins are known as Port 2. It serves as I/O port. Higher order
address bus signals are also multiplexed using this port.
 Pin 29 − This is PSEN pin which stands for Program Store Enable. It is used to read
a signal from the external program memory.
 Pin 30 − This is EA pin which stands for External Access input. It is used to
enable/disable the external memory interfacing.
 Pin 31 − This is ALE pin which stands for Address Latch Enable. It is used to
demultiplex the address-data signal of port.
 Pins 32 to 39 − These pins are known as Port 0. It serves as I/O port. Lower order
address and data bus signals are multiplexed using this port.
 Pin 40 − This pin is used to provide power supply to the circuit.
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
Block Diagram of 8051
ALU: It is 8 bit unit. It performs arithmetic operation as addition, subtraction, multiplication, division,
increment and decrement. It performs logical operations like AND, OR and EX-OR.
Accumulator(A-reg): It is 8 bit register. It is used to store 8 bit data and to hold one of operand of
ALU units during arithmetical and logical operations. Result of arithmetic & logic operations
performed by ALU is accumulated by this register. Therefore it is called accumulator register.
B-register: It is bit and byte accessible. It is used in conjunction with A register as I/P operand for
ALU. It is used as general purpose register to store 8 bit data.
A and B registers together is also called MATH registers
Stack Pointer (SP) –It is 8-bit register. It is used to hold the internal RAM memory location addresses
which are used as stack memory.
Data pointer register (DTPR): It is a 16 bit register used to hold address of external or internal RAM
where data is stored or result is to be stored.
It is used to store 16 bit data. It is divided into2- 8bit registers.
DPH-data pointer higher order (83H) and DPL-data pointer lower order (82H).
Each register can be used as general purpose register to store 8 bit data and can also be used as
memory location.
Program Counter (PC) – 16 bit PC contains the address of next instruction to be executed. On reset
PC will set to 0000. After fetching every instruction PC will increment by one.
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
Flag Bits and PSW Register
The 8051 has four math flags and three general-purpose user flags ,they are grouped inside the
program status word (PSW) and the power control (PCON) registers.
The math flags include carry (C), auxiliary carry (AC), overflow (OV), and parity (P).
User flags are named FO, GFO, and GF1; they are general-purpose flags that may be used by the
programmer to record some event in the program. that can be set to I or cleared to 0 by the
programmer as desired
Program Status Word : This is an 8 bit register which contains the arithmetic status of ALU and the
bank select bits of register banks.
Power control register (PCON): it is 8-bit register. Its bits are used to control mode of power saving
circuit, either idle or power down mode and also one bit is used to modify baud rate of serial
communication
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
Special function Registers(SFR): The 8051 microcontroller has 11 SFR divided in 4 groups:
Timer/Counter register: 8051 microcontroller has two-16 bit Timer/counter registers
8051 microcontroller has two 8-bit timer control register i.e. TMOD and TCON register.
 TMOD Register: it is 8-bit register. It used to select mode and control operation of time by
writing control word.
 TCON register: It is 8-bit register. It is used to control operation of timer/ counter and
external interrupt .
Serial data register: 8051 micro controller has 2 serial data registers SBUF and SCON.
 Serial buffer register (SBUF): it is 8-bit register. It is used to hold data which is to be
transferred serially.
 Serial control register (SCON): it is 8-bit register. The 8-bit loaded into this register controls
the operation of serial communication.
Interrupt register: 8051 µC has two 8-bit interrupt register.
 Interrupt enable register (IE): it is 8-bit register. it is used to enable and disable function of
interrupt.
 Interrupt priority register (IP): It is 8-bit register. it is used to select low or high level priority
of each individual interrupts.
Memory Organization 0f 8051
The memory organization of 80851 is classified into two types
1. Data Memory or RAM 2. Program Memory or ROM
1.Data Memory or RAM
(a) Internal RAM/Data Memory :
• There are 128 bytes of RAM in the 8051.
– Assigned addresses 00 to 7FH
• The 128 bytes are divided into 3 different groups as follows:
– A total of 32 bytes from locations 00 to 1F hex are set aside for register banks and
the stack.
– A total of 16 bytes from locations 20H to 2FH are set aside for bit-addressable
read/write memory.
– A total of 80 bytes from locations 30H to 7FH are used for read and write storage,
called scratch pad.
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
(b) External RAM /Data Memory: Access to external memory is slower than access to
internal data memory. There may be up to 64K Bytes of external data memory.
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
Program Memory or Code Memory
EA'(bar) and PSEN' determines whether Internal ROM is accessed or External
ROM is accessed.
Internal ROM
8051 has 4 KB internal Read Only Memory.
 It mainly contains some executable functions and some data which may
never change.
 Address range is 0000H to 0FFFH.
 EA'=1 In this case, the microcontroller executes first the program from
built-in ROM, then the program stored in external memory.
External ROM
 EA'=0 In this case, the microcontroller completely ignores internal
program memory and executes only the program stored in external
memory.
 Address range is 0000H to FFFFH.
Register Banks in 8051
A total of 32 bytes of RAM are set aside for the register banks and the stack. These 32 bytes are
divided into four register banks in which each bank has 8 registers, R0–R7..
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP
Default Register Bank
If RAM locations 00–1F are set aside for the four registers banks, which register bank of R0–R7 do we
have access to when the 8051 is powered up?
The answer is register bank 0
How to Switch Register Banks
D4 and D3 bits of the PSW are used to select the desired register bank, since they can be accessed by
the bit addressable instructions SETB and CLR.
For example, "SETB PSW.3" will set PSW.3 = 1 and select the bank register 1.
Stack in the 8051
The stack is a section of a RAM used by the CPU to store information such as data or memory
address on temporary basis.
How Stacks are Accessed
As the stack is a section of a RAM, the register used to access the stack is known as the stack pointer
register.
The stack pointer in the 8051 is 8-bits wide.
When the 8051 is initialized, the SP register contains the value 07H. This means that the RAM
location 08 is the first location used for the stack.
The storing operation of a CPU register in the stack is known as a PUSH, and getting the contents
from the stack back into a CPU register is called a POP.
Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP

More Related Content

What's hot (20)

PDF
DAC Interfacing with 8051.pdf
Srikrishna Thota
 
PPTX
Pipelining approach
GopinathD17
 
PDF
8051 Microcontroller I/O ports
anishgoel
 
PPTX
Pic microcontroller architecture
DominicHendry
 
PPT
Architecture of 8086 Microprocessor
Mustapha Fatty
 
PPT
Addressing modes of 8051
SARITHA REDDY
 
PPTX
8255 PPI
deval patel
 
PPT
Memory organization of 8051
Muthu Manickam
 
PPTX
8051 MICROCONTROLLER ARCHITECTURE.pptx
MemonaMemon1
 
PPT
8255 presentaion.ppt
kamlesh deshmukh
 
PPT
Interrupt programming with 8051 microcontroller
Ankit Bhatnagar
 
PPTX
NYQUIST CRITERION FOR ZERO ISI
FAIZAN SHAFI
 
PPTX
Introduction to 8085 Microprocessor
Ravi Anand
 
PPTX
8051 memory
Mayank Garg
 
PPTX
Interfacing Stepper motor with 8051
Pantech ProLabs India Pvt Ltd
 
PPT
Interfacing 8255
Anuja Bhakuni
 
PPTX
Microprocessor 8085 complete
Shubham Singh
 
PDF
Minimum and Maximum Modes of microprocessor 8086
anil_gaur
 
PPT
UNIT III PROGRAMMABLE PERIPHERAL INTERFACE
ravis205084
 
PPTX
Line coding
Rina Ahire
 
DAC Interfacing with 8051.pdf
Srikrishna Thota
 
Pipelining approach
GopinathD17
 
8051 Microcontroller I/O ports
anishgoel
 
Pic microcontroller architecture
DominicHendry
 
Architecture of 8086 Microprocessor
Mustapha Fatty
 
Addressing modes of 8051
SARITHA REDDY
 
8255 PPI
deval patel
 
Memory organization of 8051
Muthu Manickam
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
MemonaMemon1
 
8255 presentaion.ppt
kamlesh deshmukh
 
Interrupt programming with 8051 microcontroller
Ankit Bhatnagar
 
NYQUIST CRITERION FOR ZERO ISI
FAIZAN SHAFI
 
Introduction to 8085 Microprocessor
Ravi Anand
 
8051 memory
Mayank Garg
 
Interfacing Stepper motor with 8051
Pantech ProLabs India Pvt Ltd
 
Interfacing 8255
Anuja Bhakuni
 
Microprocessor 8085 complete
Shubham Singh
 
Minimum and Maximum Modes of microprocessor 8086
anil_gaur
 
UNIT III PROGRAMMABLE PERIPHERAL INTERFACE
ravis205084
 
Line coding
Rina Ahire
 

Similar to 8051 Architecture and PIN Configuration.pdf (20)

PPTX
8051 microcontroller
nitugatkal
 
PDF
Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...
sangeeta jogade
 
PPTX
Architecture of the Intel 8051 Microcontroller
Sudhanshu Janwadkar
 
DOCX
Study of 8051 microcontroller
918007165995
 
PPTX
Microcontroller Electronics Engineering Sem 4MODULE 1.pptx
itsmeaswin03
 
PPTX
Unit 4.pptx
BLACKSPAROW
 
PPTX
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 Microcontrollers
Arti Parab Academics
 
PPTX
Micro 8051
Pranjali Deshmukh
 
PPTX
8051 Microcontroller_module_4.1.pptx
ARYAKUMARNIRAV
 
PPTX
MICROCONTROLLER 8051- Architecture and registers
C.Helen Sulochana
 
PDF
Unit1 5-mpi-lecture-notes
Prabhu Mali
 
DOC
8051 dev board guide
Murali Krishna
 
DOC
Architecture of 8085
HarshitParkar6677
 
DOC
Architecture of 8085
HarshitParkar6677
 
DOC
4th yr dmumicrocontroller1
haymanotyehuala
 
PPT
Micro controller
Dr. Ashok Kumar K
 
PPTX
Microcontroller1
karthiga selvaraju
 
PPT
Architecture of 8051 microcontroller))
Ganesh Ram
 
DOCX
Unit 5
Saurabh Yadav
 
PDF
002079
irfantheraj
 
8051 microcontroller
nitugatkal
 
Fundamentals of Microcontroller 8051 by Dr. Jogade S M, Assistant Professor, ...
sangeeta jogade
 
Architecture of the Intel 8051 Microcontroller
Sudhanshu Janwadkar
 
Study of 8051 microcontroller
918007165995
 
Microcontroller Electronics Engineering Sem 4MODULE 1.pptx
itsmeaswin03
 
Unit 4.pptx
BLACKSPAROW
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 Microcontrollers
Arti Parab Academics
 
Micro 8051
Pranjali Deshmukh
 
8051 Microcontroller_module_4.1.pptx
ARYAKUMARNIRAV
 
MICROCONTROLLER 8051- Architecture and registers
C.Helen Sulochana
 
Unit1 5-mpi-lecture-notes
Prabhu Mali
 
8051 dev board guide
Murali Krishna
 
Architecture of 8085
HarshitParkar6677
 
Architecture of 8085
HarshitParkar6677
 
4th yr dmumicrocontroller1
haymanotyehuala
 
Micro controller
Dr. Ashok Kumar K
 
Microcontroller1
karthiga selvaraju
 
Architecture of 8051 microcontroller))
Ganesh Ram
 
002079
irfantheraj
 
Ad

More from Srikrishna Thota (18)

PDF
solar energy introduction.pdf
Srikrishna Thota
 
PDF
Types of Microcontrollers.pdf
Srikrishna Thota
 
PDF
Addressing modes of 8051.pdf
Srikrishna Thota
 
PDF
interrupts of 8051.pdf
Srikrishna Thota
 
PDF
Port Organization of 8051 .pdf
Srikrishna Thota
 
PDF
DEVELOPMENT TOOLS FOR MICROCONTROLLERS.pdf
Srikrishna Thota
 
PDF
Interfacing of 8051 with 8255 Programmable Peripheral Interface.pdf
Srikrishna Thota
 
PDF
Seven segment interfacing with 8051.pdf
Srikrishna Thota
 
PDF
interfacing of temperature sensor LM 35 with 8051.pdf
Srikrishna Thota
 
PDF
BInary Number Representation
Srikrishna Thota
 
PPTX
Number Base Conversion Digital Electronics
Srikrishna Thota
 
PDF
Operational amplifiers
Srikrishna Thota
 
DOCX
Digital Electronics Notes
Srikrishna Thota
 
DOCX
The 8255 PPI
Srikrishna Thota
 
DOCX
Microprocessor Interfacing and 8155 Features
Srikrishna Thota
 
DOCX
Analog to Digital Conversion Basics
Srikrishna Thota
 
DOCX
8259 programmable interrupt controller
Srikrishna Thota
 
DOCX
8085 interfacing with memory chips
Srikrishna Thota
 
solar energy introduction.pdf
Srikrishna Thota
 
Types of Microcontrollers.pdf
Srikrishna Thota
 
Addressing modes of 8051.pdf
Srikrishna Thota
 
interrupts of 8051.pdf
Srikrishna Thota
 
Port Organization of 8051 .pdf
Srikrishna Thota
 
DEVELOPMENT TOOLS FOR MICROCONTROLLERS.pdf
Srikrishna Thota
 
Interfacing of 8051 with 8255 Programmable Peripheral Interface.pdf
Srikrishna Thota
 
Seven segment interfacing with 8051.pdf
Srikrishna Thota
 
interfacing of temperature sensor LM 35 with 8051.pdf
Srikrishna Thota
 
BInary Number Representation
Srikrishna Thota
 
Number Base Conversion Digital Electronics
Srikrishna Thota
 
Operational amplifiers
Srikrishna Thota
 
Digital Electronics Notes
Srikrishna Thota
 
The 8255 PPI
Srikrishna Thota
 
Microprocessor Interfacing and 8155 Features
Srikrishna Thota
 
Analog to Digital Conversion Basics
Srikrishna Thota
 
8259 programmable interrupt controller
Srikrishna Thota
 
8085 interfacing with memory chips
Srikrishna Thota
 
Ad

Recently uploaded (20)

PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PPTX
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PDF
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 

8051 Architecture and PIN Configuration.pdf

  • 1. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP MICROCONTROLLER Microprocessor Vs. Microcontroller: Microprocessor  CPU is stand-alone, RAM, ROM, I/O, timer are separate  Designer can decide on the amount of ROM, RAM and I/O ports.  Bulkier  Expensive  General-purpose Microcontroller  CPU, RAM, ROM, I/O and timer are all on a single chip  Fix amount of on-chip ROM, RAM, I/O ports  Bit addressable  For applications in which cost, power and space are critical  Single-purpose
  • 2. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP Embedded Systems Examples Salient features of 8051 microcontroller 8051 Microcontroller is designed by Intel in 1981. A Microcontroller is a programmable digital processor with necessary peripherals.  Eight bit CPU  On chip clock oscillator  4Kbytes of internal program memory (code memory) [ROM]  128 bytes of internal data memory [RAM]  64 Kbytes of external program memory address space.  64 Kbytes of external data memory address space.  32 bi directional I/O lines (can be used as four 8 bit ports or 32 individually addressable I/O lines)  Two 16 Bit Timer/Counter :T0, T1  Full Duplex serial data receiver/transmitter  Four Register banks with 8 registers in each bank.  Sixteen bit Program counter (PC) and a data pointer (DPTR)  8 Bit Program Status Word (PSW)  8 Bit Stack Pointer  Five vector interrupt structure (RESET not considered as an interrupt.)
  • 3. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP  8051 CPU consists of 8 bit ALU with associated registers like accumulator ‘A’ , B register,  ALU can perform arithmetic and logic functions on 8 bit variables.  8051 has 128 bytes of internal RAM which is divided into 1. Working registers [00 – 1F] 2. Bit addressable memory area [20 – 2F] 3. General purpose memory area (Scratch pad memory) [30-7F] Pin Configuration  Pins 1 to 8 − These pins are known as Port 1. Each of these pins can be configured as an input or an output means bi-directional I/O port.  Pin 9 − It is a RESET pin, which is used to reset the microcontroller to its initial values.
  • 4. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP  Pins 10 to 17 − These pins are known as Port 3. each of these pins can serve as general input or output pins. Besides, all of them have alternative functions o Pin 10 RXD. Serial asynchronous communication input or Serial synchronous communication output. o Pin 11 TXD. Serial asynchronous communication output or Serial synchronous communication clock output. o Pin 12 INT0.External Interrupt 0 input o Pin 13 INT1. External Interrupt 1 input o Pin 14 T0. Counter 0 clock input o Pin 15 T1. Counter 1 clock input o Pin 16 WR. Write to external (additional) RAM o Pin 17 RD. Read from external RAM  Pins 18 & 19 − These pins are used for interfacing an external crystal to get the system clock.  Pin 20 − This pin provides the power supply to the circuit.  Pins 21 to 28 − These pins are known as Port 2. It serves as I/O port. Higher order address bus signals are also multiplexed using this port.  Pin 29 − This is PSEN pin which stands for Program Store Enable. It is used to read a signal from the external program memory.  Pin 30 − This is EA pin which stands for External Access input. It is used to enable/disable the external memory interfacing.  Pin 31 − This is ALE pin which stands for Address Latch Enable. It is used to demultiplex the address-data signal of port.  Pins 32 to 39 − These pins are known as Port 0. It serves as I/O port. Lower order address and data bus signals are multiplexed using this port.  Pin 40 − This pin is used to provide power supply to the circuit.
  • 5. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP Block Diagram of 8051 ALU: It is 8 bit unit. It performs arithmetic operation as addition, subtraction, multiplication, division, increment and decrement. It performs logical operations like AND, OR and EX-OR. Accumulator(A-reg): It is 8 bit register. It is used to store 8 bit data and to hold one of operand of ALU units during arithmetical and logical operations. Result of arithmetic & logic operations performed by ALU is accumulated by this register. Therefore it is called accumulator register. B-register: It is bit and byte accessible. It is used in conjunction with A register as I/P operand for ALU. It is used as general purpose register to store 8 bit data. A and B registers together is also called MATH registers Stack Pointer (SP) –It is 8-bit register. It is used to hold the internal RAM memory location addresses which are used as stack memory. Data pointer register (DTPR): It is a 16 bit register used to hold address of external or internal RAM where data is stored or result is to be stored. It is used to store 16 bit data. It is divided into2- 8bit registers. DPH-data pointer higher order (83H) and DPL-data pointer lower order (82H). Each register can be used as general purpose register to store 8 bit data and can also be used as memory location. Program Counter (PC) – 16 bit PC contains the address of next instruction to be executed. On reset PC will set to 0000. After fetching every instruction PC will increment by one.
  • 6. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP Flag Bits and PSW Register The 8051 has four math flags and three general-purpose user flags ,they are grouped inside the program status word (PSW) and the power control (PCON) registers. The math flags include carry (C), auxiliary carry (AC), overflow (OV), and parity (P). User flags are named FO, GFO, and GF1; they are general-purpose flags that may be used by the programmer to record some event in the program. that can be set to I or cleared to 0 by the programmer as desired Program Status Word : This is an 8 bit register which contains the arithmetic status of ALU and the bank select bits of register banks. Power control register (PCON): it is 8-bit register. Its bits are used to control mode of power saving circuit, either idle or power down mode and also one bit is used to modify baud rate of serial communication
  • 7. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP Special function Registers(SFR): The 8051 microcontroller has 11 SFR divided in 4 groups: Timer/Counter register: 8051 microcontroller has two-16 bit Timer/counter registers 8051 microcontroller has two 8-bit timer control register i.e. TMOD and TCON register.  TMOD Register: it is 8-bit register. It used to select mode and control operation of time by writing control word.  TCON register: It is 8-bit register. It is used to control operation of timer/ counter and external interrupt . Serial data register: 8051 micro controller has 2 serial data registers SBUF and SCON.  Serial buffer register (SBUF): it is 8-bit register. It is used to hold data which is to be transferred serially.  Serial control register (SCON): it is 8-bit register. The 8-bit loaded into this register controls the operation of serial communication. Interrupt register: 8051 µC has two 8-bit interrupt register.  Interrupt enable register (IE): it is 8-bit register. it is used to enable and disable function of interrupt.  Interrupt priority register (IP): It is 8-bit register. it is used to select low or high level priority of each individual interrupts. Memory Organization 0f 8051 The memory organization of 80851 is classified into two types 1. Data Memory or RAM 2. Program Memory or ROM 1.Data Memory or RAM (a) Internal RAM/Data Memory : • There are 128 bytes of RAM in the 8051. – Assigned addresses 00 to 7FH • The 128 bytes are divided into 3 different groups as follows: – A total of 32 bytes from locations 00 to 1F hex are set aside for register banks and the stack. – A total of 16 bytes from locations 20H to 2FH are set aside for bit-addressable read/write memory. – A total of 80 bytes from locations 30H to 7FH are used for read and write storage, called scratch pad.
  • 8. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP (b) External RAM /Data Memory: Access to external memory is slower than access to internal data memory. There may be up to 64K Bytes of external data memory.
  • 9. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP Program Memory or Code Memory EA'(bar) and PSEN' determines whether Internal ROM is accessed or External ROM is accessed. Internal ROM 8051 has 4 KB internal Read Only Memory.  It mainly contains some executable functions and some data which may never change.  Address range is 0000H to 0FFFH.  EA'=1 In this case, the microcontroller executes first the program from built-in ROM, then the program stored in external memory. External ROM  EA'=0 In this case, the microcontroller completely ignores internal program memory and executes only the program stored in external memory.  Address range is 0000H to FFFFH. Register Banks in 8051 A total of 32 bytes of RAM are set aside for the register banks and the stack. These 32 bytes are divided into four register banks in which each bank has 8 registers, R0–R7..
  • 10. Microcontrollers T.Srikrishna, M.Sc , M.Tech, GVP Default Register Bank If RAM locations 00–1F are set aside for the four registers banks, which register bank of R0–R7 do we have access to when the 8051 is powered up? The answer is register bank 0 How to Switch Register Banks D4 and D3 bits of the PSW are used to select the desired register bank, since they can be accessed by the bit addressable instructions SETB and CLR. For example, "SETB PSW.3" will set PSW.3 = 1 and select the bank register 1. Stack in the 8051 The stack is a section of a RAM used by the CPU to store information such as data or memory address on temporary basis. How Stacks are Accessed As the stack is a section of a RAM, the register used to access the stack is known as the stack pointer register. The stack pointer in the 8051 is 8-bits wide. When the 8051 is initialized, the SP register contains the value 07H. This means that the RAM location 08 is the first location used for the stack. The storing operation of a CPU register in the stack is known as a PUSH, and getting the contents from the stack back into a CPU register is called a POP.