Interfacing 7 segment display with pic16f877 microcontroller
This post will describe that how easily we can do Interfacing 7 segment display with pic16f877 microcontroller. 7 segment display is a basically array of 7 leds with some proper arrangement. From this fig it can be seen that 7 leds arranged with an array starting from a, b, c, d, e, f, g, and h. So from every LED we get one pin and another Pin for providing active high voltage to every pin. Now whatever LEDs we have to glow we have to send active low on corresponding LED pin.
Now let take an example to clear all, suppose we have to display 5 at 7segment display then what should be our bit pattern? For display5 we have to glow a, f, g, c and d LEDs and off rest. As I discuss earlier, whatever LEDs we have to glow we have to send active low on corresponding LED pin because all others pin of LED got active high signal. So in our case we have to send bit pattern like
Now in my project to make you easily understandable the process, Interfacing 7 segment display with pic16f877 microcontroller, I made a counter which will count 0-5 and repeat. For that I used port B of microcontroller pic16f877 as an out port send different bit pattern for different digit to display at 7 segment display. So to display 0-5 we have to create exact bit pattern for every digit which are given bellow .
For 0 = 01000000.
For 1 = 01111001.
For 2 = 00100100.
For 3 = 00110000.
For 4 = 00011001.
For 5 = 00010010.
Here I give you the Proteus simulation circuit and see how I connect the 7 segment display pin with port B of microcontroller pic16f877.
In bellow you will find complete embedded C code on PIC Micro C Pro. From this code you will understand how i send particular bit pattern for individual digit.
// Author : Subham Dutta
// Date : 21-06-14
// Website : www.nbcafe.in