|
|
|
|
EE Design > In Technical
Title: Multiplexing 7-segment display & switches with PIC Microcontrollers Author: Vincent Wong Date: 29th March 2005 To multiplex several 7-segment display, all the segment a's are connected togather, segment b's are connected togather etc.. Each 7-segment digit is selected (to turn on) by controlling its common pin. They are turned on alternately so as both digits are seen (by human eye) to light up all at the same time. ![]() The figure above shows that all the segments of the digits are connected to PORTB of the PIC mcu. The RA1 pin selects the 7-SEG1 digit, and the RA2 pin selects the 7-SEG2 digit. The data for digit 1 is loaded into PORTB before digit 1 is selected. Now, the number in PORTB is being displayed in digit 1. The data for digit 2 is loaded into PORTB before digit 2 is selected. Now, the number in PORTB is being displayed in digit 2. The cycle repeats. It is required to put a delay in between the selection of digits to control the brightness of the display. Please note that if the delay is too slow, flickering will happen, If the delay is too fast, overlapping of image will happen. To add more digits, you will need to connect all the segments to the current a-p segments respectively. You will need more output pins to select the digits. ![]() Due to the high input impedance property of the PIC micro, we can save I/O pins to multiplex switches. The switches are connected to the respective segments, as shown above. Digit 1 will be displayed followed by Digit 2, then they both must be turned off. At this short period (same as delay in between digits), the pins connected to the switches must be configured as inputs and read for logic 0, in case of a switch press. If not, the pins must be set back as output pins and again Digit 1 & Digit 2 will be displayed (polling method). The cycles repeats.. The current consumption for displaying 2 digits is not double. This is because only 1 digit is being turned on at a time. |