Sunteți pe pagina 1din 4

VHDL code for BCD to 7-segment display converter

PRANIL KADAM 28

SWATI KADAM 29

FARAZ KHAN 32

SHUDDHODHAN KEDARE 63

Introduction

A 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 a 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. A 7 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 8th 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.

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.
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 (

clk : in std_logic;

bcd : in std_logic_vector(3 downto 0);

segment7 : out std_logic_vector(6 downto 0)

decoded output.

);

end test;

architecture Behavioral of test is

begin

process (clk,bcd)

BEGIN

if (clk'event and clk='1') then

case bcd is
when "0000"=> segment7 <="0000001";

when "0001"=> segment7 <="1001111";

when "0010"=> segment7 <="0010010";

when "0011"=> segment7 <="0000110";

when "0100"=> segment7 <="1001100";

when "0101"=> segment7 <="0100100";

when "0110"=> segment7 <="0100000";

when "0111"=> segment7 <="0001111";

when "1000"=> segment7 <="0000000";

when "1001"=> segment7 <="0000100";

when others=> segment7 <="1111111";

end case;

end if;

end process;

end Behavioral;

Applications of Display Decoder Circuit:

1. 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. It can be used as a timer circuit.

Conclusion

Thus we have study the working of BCD to 7-segment display converter Using vhdl
code.

S-ar putea să vă placă și