►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.
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


Mon Nov 23 2015, 06:32 PM
طريقة عمل مشروع dtmf على الماتلاب بالتفصيل
Mon Nov 23 2015, 02:26 PM
Muhammad Naveed kayani
principal of Electrical circuits 8th Edition, by Thomas L. Floyd , Prentice Hall please send me ... ??
Sun Nov 22 2015, 03:20 AM
@Naresh Jain ..hex file for what ?
Thu Nov 19 2015, 04:16 PM
Naresh Jain
can u arrange hex file
Thu Nov 19 2015, 04:14 PM
Naresh Jain
where is PCB file ? there is error.
Thu Nov 19 2015, 02:25 PM
hello all
Thu Nov 19 2015, 03:31 AM
@Bhaveen Lodaya.. can you rejoin as a new user
Wed Nov 18 2015, 03:39 PM
Bhaveen Lodaya
@Ajay... I forgot my username and password as I haven't used this site for a very long time. Please help me reset it. I am not receiving the password reset emails too.
Sun Nov 15 2015, 04:31 AM
@Phil, please check my PM and reply.
Thu Nov 12 2015, 08:50 PM
@Ajay.. PM sent.. just routine stuff



Sat Nov 21 2015, 09:19 PM
Sat Nov 21 2015, 07:05 PM
Mon Nov 16 2015, 11:49 PM
Wed Nov 11 2015, 09:02 PM
Wed Nov 11 2015, 09:20 AM
Tue Nov 10 2015, 11:12 PM
Thu Nov 05 2015, 06:27 PM
Thu Nov 05 2015, 01:03 PM


Guests: 40, Members: 0 ...

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

Members: 37715
Newest member: emreaydogmus06
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Nov 12 2015, 08:58 PM
Your problem may be the mismatch of a 3.7 volt mic...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Nov 12 2015, 04:21 PM
Length of tracks or wires depends on drive strengt...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Nov 12 2015, 04:13 PM
Sure, we will be interested in discussing your pro...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Nov 12 2015, 04:09 PM
For AC devices, power = area under the curve so if...
gauravkothari23 Avatar
Posted By gauravkothari23
Wed Nov 11 2015, 09:10 PM
HI all,I am making a small project in which i am u...
csedwards1965 Avatar
Posted By csedwards1965
Tue Nov 10 2015, 11:20 PM
Hello.I am struggling to get the project lab going...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Nov 06 2015, 01:21 AM
Mains fan motors are generally meant to only run a...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Nov 06 2015, 01:12 AM
The key thing is the length of the interrupt code....
bobster Avatar
Posted By bobster
Thu Nov 05 2015, 06:39 PM
Hi all,I am using an atmel 89c5131 microcontroller...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Nov 05 2015, 12:20 PM
8086 is a microprocessor with only a CPU. It does ...