SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP
Seven segment interfacing with 8051
The name 7 segments imply there are 7 LED segments arranged as shown
Seven segment displays are used to display digits from 0 to 9 and they also
display letters A to F
Working
There are two main constructions of the seven-segment display modules
Common Cathode: In this type of segments all the cathode terminals are
made common and tied to GND. Thus the segments a to g needs a logic
High signal(5v) in order to glow.
Common Anode: In this type of segments all the anodes terminals are
made common and tied to VCC(5v). Thus the segments a to g needs a
logic LOW signal(GND) in order to glow.
Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP
Components required
 8051 Microcontroller
 7-Segment-Display
 2:4 Decoder
 NPN bipolar junction transistor –
 5V Power supply
Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP
We will have two lookup tables that have values that are the
complement of each other depending on whether we are using common
anode/common cathode type seven-segment display.
Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP
Assembly language program to interface seven segment display (0-9)
ORG 4000H
DB: 3FH, 06H, 5BH, 4FH, 66H, 6DH, 7DH, 07H, 7FH, 6FH, 0
; Lookup table for digits 0 to 9
ORG 0000H
main: MOV DPTR, #4000H
Repeat: CLR A
MOVC A, @A+DPTR ; Copy data from external location to accumulator
MOV P1, A ; Move the pattern of the digit into port P2
ACALL delay ; Call a delay to so that the transition is visible
INC DPTR ; Point to the next pattern
CJNE A, 0, Repeat ; Repeat till 0 (Stop bit) is received
SJMP main ; Run this forever till externally stopped
Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP
Mode P3.4 P3.3
Active
Module
1 0 0 1
2 0 1 2
3 1 0 3
4 1 1 4
Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP
Seven segment display – Four Modules
Now to interface more than one module at once with the 8051 microcontroller. Hence, we
connect a 2:4 decoder, whose inputs are given by pin P3.3 and pin P3.4.
Based on the status of these two pins, we come up with four modes that correspond to the
display selected.
Assembly language program to interface quad seven segment displays to 8051
ORG 4000H
DB 06H, 5BH, 4FH, 66H
ORG 0000H
main: MOV DPTR, #4000H
MOV P3, #00H ; clear the port 3 to use it as output port
CLR P3.3 ; Mode 1
CLR P3.4 ; 00
CLR A
MOVC A, @A+DPTR
CPL A
MOV P2, A ; P2 = 00000110b = pattern of digit ‘1’
ACALL delay
INC DPTR
SETB P3.3 ; Mode 2
CLR P3.4 ; 01
CLR A
MOVC A, @A+DPTR
Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP
CPL A
MOV P2, A ; P2 = 01011011b = pattern of digit ‘2’
ACALL delay
INC DPTR
CLR P3.3 ; Mode 3
SETB P3.4 ; 10
CLR A
MOVC A, @A+DPTR
CPL A
MOV P2, A ; P2 = 01001111b = pattern of digit ‘3’
ACALL delay
INC DPTR
SETB P3.3 ; Mode 4
SETB P3.3 ; 11
CLR A
MOVC A, @A+DPTR
CPL A
MOV P2, A ; P2 = 01100110b = pattern of digit ‘4’
ACALL delay
SJMP main ; Run this program forever

More Related Content

What's hot (20)

PPTX
Microcontroller 8051 and its interfacing
Ankur Mahajan
 
PPTX
8051 timer counter
vishalgohel12195
 
PPT
8051 instruction set
Andri Prastiyo
 
PDF
8051 Microcontroller I/O ports
anishgoel
 
PDF
DAC Interfacing with 8051.pdf
Srikrishna Thota
 
PPTX
Interfacing Stepper motor with 8051
Pantech ProLabs India Pvt Ltd
 
PPTX
8257 DMA Controller
ShivamSood22
 
PPTX
LCD Interacing with 8051
Sudhanshu Janwadkar
 
PPT
8051 block diagram
DominicHendry
 
PPTX
8051 MICROCONTROLLER ARCHITECTURE.pptx
MemonaMemon1
 
PPT
8051 Addressing Modes
Senthil Kumar
 
PDF
8051 interfacing
KanchanPatil34
 
DOCX
8051 data types and directives
SARITHA REDDY
 
PPTX
8255 PPI
deval patel
 
PPT
Architecture of 8086 Microprocessor
Mustapha Fatty
 
PPT
8051 serial communication-UART
Pantech ProLabs India Pvt Ltd
 
PPT
8255 presentaion.ppt
kamlesh deshmukh
 
PPTX
Interfacing with peripherals: analog to digital converters and digital to ana...
NimeshSingh27
 
PPTX
Windowing techniques of fir filter design
Rohan Nagpal
 
Microcontroller 8051 and its interfacing
Ankur Mahajan
 
8051 timer counter
vishalgohel12195
 
8051 instruction set
Andri Prastiyo
 
8051 Microcontroller I/O ports
anishgoel
 
DAC Interfacing with 8051.pdf
Srikrishna Thota
 
Interfacing Stepper motor with 8051
Pantech ProLabs India Pvt Ltd
 
8257 DMA Controller
ShivamSood22
 
LCD Interacing with 8051
Sudhanshu Janwadkar
 
8051 block diagram
DominicHendry
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
MemonaMemon1
 
8051 Addressing Modes
Senthil Kumar
 
8051 interfacing
KanchanPatil34
 
8051 data types and directives
SARITHA REDDY
 
8255 PPI
deval patel
 
Architecture of 8086 Microprocessor
Mustapha Fatty
 
8051 serial communication-UART
Pantech ProLabs India Pvt Ltd
 
8255 presentaion.ppt
kamlesh deshmukh
 
Interfacing with peripherals: analog to digital converters and digital to ana...
NimeshSingh27
 
Windowing techniques of fir filter design
Rohan Nagpal
 

Similar to Seven segment interfacing with 8051.pdf (20)

PDF
8051.pdf
MadhuriAnaparthy
 
PPTX
Ppt on interfacing led and 7 segment with 8951
pooja jaiswal
 
PPTX
Ppt on interfacing led and 7 segmentwith 8951
pooja jaiswal
 
PDF
IRJET - Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
IRJET Journal
 
PDF
Embedded C Programming Module 7 Presentation
MarkkandanS
 
DOC
Unit iv microcontrollers final
SARITHA REDDY
 
PPTX
UNIT V - INTERFACING MICROCONTROLLER (1).pptx
rdjeyan
 
PPTX
Electronic code lock device
Amitoj Kaur
 
PDF
Analog to Digital Converter
Ariel Tonatiuh Espindola
 
DOCX
Lcd interfacing
AshuKaranam
 
PPTX
Introduction to embedded system & density based traffic light system
Rani Loganathan
 
DOCX
8051 FINIAL
Edwin Shankar
 
DOCX
LCD WITH 8051.docx
bhattparthiv23
 
PDF
Abstract - Interfacing 5 x7 matrix led display to 8051
Vatsal N Shah
 
PPTX
THERMOMETER_963258_DIGITAL THERMOMETER.pptx
sahulipunku2001
 
PPTX
application of Mp traffic light LED LCD display.pptx
vaishnavipanditengg
 
PDF
Nand gate breadboardtask
shankarganesh73
 
PDF
Eee iv-microcontrollers [10 es42]-assignment
Gopinath.B.L Naidu
 
PPT
IMPLEMENTING A DIGITAL MULTIMETER
Vijay Elavunkal
 
PPTX
Analog to Digital Converters
Amitabh Shukla
 
Ppt on interfacing led and 7 segment with 8951
pooja jaiswal
 
Ppt on interfacing led and 7 segmentwith 8951
pooja jaiswal
 
IRJET - Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
IRJET Journal
 
Embedded C Programming Module 7 Presentation
MarkkandanS
 
Unit iv microcontrollers final
SARITHA REDDY
 
UNIT V - INTERFACING MICROCONTROLLER (1).pptx
rdjeyan
 
Electronic code lock device
Amitoj Kaur
 
Analog to Digital Converter
Ariel Tonatiuh Espindola
 
Lcd interfacing
AshuKaranam
 
Introduction to embedded system & density based traffic light system
Rani Loganathan
 
8051 FINIAL
Edwin Shankar
 
LCD WITH 8051.docx
bhattparthiv23
 
Abstract - Interfacing 5 x7 matrix led display to 8051
Vatsal N Shah
 
THERMOMETER_963258_DIGITAL THERMOMETER.pptx
sahulipunku2001
 
application of Mp traffic light LED LCD display.pptx
vaishnavipanditengg
 
Nand gate breadboardtask
shankarganesh73
 
Eee iv-microcontrollers [10 es42]-assignment
Gopinath.B.L Naidu
 
IMPLEMENTING A DIGITAL MULTIMETER
Vijay Elavunkal
 
Analog to Digital Converters
Amitabh Shukla
 
Ad

More from Srikrishna Thota (18)

PDF
solar energy introduction.pdf
Srikrishna Thota
 
PDF
8051 Architecture and PIN Configuration.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
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
 
8051 Architecture and PIN Configuration.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
 
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)

PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 

Seven segment interfacing with 8051.pdf

  • 1. Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP Seven segment interfacing with 8051 The name 7 segments imply there are 7 LED segments arranged as shown Seven segment displays are used to display digits from 0 to 9 and they also display letters A to F Working There are two main constructions of the seven-segment display modules Common Cathode: In this type of segments all the cathode terminals are made common and tied to GND. Thus the segments a to g needs a logic High signal(5v) in order to glow. Common Anode: In this type of segments all the anodes terminals are made common and tied to VCC(5v). Thus the segments a to g needs a logic LOW signal(GND) in order to glow.
  • 2. Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP Components required  8051 Microcontroller  7-Segment-Display  2:4 Decoder  NPN bipolar junction transistor –  5V Power supply
  • 3. Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP We will have two lookup tables that have values that are the complement of each other depending on whether we are using common anode/common cathode type seven-segment display.
  • 4. Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP Assembly language program to interface seven segment display (0-9) ORG 4000H DB: 3FH, 06H, 5BH, 4FH, 66H, 6DH, 7DH, 07H, 7FH, 6FH, 0 ; Lookup table for digits 0 to 9 ORG 0000H main: MOV DPTR, #4000H Repeat: CLR A MOVC A, @A+DPTR ; Copy data from external location to accumulator MOV P1, A ; Move the pattern of the digit into port P2 ACALL delay ; Call a delay to so that the transition is visible INC DPTR ; Point to the next pattern CJNE A, 0, Repeat ; Repeat till 0 (Stop bit) is received SJMP main ; Run this forever till externally stopped
  • 5. Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP Mode P3.4 P3.3 Active Module 1 0 0 1 2 0 1 2 3 1 0 3 4 1 1 4
  • 6. Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP Seven segment display – Four Modules Now to interface more than one module at once with the 8051 microcontroller. Hence, we connect a 2:4 decoder, whose inputs are given by pin P3.3 and pin P3.4. Based on the status of these two pins, we come up with four modes that correspond to the display selected. Assembly language program to interface quad seven segment displays to 8051 ORG 4000H DB 06H, 5BH, 4FH, 66H ORG 0000H main: MOV DPTR, #4000H MOV P3, #00H ; clear the port 3 to use it as output port CLR P3.3 ; Mode 1 CLR P3.4 ; 00 CLR A MOVC A, @A+DPTR CPL A MOV P2, A ; P2 = 00000110b = pattern of digit ‘1’ ACALL delay INC DPTR SETB P3.3 ; Mode 2 CLR P3.4 ; 01 CLR A MOVC A, @A+DPTR
  • 7. Seven Segment Interfacing with 8051 T.Srikrishna, M.Sc, M.Tech, GVP CPL A MOV P2, A ; P2 = 01011011b = pattern of digit ‘2’ ACALL delay INC DPTR CLR P3.3 ; Mode 3 SETB P3.4 ; 10 CLR A MOVC A, @A+DPTR CPL A MOV P2, A ; P2 = 01001111b = pattern of digit ‘3’ ACALL delay INC DPTR SETB P3.3 ; Mode 4 SETB P3.3 ; 11 CLR A MOVC A, @A+DPTR CPL A MOV P2, A ; P2 = 01100110b = pattern of digit ‘4’ ACALL delay SJMP main ; Run this program forever