7SEG Interfacing
7SEG Interfacing
Name:
Reg. No:
Date of
Experiment:
Multiplexing:
Multiplexing is required when we want to interface more than one displays with
microcontroller. If we interface them normally, they will require lots of I/O ports. In
multiplexing, only one display is kept active at a time but we see all of them active. For
multiplexing all the displays are connected in parallel such that if you activate any
segment, say ‘a’ the ‘a’ segment of all displays glows up. But we can switch ON and OFF
the “common” line of the displays with the Microcontroller pins. So if we wish to light
up the ‘a’ segment of display 1 we simply switch on display 1 first by applying ground
level (for common cathode display) at the common pin of the display and then send a
high signal on the I/O pin connected to segment ‘a’ to lit it.
Schematic:
a a
g g
PORTD Pins PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
Arduino Pins 7 6 5 4 3 2 1 0
Seven Segment Pins DP G F E D C B A
#define SEG0_PIN 8
#define SEG1_PIN 9
byte Count;
byte Seven_Segment[] = {
0x3F, 0x06, 0x5B, 0x4F, 0x66,
0x6D, 0x7D, 0x07, 0x7F, 0x6F
};
void Display(byte No)
{
byte units, tens;
tens = No / 10; // Separate tens from a number
units = No % 10; // Separate units from a number
void setup(){
DDRD = 0xFF; // OUPTPUT PORTS FOR SEVEN SEGMENT DISPLAYS
pinMode(SEG0_PIN,OUTPUT); // SELECT LINE(pin# 08) FOR SEG0
pinMode(SEG1_PIN,OUTPUT); // SELECT LINE(pin# 09) FOR SEG1
}
void loop(){
Display(Count++); // Displays two digit value on 7 segments
if(Count > 99)
Count = 0;
}
Lab Task:
Show hexadecimal numbers from 00 to FF on two seven segment displays