►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
Wed Oct 01 2014, 09:33 PM
We're back.. we had a bug, but posting is back to normal
ExperimenterUK
Sat Sep 13 2014, 04:34 PM
jaimin1212,Pimpalkhare Create a thread for your question
jaimin1212
Sat Sep 13 2014, 06:35 AM
i want to make self balancing robot using MPU6050 using atmega8.. please help to get data of gyro and accelerometer from this sensor through atmega8.
Thu Sep 11 2014, 01:00 PM
Sunil Pimpalkhare
Hello sir, I am trying to make Wearfin project https://www.youtube.com/watch?v=iZ6PVBvQf-g so can u help me in teaching how to built the program???
Thu Sep 11 2014, 06:21 AM
hariom panday
plz hlp me in my project
iec.naga
Tue Sep 09 2014, 05:19 AM
spi
Mon Sep 08 2014, 12:14 PM
fameem
water changing in fish tank automatically using microcontoller with timer. send idea to me
dexter_a
Sat Sep 06 2014, 03:09 PM
hello guys
Sat Sep 06 2014, 02:10 PM
munaxa
plx guide me
Sat Sep 06 2014, 02:09 PM
munaxa
hi i want to buy plx guie me

Downloads

Comments

engwas
Tue Sep 30 2014, 12:42 PM
zsachico
Tue Sep 30 2014, 04:18 AM
evergreencare
Sat Sep 27 2014, 07:39 AM
Agnoor
Thu Sep 25 2014, 06:39 AM
fouadzeyad
Tue Sep 23 2014, 09:04 AM
deepbhadani
Fri Sep 19 2014, 05:08 PM
desaiakshay92
Fri Sep 19 2014, 04:45 AM
Fiddu
Thu Sep 18 2014, 06:28 AM

Online

Guests: 51, Members: 0 ...

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

Members: 37522
Newest member: engwas
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Oct 01 2014, 09:30 PM
Sorry about the delay in replying,the website had ...
kirangowle Avatar
Posted By kirangowle
Sat Sep 20 2014, 04:35 AM
Hello All,I want to connect normal speaker (as a s...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Sep 17 2014, 04:59 AM
I think its important to list out the features of ...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Sep 17 2014, 04:45 AM
you need to put a wait condition in ISR till the s...
akshar Avatar
Posted By akshar
Mon Sep 15 2014, 08:41 AM
sir,i used microcontroller 89v51rd2 in circuit. No...
bobparihar Avatar
Posted By bobparihar
Mon Sep 15 2014, 06:24 AM
i am programming interrupt 0 using 8051my task is....
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Sep 13 2014, 04:23 PM
There may not be an exact equivalent .You will hav...
akshar Avatar
Posted By akshar
Sat Sep 13 2014, 07:18 AM
Sir, Good Morning,Thank you for making me a member...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 04:52 AM
which compiler are you using? I suggest XC8 with M...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 04:49 AM
I always prefer Olimex Dev boards when it comes to...