You are on page 1of 7

6/12/23, 12:40 AM Jeganvjk/Interfacing-Seven-Segment-Display

Interfacing Seven Segment Display

AIM:
To display the characters and numbers in the seven segment display using Arduino UNO controller.

Software required:
Arduino IDE
Proteous

PROCEDURE:

Arduino IDE
Step1:Open the Arduino IDE
Step2: Go to file and select new file option
Step3:Type the program
Step4:Go to file and select save option to save the program
Step5:Go to sketch and select verify or compile options
Step6:If no error Hex file will be generated in the temporary folder

Proteus
Step7:Open the Proteus software
Step8:Go to file select new design and click ok button
Step9:Select component mode and click pick devices from the library
Step10:Type the component name in the keyword to select the components and click ok button
Step11:Design the circuit as per the diagram
Step12:Double click the Arduino controller and upload the hex file generated by Arduino IDE
Step13:Click start button and check the output

THEORY:

What is a seven-segment display?


The seven-segment display is a bunch of eight LEDs arranged in a particular pattern. The pattern
traces an outline of the digit ‘8’. Out of these eight LEDs, seven are line-shaped arranged in the
shape of number eight, and one is a circular LED. The circular LED is mostly used to indicate
decimal points.Each of these eight LEDs is individually controllable via separate pins on the display
module. Due to this particular arrangement, it can display numbers from 0 to 9 and alphabets from
A to F. Since LEDs are cheap and easy to use, a seven-segment display is sufficient for simple
projects.

https://github.com/Jeganvjk/Interfacing-Seven-Segment-Display 1/7
6/12/23, 12:40 AM Jeganvjk/Interfacing-Seven-Segment-Display

Understanding the 7 segment display


To properly understand how to use a seven-segment display in tandem with an Arduino or any
system for that matter, we need to understand its internal as well as external construction.The
internal circuit of a seven-segment display

Study the internal circuitry of a seven-segment display, as shown in the picture above carefully.
You’ll notice the carefully laid out LEDs. Notice how in both the configurations, one off the two
ends of the LEDs is connected to a common line. This common line is either GND (left) or VCC
(right). Let’s talk about that a bit. Your 7-segment display is possibly one of two types: Common
cathode,Common anode

What is a common anode seven-segment display?


For an LED to light up, the anode needs to connect with a power source. And the cathode needs to
connect with the ground. That’s the basic working of an LED.In a common anode display, all the
eight LEDs have their anodes interconnected. This means that the power supply to all the LEDs will
be via one common pin. But don’t we need to control each of these LEDs separately to display
different characters.Thus the individual control comes from the free multiple cathode pins. To
switch on any of the eight LEDs, its cathode pin needs to be grounded. And since the LEDs retain
their individual cathode pins, we can use them to control them.All you need to remember is this: To
light up a common anode seven-segment display, you have to ground/write a LOW output on the
pins that need to be lit up

https://github.com/Jeganvjk/Interfacing-Seven-Segment-Display 2/7
6/12/23, 12:40 AM Jeganvjk/Interfacing-Seven-Segment-Display

What is the common cathode seven-segment display?


This type is just a reverse design of the common anode type. In a common cathode seven-segment
display, all of the cathode pins are connected to a common ground (GND). Thus the individual
control comes from the free multiple anode pins. To switch on any of the eight LEDs, its anode pin
needs to be given power.All you need to remember is this: To light up a common cathode seven-
segment display, you have to write a HIGH output on the pins that need to be lit up

Working principle of the seven-segment display


The LED segments are selected based on the decimal number. For example, if we want to display
the number 8, we should select all of the LEDs a, b, c, d, e, f, g.You can turn on the needed LED
segments, depending on the number or alphabet you wish to display. You can select the LED
segments according to the table shown below. To display any character from the table below, you
just need to send the corresponding hex codes to the right pins.

https://github.com/Jeganvjk/Interfacing-Seven-Segment-Display 3/7
6/12/23, 12:40 AM Jeganvjk/Interfacing-Seven-Segment-Display

https://github.com/Jeganvjk/Interfacing-Seven-Segment-Display 4/7
6/12/23, 12:40 AM Jeganvjk/Interfacing-Seven-Segment-Display

PROGRAM:
int cnt=0;
int incPrev, decPrev;
void setup()
{
pinMode(0, INPUT);
pinMode(3, INPUT);
pinMode(5, INPUT);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
}
void loop()
{
int inc = digitalRead(3);
int dec = digitalRead(5);
int res = digitalRead(0);
{
switch (cnt)
{
case 0://when count value is zero show”0” on disp
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
break;
case 1:// when count value is 1 show”1” on disp
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
break;
case 2:// when count value is 2 show”2” on disp
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
https://github.com/Jeganvjk/Interfacing-Seven-Segment-Display 5/7
6/12/23, 12:40 AM Jeganvjk/Interfacing-Seven-Segment-Display

digitalWrite(11, LOW);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, LOW);
digitalWrite(7, HIGH);
digitalWrite(6, LOW);
break;
case 3:// when count value is 3 show”3” on disp
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, HIGH);
digitalWrite(6, LOW);
break;
case 4:// when count value is 4 show”4” on disp
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
digitalWrite(6, LOW);
break;
}
}
if((inc == HIGH)&& (cnt < 3))
{
delay(1000);
cnt++;
switch (cnt);
}
if((dec == HIGH) && (cnt > 0))
{
delay(1000);
cnt--;
switch (cnt);
}
if ((res == HIGH)&& (cnt > 0))
{
delay(1000);
cnt=0;
switch (cnt);
}
}

https://github.com/Jeganvjk/Interfacing-Seven-Segment-Display 6/7
6/12/23, 12:40 AM Jeganvjk/Interfacing-Seven-Segment-Display

CIRCUIT DIAGRAM:

OUTPUT:

RESULT:
Thus the characters and numbers are displayed in the seven segment display using Arduino UNO
controller

https://github.com/Jeganvjk/Interfacing-Seven-Segment-Display 7/7

You might also like