►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

ExperimenterUK
Thu Nov 20 2014, 06:00 PM
@Mehboob.. I don't think you can do that.
Sat Nov 15 2014, 06:41 AM
Mehboob
Pls can you send me code in c of PWM generation using UART/serial port in 8051.
Fri Nov 14 2014, 02:51 PM
mohammad aqil
NEED A BOOK ON MICROPROCESSOR AND INTERFACING BY D.V.HALL. RIGHT NOW, I SHALL BE VERY THANK FULL TO U....
Thu Nov 13 2014, 02:15 PM
m
please code hex project avr blood pressure monitor
Thu Nov 13 2014, 05:56 AM
Lambo
hi mate, whats the ajay-bhargav? tell us more pls
ExperimenterUK
Wed Nov 12 2014, 12:56 AM
@tmtm000.. have you been able to join ?
ExperimenterUK
Wed Nov 12 2014, 12:54 AM
@Alice..become a member,then send a PM to ajay_bhargav the site owner.
Tue Nov 11 2014, 03:58 AM
Abhishek Bansal
Thanks a lot for your informative tutorials!
Mon Nov 10 2014, 09:03 AM
Alice
Hello, This is Alice from a PCB rototype manufacturer. Our company is interested in your website contents, and wonder if we can advertise our company with payment on your website. There are two ways to advertise: first, if we an get a instant quote section on your main site columns; second, whether we can get a advertising section if you have any avaliable one. If any of above ways avaliable, please contact me with your detailed scheme and advertising charge. Thanks. Alice
Sat Nov 08 2014, 11:58 AM
Mohamed_123sd
Signals and Systems, 2nd Edition by Alan V. Oppenheim Alan S.willsky with S.Hamid Nawab?

Downloads

Comments

PsySc0rpi0n
Thu Nov 27 2014, 02:00 PM
hanifnoor
Thu Nov 27 2014, 09:42 AM
dpkraju
Wed Nov 26 2014, 02:18 PM
sankalp_s
Tue Nov 25 2014, 05:13 PM
dodul
Mon Nov 24 2014, 10:08 PM
VikiPeter
Tue Nov 18 2014, 09:13 AM
gentlboy
Sun Nov 16 2014, 11:13 PM
philipeastbourne
Wed Nov 12 2014, 05:32 AM

Online

Guests: 61, Members: 0 ...

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

Members: 37552
Newest member: PsySc0rpi0n
Forum Activity
PsySc0rpi0n Avatar
Posted By PsySc0rpi0n
Thu Nov 27 2014, 02:30 PM
Hi...I'm new in forum and with programming 8051 co...
hanifnoor Avatar
Posted By hanifnoor
Thu Nov 27 2014, 09:45 AM
while(msg_array[i]!='\0') { if(msg_array[i]=...
rearthur2003 Avatar
Posted By rearthur2003
Thu Nov 27 2014, 05:23 AM
there are two types of diodes ir rx which is coat...
rearthur2003 Avatar
Posted By rearthur2003
Thu Nov 27 2014, 05:19 AM
First you will need to let us know what IDE you pl...
engr1931 Avatar
Posted By engr1931
Thu Nov 27 2014, 05:18 AM
yes sir! i only know assembly, and still in proces...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Nov 26 2014, 06:36 PM
I never tried sending SMS messages at a high rate,...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Nov 26 2014, 06:23 PM
connected my modem with Laptop via serial2usb cabl...
dodul Avatar
Posted By dodul
Wed Nov 26 2014, 04:30 PM
Hi,Thanks a lot for your reply. Yes i was referrin...
nomi77 Avatar
Posted By nomi77
Wed Nov 26 2014, 07:30 AM
@ajayAnother option is this if i can do void stor...
nomi77 Avatar
Posted By nomi77
Wed Nov 26 2014, 07:05 AM
@ajayI did same procedureconnected my modem with L...