We use 7-segment display in our projects or where we need less complex device for displaying numbers because Graphical Display is more complex than 7-segment display and also making program for Graphical Display is more complex. Also, It requires more memory space.
7-segment is simple to understand and making projects. In this post, I’ll show you how you can interface 7-segment display to a microcontroller in different ways.
It is very simple and I believe that most of you know this. Eight digital output pins are required (including dot segment) to interface 7-segment display. Each pin of 7-segment is required to connect to the individual digital output pin. The microcontroller has ports and most of the port have eights pins.
In the case of the development board, the number of pins per port may have less than eight pins. If ports are available then one port is required to interface the display.
Based on the display configuration whether it is the common anode or common cathode. A single bit is required to make the segment visible or not.
This method requires an additional device or Integrated Circuit (IC) named 7447 IC. This is a digital integrated circuit known as BCD to 7-segment display. The name tells us everything. This IC is made for driving the 7-segment display. It takes BCD input and makes appropriate output so that display can show similar BCD number.
For example, BCD number 7 has a binary equivalent of 0111. Where 0 is LSB and 1 is MSB. If this binary number is given to the IC as input, the IC makes a,b,c pins as LOW (For common anode configuration) so that display shows number 7. In this method, 4 pins of the microcontroller are sufficient to display a number.
Again it is simple as first method but connection should properly done. A single mistake in pin connection can leads to not displaying number properly.
This method also requires an additional integrated circuit. This method requires SIPO (Serial Input Parallel Output) Shift register. Only two output pins of the microcontroller are required to make this thing to work.
There are eights pins in the 7-segment display so, an 8-bit shift register is required for a single 7-segment display.
There are two pins one is data pin and other one is clock pin. Data is shift from one flip-flop tho other on every clock pulse.
For example number 7 can be shown to the display by making a,b and c LOW and rest HIGH (For common anode configuration). The binary equivalent for displaying number seven is a,b,c,d,e,f,g,h –> 00011111.
First, 1 is given to the data pin and for the first clock, the data one enters the shift register. After that second bit is given to the data pin and when next clock comes the second bit enters the shift register. Rest will be done in the same way.
When all bits enter, the shift register then the setup is ready for the display.