SlideShare a Scribd company logo
1 of 33
8051 Microcontroller
Unit - V
8051 MICROCONTROLLER
ARCHITECTURE
8051 Microcontroller
Block diagram
Features of 8051
• 8 bit CPU
• 16-bit program counter(PC) and data pointer (DPTR)
• 8-bit program status word(PSW)
• 8-bit stack pointer
• 4 Kbytes of on-chip program memory(ROM)
• 128 bytes of on-chip data random access memory(RAM)
• 8 bit bidirectional data bus
• 16-bit unidirectional address bus
Features of 8051
• 64Kbytes of program memory address space
• 64Kbytes of data memory address space
• Two 16 bit timers/counters
• 16 bit address bus multiplexed with port 0 and port 2
• 32 bit bidirectional I/O lines can be either used as 4 8-bit ports
• On-chip clock oscillator
• Control Registers
• Serial data receiver/transmitter
• Interrupt source
• Special features like USART, ADC, etc
• It is a CISC based Microcontroller with Harvard Architecture (separate program and data
memory).
Detailed Architecture of 8051 microcontroller
ALU (Arithmetic Logic Unit)
• it is 8 bit ALU. Part of CPU
• Performs arithmetic, logical and bitwise operations
• Used in manipulating data (either 8 bit or 1 bit)
• Individual bit of any register can be set, reset, cleared, complimented
with the help of logical computation,.
• Several registers are connected to it.
Accumulator or A register
• The Accumulator or Register A is the 8 bit register which is most important and most
used 8051 Microcontroller SFRs.
• It is located at the address E0H in the SFR memory space.
• The Accumulator is used to hold or store the data for almost all the ALU Operations like:
• Arithmetic Operations like Addition, Subtraction, Multiplication etc.
• Logical Operations like AND, OR, NOT etc.
• Data Transfer Operations (between 8051 and External Memory)
• register is used to accumulate (or store) the result of all Arithmetic and most of the
Logical Operations.
• It can hold an 8-bit (1-byte) value
• More than half of the 8051s 255 instructions manipulate or use the accumulator in some
way.
For example, if you want to add the number 10 and 20, the resulting 30 will be stored in
the Accumulator. Once you have a value in the Accumulator you may continue processing
the value or you may store it in another register or in memory.
Instruction decoder and control
• When an instruction is fetched – it is loaded in the instruction register
• Decoder decodes the instruction and establishes the sequence of
events to follow
• Instruction cycle: Instruction cycle is defined as the time required for
completing the execution of an instruction
• Instruction register is not programmable
• Control unit generates control signals necessary for communication
between the processor and peripheral
Instruction Register (IR):
• store instructions
• When one instruction is completed, next instruction is fetched in
memory for processing.
CPU Registers
• A Register
– 8 bit – Direct connection with ALU
– In multiplication- one of 8 bit operands stored in A and after
operation it stores lower byte in A
– In division- holds 8 bit dividend & quotient is stored in A
• B Register
– 8 bit
– Used with multiply and divide operations
– In multiplication- after operation it stores higher byte in B
– In division- holds 8 bit divisor & reminder is stored in B
Registers
Program status word(D0H)
• PSW or Program Status Word Register is also called as Flag Register and is one of the important SFRs.
• The PSW Register consists of Flag Bits, which help the programmer in checking the condition of the result
and also make decisions.
• Flags are 1-bit storage elements that store and indicate the nature of the result that is generated by
execution of certain instructions. The following image shows the contents of the PSW Register.
Stack Pointer(81H)
• SP or Stack Pointer Contains data item on the top of stack and it
indicates the next data to be accessed.
• The Stack Pointer is an 8-bit register and upon reset, the Stack Pointer
is initialized with 07H.
• When writing a new data byte(storing) into the stack, the SP (Stack
Pointer) is automatically incremented by 1 and the new data is
written at an address SP+1.
• When reading data from stack, the data is retrieved from the Address
in SP and after that the SP is decremented by 1 (SP-1).
Data Pointer
• The Data Pointer is a 16-bit Register and is physically the combination
of DPL (Data Pointer Low) and DPH (Data Pointer High) SFRs.
• Therefore Data Pointer can be used as a single 16-bit register (as
DPTR) or two 8-bit registers (as DPL and DPH).
• DPTR doesn’t have a physical Memory Address but the DPL (Lower
Byte of DPTR) and DPH (Higher Byte of DPTR) have separate
addresses in the SFR Memory Space.
• DPL = 82H and DPH = 83H.
• The DPTR Register is used by the programmer, addressing external
memory (Program – ROM or Data – RAM)
Program Counter
• Its 16 bit (2 byte) register
• Specifies the address of next instruction to be executed and is
incremented each time an instruction is executed
• After reset – PC will be set to 0000H and after execution of one
instruction, PC is incremented automatically to point to the address of
the next instruction to be executed.
• Why 16 bits PC?
Memory
• 4k bytes on chip ROM
• 128 bytes RAM
• Program memory is used to hold start up program
• Data random access memory is divided into 4 parts:
First 128 bytes : 00H TO 1FH (31) – Register Banks
20H TO 2FH(47) – Bit addressable RAM
30H TO 7FH (127) – General purpose registers
Next 128 bytes : 80H TO FFH (255) – Special function register
Register Banks
• The 8051 microcontroller consists of four register banks, such as Bank0, Bank1,
Bank2, Bank3 which are selected by the PSW (Program Status Word) register.
• These register banks are present in the internal RAM memory of the 8051
microcontroller, and are used to process the data when the microcontroller is
programmed.
• Lowest 32 bits
• 4 banks – each having 8 registers
• RS1 and RS0 (4TH BIT AND 3RD BIT) program status word select the bank
• Each bank contains R0 TO R7
• Example: add A,R2 – adds the value contained in R2 to the accumulator
• RS1=0 and RS0=0 – BANK 0 IS SELECTED
• R2 is which memory location? ADD A,02H
Internal RAM Organization
Timer/Counter and serial port
• Has two 16 bits timers/counter(timer 0 – timer 1)
• Which can be used either as timer to generate a time delay or as
counter to count events happening outside the microcontroller.
• In counter mode operation: they can count the number of high and
low transitions of the signal applied to the counter pins.
• In timer mode operation: timer can be independently programmed in
different mode of operation:
Modes of operation
• Mode 0
• Mode 1
• Mode 2
• Mode 3
• In mode 0: the serial port can either tranmit or receive at fixed baud
rate
• In mode 2: can simultaneously transmit and receive at anyone of the
two selectable baud rate
• Mode 1 n mode 3: it works as full duplex serial port with variable
baud rate which is programmed using timer 1
• In 8051,timer and counter contain two special function registers
• TMOD (timer mode register)
• TCON (timer control register)
• Used for activating and configuring counters and timers
Types of Instructions in 8051 Microcontroller
Instruction Set
• An 8051 Instruction consists of an Opcode (Operation – Code)
followed by Operand(s) of size Zero Byte, One Byte or Two Bytes
Instruction= opcode + operand
• The Op-Code part of the instruction specifies the type of operation to
be performed.
• All Opcode part of the instruction are of One Byte size.
• Operand part of the instruction defines the data being processed by
the instructions.
• The operand can be any of the following:
• No Operand
• Data value
• I/O Port
• Memory Location
• CPU register
8051 Addressing Modes
• An Addressing Mode is a way to locate a target Data, which is also
called as Operand.
• 8051 Family of Microcontrollers allows five types of Addressing
Modes for addressing the Operands. They are:
• Immediate Addressing
• Register Addressing
• Direct Addressing
• Register – Indirect Addressing
• Indexed Addressing
Immediate Addressing
• In Immediate Addressing mode, the operand, which follows the Opcode, is
a constant data of either 8 or 16 bits.
• The name Immediate Addressing came from the fact that the constant
data to be stored in the memory immediately follows the Opcode.
• The constant value to be stored is specified in the instruction itself rather
than taking from a register. The destination register to which the constant
data must be copied should be the same size as the operand mentioned in
the instruction.
• Example: MOV A, #030H
• Here, the Accumulator is loaded with 30 (hexadecimal). The # in the
operand indicates that it is a data and not the address of a Register.
• Immediate Addressing is very fast as the data to be loaded is given in the
instruction itself.
Register Addressing
• In the 8051 Microcontroller, we have studied the organization of RAM
and four banks of Working Registers with eight Registers in each bank.
• In Register Addressing mode, one of the eight registers (R0 – R7) is
specified as Operand in the Instruction.
• It is important to select the appropriate Bank with the help of PSW
Register.
• Example: MOV A, R5
• Here, the 8-bit content of the Register R5 of Bank0 is moved to the
Accumulator.
Direct Addressing
• In Direct Addressing Mode, the address of the data is specified as the
Operand in the instruction.
• Using Direct Addressing Mode, we can access any register or on-chip
variable.
• This includes general purpose RAM, SFRs, I/O Ports, Control registers.
• Example: MOV A, 47H
• Here, the data in the RAM location 47H is moved to the Accumulator.
Register Indirect Addressing
• In the Register Indirect Addressing Mode, the address of the Operand
is specified as the content of a Register.
• Example: MOV A, @R1
• The @ symbol indicates that the addressing mode is indirect. If the
contents of R1 is 56H, for example, then the operand is in the internal
RAM location 56H. If the contents of the RAM location 56H is 24H,
then 24H is moved into accumulator.
• Only R0 and R1 are allowed in Indirect Addressing Mode. These
register in the indirect addressing mode are called as Pointer
registers.
Indexed Addressing Mode
• With Indexed Addressing Mode, the effective address of the Operand
is the sum of a base register and an offset register.
• The Base Register can be either Data Pointer (DPTR) or Program
Counter (PC) while the Offset register is the Accumulator (A).
• In Indexed Addressing Mode, only MOVC and JMP instructions can be
used..
• Example: MOVC A, @A+DPTR
• Here, the address for the operand is the sum of contents of DPTR and
Accumulator.
THANK YOU

More Related Content

Similar to lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx

Similar to lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx (20)

8085 microprocessor architecture
8085 microprocessor architecture8085 microprocessor architecture
8085 microprocessor architecture
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
Unit 2.ppt
Unit 2.pptUnit 2.ppt
Unit 2.ppt
 
MP_MC.pdf
MP_MC.pdfMP_MC.pdf
MP_MC.pdf
 
MPMC
MPMC MPMC
MPMC
 
B sc e5.2 mp unit 4 mc-8051
B sc e5.2 mp unit 4 mc-8051B sc e5.2 mp unit 4 mc-8051
B sc e5.2 mp unit 4 mc-8051
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
 
8085 microprocessor
8085 microprocessor8085 microprocessor
8085 microprocessor
 
Microprocessors 8085 architecture
Microprocessors 8085 architectureMicroprocessors 8085 architecture
Microprocessors 8085 architecture
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
 
UNIT 1 Microprocessors.pptx
UNIT 1 Microprocessors.pptxUNIT 1 Microprocessors.pptx
UNIT 1 Microprocessors.pptx
 
8085-microprocessor
8085-microprocessor8085-microprocessor
8085-microprocessor
 
8085 Microprocessor Architecture
8085 Microprocessor Architecture8085 Microprocessor Architecture
8085 Microprocessor Architecture
 
MCUnit 4and 5_New.pptx
MCUnit 4and 5_New.pptxMCUnit 4and 5_New.pptx
MCUnit 4and 5_New.pptx
 
Microprocessors and microcontrollers
Microprocessors and microcontrollersMicroprocessors and microcontrollers
Microprocessors and microcontrollers
 
8051.ppt
8051.ppt8051.ppt
8051.ppt
 
Micro 8051
Micro 8051Micro 8051
Micro 8051
 
8051d
8051d8051d
8051d
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085
 

More from MadavanR1

EE4104 -ELECTRICAL DRIVES AND CONTROL.pptx
EE4104 -ELECTRICAL DRIVES AND CONTROL.pptxEE4104 -ELECTRICAL DRIVES AND CONTROL.pptx
EE4104 -ELECTRICAL DRIVES AND CONTROL.pptxMadavanR1
 
lecture on 31 fuzzy logic _ system (3).ppt
lecture on 31 fuzzy logic _ system (3).pptlecture on 31 fuzzy logic _ system (3).ppt
lecture on 31 fuzzy logic _ system (3).pptMadavanR1
 
Zaragoza Factory_Transformer Our product_ EN.ppt
Zaragoza Factory_Transformer Our product_ EN.pptZaragoza Factory_Transformer Our product_ EN.ppt
Zaragoza Factory_Transformer Our product_ EN.pptMadavanR1
 
8051 - microcontroller applications.pptx
8051 - microcontroller applications.pptx8051 - microcontroller applications.pptx
8051 - microcontroller applications.pptxMadavanR1
 
OPERATING PRINCIPLES OF TRANSFORMER AND CONSTRUCTION.ppt
OPERATING PRINCIPLES OF TRANSFORMER AND CONSTRUCTION.pptOPERATING PRINCIPLES OF TRANSFORMER AND CONSTRUCTION.ppt
OPERATING PRINCIPLES OF TRANSFORMER AND CONSTRUCTION.pptMadavanR1
 
MEPCO Full 191217.ppt
MEPCO Full 191217.pptMEPCO Full 191217.ppt
MEPCO Full 191217.pptMadavanR1
 
lec 31 fuzzysystem (3) (2).ppt
lec 31 fuzzysystem (3) (2).pptlec 31 fuzzysystem (3) (2).ppt
lec 31 fuzzysystem (3) (2).pptMadavanR1
 

More from MadavanR1 (7)

EE4104 -ELECTRICAL DRIVES AND CONTROL.pptx
EE4104 -ELECTRICAL DRIVES AND CONTROL.pptxEE4104 -ELECTRICAL DRIVES AND CONTROL.pptx
EE4104 -ELECTRICAL DRIVES AND CONTROL.pptx
 
lecture on 31 fuzzy logic _ system (3).ppt
lecture on 31 fuzzy logic _ system (3).pptlecture on 31 fuzzy logic _ system (3).ppt
lecture on 31 fuzzy logic _ system (3).ppt
 
Zaragoza Factory_Transformer Our product_ EN.ppt
Zaragoza Factory_Transformer Our product_ EN.pptZaragoza Factory_Transformer Our product_ EN.ppt
Zaragoza Factory_Transformer Our product_ EN.ppt
 
8051 - microcontroller applications.pptx
8051 - microcontroller applications.pptx8051 - microcontroller applications.pptx
8051 - microcontroller applications.pptx
 
OPERATING PRINCIPLES OF TRANSFORMER AND CONSTRUCTION.ppt
OPERATING PRINCIPLES OF TRANSFORMER AND CONSTRUCTION.pptOPERATING PRINCIPLES OF TRANSFORMER AND CONSTRUCTION.ppt
OPERATING PRINCIPLES OF TRANSFORMER AND CONSTRUCTION.ppt
 
MEPCO Full 191217.ppt
MEPCO Full 191217.pptMEPCO Full 191217.ppt
MEPCO Full 191217.ppt
 
lec 31 fuzzysystem (3) (2).ppt
lec 31 fuzzysystem (3) (2).pptlec 31 fuzzysystem (3) (2).ppt
lec 31 fuzzysystem (3) (2).ppt
 

Recently uploaded

Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 

Recently uploaded (20)

9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 

lec3-8051microcontrollerarchitecture-230130044236-5c11a082.pptx

  • 4. Features of 8051 • 8 bit CPU • 16-bit program counter(PC) and data pointer (DPTR) • 8-bit program status word(PSW) • 8-bit stack pointer • 4 Kbytes of on-chip program memory(ROM) • 128 bytes of on-chip data random access memory(RAM) • 8 bit bidirectional data bus • 16-bit unidirectional address bus
  • 5. Features of 8051 • 64Kbytes of program memory address space • 64Kbytes of data memory address space • Two 16 bit timers/counters • 16 bit address bus multiplexed with port 0 and port 2 • 32 bit bidirectional I/O lines can be either used as 4 8-bit ports • On-chip clock oscillator • Control Registers • Serial data receiver/transmitter • Interrupt source • Special features like USART, ADC, etc • It is a CISC based Microcontroller with Harvard Architecture (separate program and data memory).
  • 6. Detailed Architecture of 8051 microcontroller
  • 7. ALU (Arithmetic Logic Unit) • it is 8 bit ALU. Part of CPU • Performs arithmetic, logical and bitwise operations • Used in manipulating data (either 8 bit or 1 bit) • Individual bit of any register can be set, reset, cleared, complimented with the help of logical computation,. • Several registers are connected to it.
  • 8. Accumulator or A register • The Accumulator or Register A is the 8 bit register which is most important and most used 8051 Microcontroller SFRs. • It is located at the address E0H in the SFR memory space. • The Accumulator is used to hold or store the data for almost all the ALU Operations like: • Arithmetic Operations like Addition, Subtraction, Multiplication etc. • Logical Operations like AND, OR, NOT etc. • Data Transfer Operations (between 8051 and External Memory) • register is used to accumulate (or store) the result of all Arithmetic and most of the Logical Operations. • It can hold an 8-bit (1-byte) value • More than half of the 8051s 255 instructions manipulate or use the accumulator in some way. For example, if you want to add the number 10 and 20, the resulting 30 will be stored in the Accumulator. Once you have a value in the Accumulator you may continue processing the value or you may store it in another register or in memory.
  • 9. Instruction decoder and control • When an instruction is fetched – it is loaded in the instruction register • Decoder decodes the instruction and establishes the sequence of events to follow • Instruction cycle: Instruction cycle is defined as the time required for completing the execution of an instruction • Instruction register is not programmable • Control unit generates control signals necessary for communication between the processor and peripheral
  • 10. Instruction Register (IR): • store instructions • When one instruction is completed, next instruction is fetched in memory for processing.
  • 11. CPU Registers • A Register – 8 bit – Direct connection with ALU – In multiplication- one of 8 bit operands stored in A and after operation it stores lower byte in A – In division- holds 8 bit dividend & quotient is stored in A • B Register – 8 bit – Used with multiply and divide operations – In multiplication- after operation it stores higher byte in B – In division- holds 8 bit divisor & reminder is stored in B
  • 13. Program status word(D0H) • PSW or Program Status Word Register is also called as Flag Register and is one of the important SFRs. • The PSW Register consists of Flag Bits, which help the programmer in checking the condition of the result and also make decisions. • Flags are 1-bit storage elements that store and indicate the nature of the result that is generated by execution of certain instructions. The following image shows the contents of the PSW Register.
  • 14. Stack Pointer(81H) • SP or Stack Pointer Contains data item on the top of stack and it indicates the next data to be accessed. • The Stack Pointer is an 8-bit register and upon reset, the Stack Pointer is initialized with 07H. • When writing a new data byte(storing) into the stack, the SP (Stack Pointer) is automatically incremented by 1 and the new data is written at an address SP+1. • When reading data from stack, the data is retrieved from the Address in SP and after that the SP is decremented by 1 (SP-1).
  • 15. Data Pointer • The Data Pointer is a 16-bit Register and is physically the combination of DPL (Data Pointer Low) and DPH (Data Pointer High) SFRs. • Therefore Data Pointer can be used as a single 16-bit register (as DPTR) or two 8-bit registers (as DPL and DPH). • DPTR doesn’t have a physical Memory Address but the DPL (Lower Byte of DPTR) and DPH (Higher Byte of DPTR) have separate addresses in the SFR Memory Space. • DPL = 82H and DPH = 83H. • The DPTR Register is used by the programmer, addressing external memory (Program – ROM or Data – RAM)
  • 16.
  • 17. Program Counter • Its 16 bit (2 byte) register • Specifies the address of next instruction to be executed and is incremented each time an instruction is executed • After reset – PC will be set to 0000H and after execution of one instruction, PC is incremented automatically to point to the address of the next instruction to be executed. • Why 16 bits PC?
  • 18. Memory • 4k bytes on chip ROM • 128 bytes RAM • Program memory is used to hold start up program • Data random access memory is divided into 4 parts: First 128 bytes : 00H TO 1FH (31) – Register Banks 20H TO 2FH(47) – Bit addressable RAM 30H TO 7FH (127) – General purpose registers Next 128 bytes : 80H TO FFH (255) – Special function register
  • 19. Register Banks • The 8051 microcontroller consists of four register banks, such as Bank0, Bank1, Bank2, Bank3 which are selected by the PSW (Program Status Word) register. • These register banks are present in the internal RAM memory of the 8051 microcontroller, and are used to process the data when the microcontroller is programmed. • Lowest 32 bits • 4 banks – each having 8 registers • RS1 and RS0 (4TH BIT AND 3RD BIT) program status word select the bank • Each bank contains R0 TO R7 • Example: add A,R2 – adds the value contained in R2 to the accumulator • RS1=0 and RS0=0 – BANK 0 IS SELECTED • R2 is which memory location? ADD A,02H
  • 21.
  • 22. Timer/Counter and serial port • Has two 16 bits timers/counter(timer 0 – timer 1) • Which can be used either as timer to generate a time delay or as counter to count events happening outside the microcontroller. • In counter mode operation: they can count the number of high and low transitions of the signal applied to the counter pins. • In timer mode operation: timer can be independently programmed in different mode of operation:
  • 23. Modes of operation • Mode 0 • Mode 1 • Mode 2 • Mode 3 • In mode 0: the serial port can either tranmit or receive at fixed baud rate • In mode 2: can simultaneously transmit and receive at anyone of the two selectable baud rate • Mode 1 n mode 3: it works as full duplex serial port with variable baud rate which is programmed using timer 1
  • 24. • In 8051,timer and counter contain two special function registers • TMOD (timer mode register) • TCON (timer control register) • Used for activating and configuring counters and timers
  • 25. Types of Instructions in 8051 Microcontroller Instruction Set • An 8051 Instruction consists of an Opcode (Operation – Code) followed by Operand(s) of size Zero Byte, One Byte or Two Bytes Instruction= opcode + operand • The Op-Code part of the instruction specifies the type of operation to be performed. • All Opcode part of the instruction are of One Byte size. • Operand part of the instruction defines the data being processed by the instructions.
  • 26. • The operand can be any of the following: • No Operand • Data value • I/O Port • Memory Location • CPU register
  • 27. 8051 Addressing Modes • An Addressing Mode is a way to locate a target Data, which is also called as Operand. • 8051 Family of Microcontrollers allows five types of Addressing Modes for addressing the Operands. They are: • Immediate Addressing • Register Addressing • Direct Addressing • Register – Indirect Addressing • Indexed Addressing
  • 28. Immediate Addressing • In Immediate Addressing mode, the operand, which follows the Opcode, is a constant data of either 8 or 16 bits. • The name Immediate Addressing came from the fact that the constant data to be stored in the memory immediately follows the Opcode. • The constant value to be stored is specified in the instruction itself rather than taking from a register. The destination register to which the constant data must be copied should be the same size as the operand mentioned in the instruction. • Example: MOV A, #030H • Here, the Accumulator is loaded with 30 (hexadecimal). The # in the operand indicates that it is a data and not the address of a Register. • Immediate Addressing is very fast as the data to be loaded is given in the instruction itself.
  • 29. Register Addressing • In the 8051 Microcontroller, we have studied the organization of RAM and four banks of Working Registers with eight Registers in each bank. • In Register Addressing mode, one of the eight registers (R0 – R7) is specified as Operand in the Instruction. • It is important to select the appropriate Bank with the help of PSW Register. • Example: MOV A, R5 • Here, the 8-bit content of the Register R5 of Bank0 is moved to the Accumulator.
  • 30. Direct Addressing • In Direct Addressing Mode, the address of the data is specified as the Operand in the instruction. • Using Direct Addressing Mode, we can access any register or on-chip variable. • This includes general purpose RAM, SFRs, I/O Ports, Control registers. • Example: MOV A, 47H • Here, the data in the RAM location 47H is moved to the Accumulator.
  • 31. Register Indirect Addressing • In the Register Indirect Addressing Mode, the address of the Operand is specified as the content of a Register. • Example: MOV A, @R1 • The @ symbol indicates that the addressing mode is indirect. If the contents of R1 is 56H, for example, then the operand is in the internal RAM location 56H. If the contents of the RAM location 56H is 24H, then 24H is moved into accumulator. • Only R0 and R1 are allowed in Indirect Addressing Mode. These register in the indirect addressing mode are called as Pointer registers.
  • 32. Indexed Addressing Mode • With Indexed Addressing Mode, the effective address of the Operand is the sum of a base register and an offset register. • The Base Register can be either Data Pointer (DPTR) or Program Counter (PC) while the Offset register is the Accumulator (A). • In Indexed Addressing Mode, only MOVC and JMP instructions can be used.. • Example: MOVC A, @A+DPTR • Here, the address for the operand is the sum of contents of DPTR and Accumulator.