LaDissertation.com - Dissertations, fiches de lectures, exemples du BAC
Recherche

VHDL

TD : VHDL. Recherche parmi 298 000+ dissertations

Par   •  4 Décembre 2016  •  TD  •  2 017 Mots (9 Pages)  •  621 Vues

Page 1 sur 9

library ieee;

use ieee.std_logic_1164.all;

entity COMPTEUR is

                port ( CLOCK : in std_logic;

                LED : buffer std_logic;

                SW : in std_logic;

                S : out std_logic_vector(6 downto 0));

                

end COMPTEUR;

architecture COMPORT of COMPTEUR is

begin

                

        process (CLOCK, SW)

        variable compteur : integer := 0;

        variable CptDigit0: integer :=0 ;

        variable choixfreq : integer :=0;

        constant freq1 : integer := 12000000;

        constant freq2 : integer := 4000000;

                begin

                        

                        if SW='0' then choixfreq := freq1;

                                else

                                choixfreq := freq2;

                        end if;

                                

                                

                        if rising_edge(CLOCK) then

                                        compteur := compteur+1;

                                        

                                if compteur >= choixfreq then

                                        

                                                compteur := 0;

                                                LED<=not LED;

                                                

                                                        case CptDigit0 is

                

                                                        when 0 => S <= "1000000";

                                                        when 1 => S <= "1111001";

                                                        when 2 => S <= "0100100";

                                                        when 3 => S <= "0110000";

                                                        when 4 => S <= "0011001";

                                                        when 5 => S <= "0010010";

                                                        when 6 => S <= "0000010";

                                                        when 7 => S <= "1111000";

                                                        when 8 => S <= "0000000";

                                                        when others => S <= "0010000";

...

Télécharger au format  txt (2.9 Kb)   pdf (38.7 Kb)   docx (7.9 Kb)  
Voir 8 pages de plus »
Uniquement disponible sur LaDissertation.com