Hi there, today I’m gonna give you some PIC interfacing circuits. We have already seen how to connect the LCD display to PIC MCU which has a great role in the electronic display board industry.
By the way, how do we interface 7 segment displays to the PIC microcontroller? Some of you guys may already be familiar with seven segment electronic displays and their interface with display driver ICs. For a single 7 segment unit the, process is quite simple, since there are 7+1=8 pins in a display unit. So how to connect 4 or 5 units together? This is very common in digital display systems.
We have limited pins (only 40) available in a PIC microcontroller. To overcome this situation we use a technique called Seven Segment Display Multiplexing based on the theory of ‘Persistence of Vision’ of our eyes. The human eye can’t notice that visual change if the rate is 25 (or more) frames per second. Each display is turned ON for this period by continuous switching and our eyes will consider that the display is turned ON constantly.
Logic Behind Seven Segment Display Multiplexing
Now let’s see the logic behind seven segment display multiplexing in digital display boards.
- There will be one ENABLE pin at each 7-segment digital display unit (it specifies common anode or common cathode). Time being we consider common cathode display (when the common pin receives LOW (0V) the unit will be active). Our aim is to write 1 2 3 numbers on 3 display units respectively. The procedures are followed.
- All the A, B, C, D, E, F, G, DP pins of 3 units are shorted each other and connected to the PORT B of the PIC Microcontroller. (In my example I just skipped DP)
- Send data 1 (0x06) to the shorted lines and enable the 1st unit.
- Send data 2 (0x5B) to the shorted line and enable the 2nd unit.
- Send data 3 (0x4F) to the shorted line and enable the 3rd unit.
- These processes will be very fast more than 25 times per second. Hence our eye considers the unit displaying 1 2 3 all time. This is Multiplexed 7 segment display.
Seven Segment Multiplexing Circuit Diagram
- Crystal 20MHz
- Seven Segment Display
7 Segment Multiplexing Mikro C Program
- Here I have used count variable ‘s’ which is counting from 0 → to 9999.
- To get the display value I’m just doing modular division to the count variable and sending that divided value to PORT B where the displays are connected.
For example, s=5875
- s%10 = 5 (Last display value)
- (s/10)%10 = 7 (3rd display value)
- (s/100)%10 = 8 (2nd display value)
- (s/1000)%10 = 5 (1st display value)
- For converting this ‘s’ value to 7 segment format ‘switch’ case is used.
- A ‘for loop‘ is provided to display the value 5 times, otherwise, the output will be flickering and distorted.
Tip: You can use ‘Seven Segment Editor’ from mikroC for getting the hexadecimal value for display data.
Hope you guys got an idea about electronic display boards using multiplexed 7 segment display. You can build a Counter, Timer, Alarm, etc using multiplexed 7 segment display.