►Seven-Segment Display Example

The segments in a 7-segment display are arranged to form a single digit from 0 to F. We can display a multi-digit number by connecting additional displays. Even though LCD displays are more comfortable to work with, 7-segment displays are still standard in the industry. This is due to their temperature robustness, visibility and wide viewing angle. Segments are marked with non-capital letters: a, b, c, d, e, f, g and dp, where dp is the decimal point. The 8 LEDs inside each display can be arranged with a common cathode or common anode. With a common cathode display, the common cathode must be connected to the 0V rail and the LEDs are turned on with a logic one. Common anode displays must have the common anode connected to the +5V rail. The segments are turned on with a logic zero. The size of a display is measured in millimeters, the height of the digit itself (not the housing, but the digit!). Displays are available with a digit height of 7,10, 13.5, 20, or 25 millimeters. They come in different colors, including: red, orange, and green.


The simplest way to drive a display is via a display driver. These are available for up to 4 displays. Alternatively displays can be driven by a microcontroller and if more than one display is required, the method of driving them is called "multiplexing."


The main difference between the two methods is the number of "drive lines." A special driver may need only a single "clock" line and the driver chip will access all the segments and increment the display. If a single display is to be driven from a microcontroller, 7 lines will be needed plus one for the decimal point. For each additional display, only one extra line is needed. To produce a 4, 5 or 6 digit display, all the 7-segment displays are connected in parallel. The common line (the common-cathode line) is taken out separately and this line is taken low for a short period of time to turn on the display. Each display is turned on at a rate above 100 times per second, and it will appear that all the displays are turned on at the same time. As each display is turned on, the appropriate information must be delivered to it so that it will give the correct reading. Up to 6 displays can be accessed like this without the brightness of each display being affected. Each display is turned on very hard for one-sixth the time and the POV (persistence of vision) of our eye thinks the display is turned on the whole time. Therefore, the program has to ensure the proper timing, else the unpleasant blinking of display will occur.



Connecting a microcontroller to 7- segment displays in multiplex mode


Program "7seg.asm" displays decimal value of a number stored in variable D.
Example:
movlw .21 	 
movlw D 	; number 21 will be printed on 7seg display


Displaying digits is carried out in multiplex mode which means that the microcontroller alternately prints ones digit and tens digit. TMR0 interrupt serves for generating a time period, so that the program enters the interrupt routine every 5ms and performs multiplexing. In the interrupt routine, first step is deciding which segment should be turned on. In case that the tens digit was previously on, it should be turned off, set the mask for printing the ones digit on 7seg display which lasts 5ms, i.e. until the next interrupt.


For extracting the ones digit and the tens digit, macro digbyte is used. It stores the hundreds digit, the tens digit, and the ones digit into variables Dig1, Dig2, and Dig3. In our case, upon macro execution, Dig1 will equal 0, Dig2 will equal 2, and Dig3 will equal 1.


The following example shows the use of the macro in a program. Program prints a specified 2-digit number on a 7seg display in multiplex mode.




◄ Previous Page  |  Next Page ►

Back To Index

Conversation

Thu May 25 2017, 05:25 AM
Monir Hossain
Can i change the 7-Segment are common pin ? And how to?
Mon May 08 2017, 12:45 PM
ivan muvunyi
please can you send me wiring diagram for automatic control of 3 phase induction motor for production of maize flour
Wed May 03 2017, 08:39 PM
imran qureshi
hello friend
Sun Apr 30 2017, 05:49 AM
Lijin G Varghese
Can u send me the circuit diagram for Program to interface GSM Module with 8051 microcontroller (AT89C51) using PC and LCD
Fri Apr 28 2017, 03:47 PM
SANDEEP T S
I need pcb wizard 3.5 version kindly send valid link of yours
ExperimenterUK
Mon Apr 17 2017, 11:56 PM
Sorry..We had a problem with registration.Confirmation emails were not sent.Please re-register
Thu Apr 13 2017, 07:29 PM
Piyush Aughad
I want circuit & program for radar detection using Microcontroller 8051
Tue Apr 11 2017, 03:27 AM
Shabbir Ahmed
Hi Ajay ....hope you and your family all will be fine are you working on andriod aplications if yes then plz reply me
Sun Apr 09 2017, 06:33 PM
ATHULYA NAIR
Dear Sir, I need to know what are the complexity for programming in 8051 Microcontroller for three phase inverter?
Sun Apr 09 2017, 06:32 PM
ATHULYA NAIR
Dear Sir,

Downloads

Comments

Gaurav9527
Tue May 23 2017, 10:24 AM
rapushh
Tue May 23 2017, 10:22 AM
lubnakhan
Sat May 20 2017, 10:23 AM
Utsavi
Wed May 17 2017, 10:35 AM
Samimash
Tue May 16 2017, 01:15 PM
gangusa
Mon May 15 2017, 04:34 AM
raghuzala
Sun May 14 2017, 02:32 PM
Prakashlimbachiya
Sat May 13 2017, 07:34 AM

Online

Guests: 69, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37829
Newest member: Gaurav9527
Forum Activity
yogesh puri Avatar
Posted By yogesh puri
Thu May 25 2017, 10:33 PM
dear sirif i simulate the above program in keil it...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed May 24 2017, 09:42 PM
If you run the display in 4 bit mode and share pin...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed May 24 2017, 09:27 PM
Please post your code and Proteus file.
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed May 24 2017, 09:23 PM
i am unable to simulate following code in protous...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed May 24 2017, 05:01 AM
Duplicate post of http://www.8051projects.net/t651...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed May 24 2017, 05:00 AM
All I can say looking at the post is "insufficient...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed May 24 2017, 04:58 AM
(the 3 motorsteppers need to move independently, b...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed May 24 2017, 04:55 AM
I am never sure with Proteus keypad. They always h...
yogesh puri Avatar
Posted By yogesh puri
Tue May 23 2017, 10:36 PM
i am unable to simulate following code in protous....
yogesh puri Avatar
Posted By yogesh puri
Tue May 23 2017, 10:34 PM
i am unable to simulate following code in protous...