7-Segment Display Interfacing and Programming - Embedded Club 4 U
7-Segment Display Interfacing and Programming - Embedded Club 4 U
Embedded Club 4 U
Home Counter Course Contents Downloads Useful Links Contact Us
Training > Embedded System 6-week Training >
Home Introduction Course Contents Embedded DSP Sensors Guide Training Downloads Books Magazines Softwares Useful Links Projects Contuct Us Sitemap
As we hav e studied in LED interfacing a 7 -segment display is also interfaced in same way as it is also made of LEDs. So we can interface LEDs in three way s bu here difference is that 7 -Segment display s comes in two ty pes by manufacturers i.e. "Com m on Anode " and "Com m on Cathode "; the logics are shown in figure below.
and
https://sites.google.com/site/embeddedclub4u/training/embedded-system-training-in-45-days-6-week/7-segment-display-interfacing-and-programming
1/8
10/23/13
and thus which logic is o implement is on the bases of these specifications prov ided by manufacturer. interfacing in our case has been shown below. 5.3 7-Segm ent Display Interfacing We interface 7-Segment display with port zero of microcontroller; and to do so we connect P0.0 to P0.7 to Pin a to dp (h ) of 7-Segment display respectiv ely ; and connect Vss terminal of display to 5V Power supply and GND pin to ground. the configuration is shown in figure below.
5.4 Cascading sev en segm ent display Here we hav e a question in mind that if we want to interface more then one 7-Segment display with microcontroller what we will do??? as we are using one port for one 7-segment display if we use all the four ports for four 7-Segment display ??? isn't it less efficient??? The answer of all these questions are hidden under this topic "CASCADING " cascading refers to connecting similar or non-similar component from the same connections with a reference of enabling and disabling each components according to specification.
https://sites.google.com/site/embeddedclub4u/training/embedded-system-training-in-45-days-6-week/7-segment-display-interfacing-and-programming
2/8
10/23/13
For cascading four 7-Segment display we use the following schem where all the a to f (dp ) pins of 7 -segment display are connected paralleled to the port zero of microcontroller along with common ground and Vss pin of all the four 7-segments are use for enabling and disabling them so are connected to port two of microcontroller along with NOT Gate in order to " " and thus clearing or sending "0" on pins of port two cause enabling the display and signal "1" cause disabling it.
5.5
Programming a 7-Segment display is so easy as to program a LED array but here pattern should be generate in a manner so as it appears as a meaningful character and with cascaded mode we also need to send "clear" (0) or "set bit " (1) signal on respected pins of port two in order to enable or disable respected 7-Segment display . The signals on Port zero which can generate meaningful characters on 7-Segment display are listed in table below.
Ex ample Lets write a program to show character "3" on 7-Segm ent display .
3/8
10/23/13
;End
OUTPUT
0 to 9 Counter
;************************************* ;************ 0 to 9 Counter ************* ;************************************* org 0000h main: clr P2.0 sbit P2.1 sbit P2.2 sbit P2.3 mov P0,#0FCh call delay mov P0,#60h call delay mov P0,#0DAh character "2" to Port zero call delay ;Start ;Main Subroutine ;Enabling Display-1 ;Disabling Display-2 ;Disabling Display-3 ;Disabling Display-4 ;Sending character "0" to Port zero ;Calling Delay Function ;Sending pattern of character "1" to Port zero ;Calling Delay Function ;Sending pattern of ;Calling Delay Function
mov P0,#0F2h ;Sending pattern of character "3" to Port zero call delay ;Calling Delay Function mov P0,#66h ;Sending pattern of character "4" to Port zero call delay ;Calling Delay Function mov P0,#0B6h ;Sending pattern of character "5" to Port zero call delay ;Calling Delay Function mov P0,#0BEh ;Sending pattern of character "6" to Port zero call delay ;Calling Delay Function mov P0,#0E0h ;Sending pattern of character "7" to Port zero call delay ;Calling Delay Function mov P0,#0FEh ;Sending pattern of
https://sites.google.com/site/embeddedclub4u/training/embedded-system-training-in-45-days-6-week/7-segment-display-interfacing-and-programming
4/8
10/23/13
mov P0,#0FEh ;Sending pattern of character "8" to Port zero call delay ;Calling Delay Function mov P0,#0F6h ;Sending pattern of character "9" to Port zero call delay ;Calling Delay Function jmp main delay: ;Infinite Loop ;Delay Function
mov 40h,#0FFh ;Move FFh to memory location with address 40h L1: ;Label "L1" mov 41h,#99h ;Move 99h to memory 41h djnz 41h,$ ;Jump here till 41h becomes zero djnz 40h,L1 ;Jump to "L1" till 40h becomes zero ret ;return end ;End
OUTPUT
5.7
https://sites.google.com/site/embeddedclub4u/training/embedded-system-training-in-45-days-6-week/7-segment-display-interfacing-and-programming
5/8
10/23/13
OUTPUT
5.8
OUTPUT
https://sites.google.com/site/embeddedclub4u/training/embedded-system-training-in-45-days-6-week/7-segment-display-interfacing-and-programming
5.9
6/8
10/23/13
5.9
https://sites.google.com/site/embeddedclub4u/training/embedded-system-training-in-45-days-6-week/7-segment-display-interfacing-and-programming
7/8
10/23/13
OUTPUT
Comments
yuiyui
hjkhk
vbhbjk
hykhyuk
Sign in | Report Abuse | Print Page | Remove Access | Powered By Google Sites
https://sites.google.com/site/embeddedclub4u/training/embedded-system-training-in-45-days-6-week/7-segment-display-interfacing-and-programming
8/8