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

PPTX
noise control of buildings
PPTX
Automatic irrigation system ppt
PPTX
Education in ancient india
PDF
Encoder & Decoder
PDF
ARM Architecture
PPTX
Interrupts in 8051
PPTX
Instruction set of 8086
PPTX
I/O port programming in 8051
noise control of buildings
Automatic irrigation system ppt
Education in ancient india
Encoder & Decoder
ARM Architecture
Interrupts in 8051
Instruction set of 8086
I/O port programming in 8051

What's hot (20)

PPT
8051 Microcontroller
PPTX
Key board interfacing with 8051
PPT
Memory organization of 8051
PDF
Memory interfacing of microprocessor 8085
PPT
Memory & I/O interfacing
PDF
DAC Interfacing with 8051.pdf
PPTX
8051 Microcontroller PPT's By Er. Swapnil Kaware
PPT
8051 ch9-950217
PPT
Architecture of 8086 Microprocessor
PDF
Keypad Interfacing with 8051 Microcontroller
PPT
Interfacing 8255
PPTX
Architecture of 8051
PPTX
8257 DMA Controller
PDF
8051 interfacing
PPTX
Interfacing Stepper motor with 8051
PDF
Pic microcontroller architecture
PPTX
Instruction set of 8085 microprocessor
PPT
PIC timer programming
PPTX
Keyboard Interfacing .pptx
PDF
8085 microprocessor ramesh gaonkar
8051 Microcontroller
Key board interfacing with 8051
Memory organization of 8051
Memory interfacing of microprocessor 8085
Memory & I/O interfacing
DAC Interfacing with 8051.pdf
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 ch9-950217
Architecture of 8086 Microprocessor
Keypad Interfacing with 8051 Microcontroller
Interfacing 8255
Architecture of 8051
8257 DMA Controller
8051 interfacing
Interfacing Stepper motor with 8051
Pic microcontroller architecture
Instruction set of 8085 microprocessor
PIC timer programming
Keyboard Interfacing .pptx
8085 microprocessor ramesh gaonkar
Ad

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

PDF
PPTX
Ppt on interfacing led and 7 segment with 8951
PPTX
Ppt on interfacing led and 7 segmentwith 8951
PPTX
dokumen.tips_ppt-on-interfacing-led-and-7-segment-with-8951 (1).pptx
PDF
IRJET - Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
PDF
Embedded C Programming Module 7 Presentation
DOC
Unit iv microcontrollers final
PPTX
UNIT V - INTERFACING MICROCONTROLLER (1).pptx
PPTX
Electronic code lock device
PDF
Analog to Digital Converter
DOCX
Lcd interfacing
PPTX
Introduction to embedded system & density based traffic light system
DOCX
8051 FINIAL
DOCX
LCD WITH 8051.docx
PDF
Abstract - Interfacing 5 x7 matrix led display to 8051
PPTX
THERMOMETER_963258_DIGITAL THERMOMETER.pptx
PPTX
application of Mp traffic light LED LCD display.pptx
PDF
Nand gate breadboardtask
PDF
Eee iv-microcontrollers [10 es42]-assignment
PPT
IMPLEMENTING A DIGITAL MULTIMETER
Ppt on interfacing led and 7 segment with 8951
Ppt on interfacing led and 7 segmentwith 8951
dokumen.tips_ppt-on-interfacing-led-and-7-segment-with-8951 (1).pptx
IRJET - Interfacing Multi-Digit 7-Segment with 8051 Microcontroller
Embedded C Programming Module 7 Presentation
Unit iv microcontrollers final
UNIT V - INTERFACING MICROCONTROLLER (1).pptx
Electronic code lock device
Analog to Digital Converter
Lcd interfacing
Introduction to embedded system & density based traffic light system
8051 FINIAL
LCD WITH 8051.docx
Abstract - Interfacing 5 x7 matrix led display to 8051
THERMOMETER_963258_DIGITAL THERMOMETER.pptx
application of Mp traffic light LED LCD display.pptx
Nand gate breadboardtask
Eee iv-microcontrollers [10 es42]-assignment
IMPLEMENTING A DIGITAL MULTIMETER
Ad

More from Srikrishna Thota (18)

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

Recently uploaded (20)

PDF
Basic Mud Logging Guide for educational purpose
PDF
RMMM.pdf make it easy to upload and study
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Pharma ospi slides which help in ospi learning
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
01-Introduction-to-Information-Management.pdf
PDF
Business Ethics Teaching Materials for college
PDF
Insiders guide to clinical Medicine.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
Basic Mud Logging Guide for educational purpose
RMMM.pdf make it easy to upload and study
O7-L3 Supply Chain Operations - ICLT Program
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Complications of Minimal Access Surgery at WLH
Pharma ospi slides which help in ospi learning
102 student loan defaulters named and shamed – Is someone you know on the list?
FourierSeries-QuestionsWithAnswers(Part-A).pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Renaissance Architecture: A Journey from Faith to Humanism
01-Introduction-to-Information-Management.pdf
Business Ethics Teaching Materials for college
Insiders guide to clinical Medicine.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Microbial disease of the cardiovascular and lymphatic systems
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
O5-L3 Freight Transport Ops (International) V1.pdf

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