Interfacing 7-Segment Display With PIC Microcontroller – MikroC

The 7-segment display is the earliest type of an electronic display that uses 7 LEDs bars arranged in a way that can be used show the numbers 0 – 9. (actually 8 segments if you count the decimal point, but the generic name adopted is 7-segment display.) These devices are commonly used in digital clocks, electronic meters, counters, signalling, and other equipment for displaying numeric only data.Β 

Interfacing 7-Segment Display With PIC Microcontroller - MikroCIt is not different from anΒ LED in terms of interfacing, by turning the appropriate segments ON and OFF we can display easily the numbers 0 to 9 and optionally the decimal pointΒ (DP).Β 

The segments of the displays are normally referred to by letters β€˜a’ to β€˜g’.
Figures 2 and 3 show how a 7-segment display can display digits.Β 
In figure 2, all the segments (LEDs) are switched on to display the digit β€œ8” with the decimal point. On the other hand, in figure 3, segments a, b, c, d and g are switched on to display the digit β€œ3”.Β  any combination can be used to display any desired digit.
The segments can also be used to display some letters, but this is limited. For example, the letter β€œb” can be displayed by switching on the segmentsΒ  c, d, e and f and the letter β€œF” by switching on segments a, e, f and g.

In figure 4, the anode pins of all the segments are connected together and this pin is usually connected to the power supply. Individual segments are turned ON by grounding the required segment pin through the microcontroller by sending a β€œ0” to the pin output.Β 
In figure 5 as well as in figure 1, all the cathodes of all the segments are connected together and this pin is usually connected to ground. Individual segments are turned ON by applying voltage to the required segment pin through the microcontroller by sending a β€œ1” to the pin output.Β 

A PIC can source or sink 25mA of current per Input/Output pin. When designing an LED circuit, we have to know the typical voltage drop as we have learnt from the Blinking an LED ConnectedΒ to a PIC microcontrollerΒ article.Β 
As with standard LEDs, it is required to use current limiting resistors in each segment of the display to limit the current as shown in figure 1.Β 
Interfacing 7-Segment Display With PIC Microcontroller - MikroC SchematicThe easiest way to display a number on the 7-segment is to find a way to determine or look up the pattern corresponding to the digit to be displayed . This can be something like a table showing the numbers and the corresponding segment that should be turned ON or OFF to display something and the required number (this can be in decimal, hexadecimal or in binary format) to be sent to the port where the display is connected to in order to display a specific number.

 

For more detail: Interfacing 7-Segment Display With PIC Microcontroller – MikroC


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.