Search This Blog

Saturday, July 20, 2013

Design of BCD to 7 Segment Driver for Common Anode display using if -else (VHDL Code).





Design of BCD to 7 Segment Driver for Common Anode Display using if-else statements (Behavior Modeling Style).



Ouptut Waveform :   BCD to 7 Segment Driver for Common Anode display


VHDL Code-


-------------------------------------------------------------------------------
--
-- Title       : bcd_to_7seg
-- Design      : vhdl_upload 1
-- Author      : Naresh Singh Dobal
-- Company     : nsd
-- VHDL Tutorials & exercise by Naresh Singh Dobal
--
-------------------------------------------------------------------------------
--
-- File        : BCD to 7 segment driver for common anode display using if-else statements.vhd

   

library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity bcd_to_7seg is
     port(
         bcd : in STD_LOGIC_VECTOR(3 downto 0);
         seg7 : out STD_LOGIC_VECTOR(6 downto 0)
         );
end bcd_to_7seg;


architecture bcd_to_7seg_arc of bcd_to_7seg is
begin

    segment7 : process (bcd) is
    begin
        if (bcd="0000") then
            seg7 <= "0000001";
        elsif (bcd="0001") then
            seg7 <= "1001111";
        elsif (bcd="0010") then
            seg7 <= "0010010";
        elsif (bcd="0011") then
            seg7 <= "0000110";
        elsif (bcd="0100") then
            seg7 <= "1001100";
        elsif (bcd="0101") then
            seg7 <= "0100100";
        elsif (bcd="0110") then
            seg7 <= "1100000";
        elsif (bcd="0111") then
            seg7 <= "0001111";
        elsif (bcd="1000") then
            seg7 <= "0000000";
        elsif (bcd="1001") then
            seg7 <= "0001100";
        else
            seg7 <= "1111111";
        end if;
    end process segment7;

end bcd_to_7seg_arc;

No comments:

Post a Comment