7 segment interfacing

08- AVR ATmega 16 Tutorials- Interfacing a Seven Segment Display || Decimal Counter Leave a comment

Hello everyone and welcome back to the Blog.

Typical Seven Segment Display

In this post, we are going to be working with a special type of LED display device called Seven Segment display. A seven-segment display or a seven-segment indicator is a form of an electronic display device for displaying decimal numerals. They are widely used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information. But we have most commonly seen them in elevators displaying floor numbers.  

Elevator Display

 

A generic Seven Segment display consists of seven LED’s packaged in a rectangular box that is capable of displaying decimal numerals from 0 to 9 hence the name seven segment display. Most of them will also have another LED to show a small Dot useful for displaying a decimal point. Each one of the eight LEDs in the display is given a positional segment with one of its connection pins being brought straight out of the rectangular plastic package. These individually LED pins are labelled from a through to h representing each individual LED. The other LED pins are connected together and wired to form a common pin.

We, therefore, get two combinations of common pins through this method:

  • All Positive pins connected together (Common Anode Seven Segment)
  • All Negative pins connected together (Common Cathode Seven Segment)

Common Anode Seven Segment Display

Common Anode Internal Diagram

As mentioned before, in this type of Seven Segments all the positive pins of the internal LEDs are connected together to form a Common Anode. Each individual Cathode of all the LEDs is brought out of the package to form control lines to control them separately. 

Hence this type of segments needs a Logic 0 or LOW for each individual LED to light up. A current limiting resistor should be connected with the Common Anode pin to regulate the current flow through each LED.

 

Common Cathode Internal Diagram

Common Cathode Seven Segment Display

In this type of Seven Segments, all the negative pins of the internal LEDs are connected together to form a Common Cathode. Each individual Anode of all the LEDs is brought out of the package to form control lines to control them separately. 

Hence this type of segments needs a Logic 1 or HIGH for each individual LED to light up. A current limiting resistor should be connected to each Anode pin before giving voltage to it to regulate the current flow through each LED.

Displaying Numbers on the Display

To display numbers on a Seven Segment display a particular value has to be given to its control lines depending on the type of the display (Common Anode/Cathode). Two lookup tables are, therefore, given below for your reference containing all the Hexadecimal values to be given to a display.

 

Look-Up Table(Common Anode)
Look-Up Table(Common Cathode)

 

I would now ask you to go through this video where I explain about the circuit and code in details:

Video:

 

Now, you should be having a clear idea of what we are doing in the circuit and in the code. I have also given the circuit diagram along with the code below for your convenience. Feel free to modify it as you see fit. Download the Makefile needed for compilation and copy it into the folder where you have saved the source file.

Circuit Diagram:

Code:

Shop Smart with us for Best Prices:

If you want to continue on with this series I would ask you to visit our YouTube channel and subscribe to receive continuous notifications. You can also subscribe to our Newsletter below to get email notification of each post as and when they are posted.

You can also follow us on social media platforms such as  Facebook and Twitter.

Thanks a lot for reading through this post. Feel free to follow through this series and comment your queries in the comment box below. Also feel free to contact us regarding any out of stock product and we will try to get back to you as soon as possible.

 

Leave a Reply