Till now you have learn what is an embedded system, basic memory architecture of a microcontroller, how to implement assembly language and use of some softwares like pinnacle 52, keil-C and flash magic; we also have come across how to interface LEDs from a microcontroller and how to generate different pattern through it. now its time to move forward and learn one more step ahead towards the completion of our 6-weak training. so here today we will learn about 7-Segment display; How to interface and program it; and some of the applications of it.
5.2 7-Segment Display
A 7-Segment display is a useful electronic component use to produce numeric, alphabetic and some non-alphabetic symbols using a specific arrangement of LEDs as shown in figure here.
A 7-Segment display has 10-Pins representing each a, b, c, b, e, f, g and h LEDs respectively along with two extra pins for GND and VSS. following shown an original 7-Segment display device along with its pin diagram. LED h is also denoted by symbol dp.
As we have 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 ways bu here difference is that 7-Segment displays comes in two types by manufacturers i.e. "Common Anode" and "Common Cathode"; the logics are shown in figure below.
and thus which logic is o implement is on the bases of these specifications provided by manufacturer. interfacing in our case has been shown below.
5.3 7-Segment 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 respectively; 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 seven segment display
Here we have 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.
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 7-Segment Display Programming
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.
5.6 Generating counting from 0 to 9
5.7 Generating counting from 0 to 9 [using array]
5.8 Generating two digit numbers
5.9 Generating two four bit numbers alternatively
CLICK TO DOWNLOAD SOURCE CODES