VHDL code for BCD to 7-segment display converter
PRANIL KADAM 28
‘SWAT! KADAM 29
FARAZ KHAN 32
SHUDDHODHAN KEDARE 63
Introduction
AA display decoder is used to convert a BCD or a binary code into a 7 segment code used to
operate a 7 segment LED display. It generally has 4 input lines and 7 output lines. Here we
design a simple display decoder circuit using logic gates. Even though commercial BCD to 7
segment decoders are available, designing a display decoder using logic gates may prove to be
beneficial from economical as well as knowledge point of view.
Principle
The basic idea involves driving a common cathode 7-segment LED display using combinational
logic circuit. The logic circuit is designed with 4 inputs and 7 outputs, each representing an
input to the display IC. Using Karnough’s map, logic circuitry for each input to the display is
designed.
Theory
The first and foremost aspect of this circuit is decoder. A decoder is a combinational circuit
Which is used to convert a binary or BCD (Binary Coded Decimal) number to the corresponding
decimal number. It can be a simple binary to decimal decoder or a BCD to 7 segment
decoder.Another relevant section is the combinational logic circuitry. A combinational logic
circuit is @ system of logic gates consisting of only outputs and inputs. The output of a
combinational logic circuit depends only on the present state of the inputs and nothing else.
Best examples of such circuits are Encoders and Decoders, Multiplexers and De-multiplexers,Adders, Subtractors etc. To understand the design and operation of these logic circuits, one
needs to have a good knowledge about Boolean algebra and logic gates. For example few
basic Boolean algebra rules to be followed are the complementary law, associative law, De-
Morgan's law etc. The De-Morgan’s law states how ‘AND’ of two NOTs can be converted to a
single NOR. In other words, (NOT A) AND (NOT B) can be changed to A NOR B. A7 segment
LED display consists of an arrangement of 8 LEDs such that either all the anodes are common
or cathodes are common. A common cathode 7 segment display consists of 8 pins — 7 input
pins labeled from ‘a! to ‘g’ and 8" pin as common ground pin. Practically BCD to 7 segment
decoders are available in form of integrated circuits such as 74LS47. Apart from regular 4 input
pins and 7 output pins, it consists of a lamping test pin used for segment testing, ripple blanking
input pin used to blank off zeros in multiple display systems, ripple blanking output pin used for
cascading purposes and a blanking input pin.
a a a
Do——-_D b b =,
co— Cc c c |: |:
dq Vat
Bo——B e e
Ao A f rt.f
—"
clock 9 §
BCD to 7 Segment 7-Segment
Decoder LED Display
Display Decoder Circuit Operation:
The circuit operation can be understood through the truth table itself. When all the switches are
connected such that each input is grounded, the output of the combinational logic circuit would
be so as to drive all the output LEDs except ‘g’ to conduction. Thus the number 0 will be
displayed. Similar operation would take place for all other combinations of the input switches.Digit
Na
Shown
=
4
4S6
IBD :
VHDL code
library IEEE;
use IEEE. STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH ALL;
use IEEE. STD_LOGIC_UNSIGNED ALL;
entity test is
port (
kk = in std_logic;
bod : in std_logic_vector(3 downto 0);
segment? : out std_logic_vector(6 downto 0)
decoded output.
)
end test;
architecture Behavioral of test is
begin
process (clk,bed)
BEGIN
if (clk’event and cl
") then
case bed is
Illuminated Segment (1 = illumination)
ab ¢ de £ g
HHHH HORROR
HHHOORHHEH
HEHE HHHOOR
HHOKHORKOK
OHOKOOOKOH
HHORHHOOOH
HHOKHEHHOOwhen "0000"=> segment7 <="0000001";
when "000°
segment7 <="1001111";
when "0011
segment? <="0010010";
when "001
segment7 <="0000110",
when "0100"=> segment7 <="1001100";
when "010
segment7 <="0100100";
when "011
segment7 <="0100000",
when "011
segment? <="0001111";
when "100
segment7 <="0000000",
when "1001"=> segment7 <="0000100";
when others=> segment? <="1111111",
end case;
end if
end process:
end Behavioral;
Applications of Display Decoder Circuit:
41. This circuit can be modified using timers and counters to display the number of clock
pulses
2. This circuit can be modified to develop an alphabet display system instead of a decimal
number display system
3. Itcan be used as a timer circuit
Conclusion
Thus we have study the working of BCD to 7-segment display converter Using vhdl
code.