Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

EXPT No 5 : Seven Segment Display Interface

Write a Verilog code display BCD numbers on 7 Segment Display giving BCD inputs from Dip
switches

Seven segment displays are an arrangement of LEDs that simply accept a digital input to display a
digit from 0 to 9. The digits are made up of seven individually illuminated slots to display the digits.
The display can also illuminate a decimal point. Seven segment displays are one of the oldest electronic
methods for displaying numeric information but also one of the simplest.
There are two types of seven segment displays, common cathode and common anode displays. In a
common cathode display, the cathodes of the LEDs are joined together and the individual segments
illuminated by HIGH voltages [ 1 for ON and 0 for OFF]. In a common anode display, the anodes of
R A G H U N A T H

the LEDs are joined together and the individual segments illuminated by LOW voltages [ 0 for ON
and 1 for OFF]. In this project, common cathode seven segment displays were used, with the joined
cathode connected to ground
Ra
gh
un
a th

1 – Segment OFF 0 – Segment OFF


De

0- Segment ON 1- Segment ON
p t
of
EC
E
R A G H U N A T H

in College Kit, common Cathode is used

module sevseg(
input [3:0] bcd,
output reg[6:0] segments
);
always @(*)
Ra

begin
case(bcd)
gh

0: segments = 7'b1111110; // "0"


un

1: segments = 7'b0110000; // "1"


2: segments = 7'b1101101; // "2"
a

3: segments = 7'b1111001; // "3"


th

4: segments = 7'b0110011; // "4"


5: segments = 7'b1011011; // "5"
6: segments = 7'b1011111; // "6"
7: segments = 7'b1110000; // "7"
De

8: segments = 7'b1111111; // "8"


p

9: segments = 7'b1111011; // "9"


t

default: segments = 7'b0000000; // "all segments off"


endcase
of

end
endmodule
EC
E
UCF file

net "bcd[3]" loc= p80;


net "bcd[2]" loc= p81;
net "bcd[1]" loc= p82;
net "bcd[0]" loc= p84;
net "segments[6]" loc = p1;
net "segments[5]" loc = p12;
net "segments[4]" loc = p14;
net "segments[3]" loc = p15;
net "segments[2]" loc = p17;
net "segments[1]" loc = p21;
R A G H U N A T H

net "segments[0]" loc = p22;


Ra
gh
un
a
th

De
p
t
of
EC
E

You might also like