Skip to main content

Cronometro (codigo) vhdl

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity cronometro is
    Port ( display : out  STD_LOGIC_VECTOR (7 downto 0);
           clk, reset, enc : in  STD_LOGIC;
           An  : out  STD_LOGIC_VECTOR (3 downto 0));
end cronometro;

architecture Behavioral of cronometro is
signal contador: std_logic_vector  (3 downto 0) :="0000";
signal segundos: std_logic_vector  (13 downto 0) :="00000000000000";
signal contador1: std_logic_vector  (3 downto 0) :="0000";
signal DecSeg: std_logic_vector  (9 downto 0) :="0000000000";
signal contador2: std_logic_vector  (3 downto 0) :="0000";
signal CentSeg: std_logic_vector  (7 downto 0) :="00000000";
signal Anodos: std_logic_vector (1 downto 0 ):="00";

begin
Process (clk, reset, contador, segundos)
begin
if (clk'event and clk = '1') then
if reset= '0' then
contador <="0000";
segundos <="00000000000000";
contador1 <="0000";
DecSeg   <="0000000000";
else
Anodos <= Anodos + 1 ;
if Anodos="11" then
Anodos<= "00";
end if;
case Anodos is
when "00"=> if segundos = "10011100010000" then
contador <= contador + 1 ;
segundos <= "00000000000000";
if contador = "1001" then
contador <= "0000";
end if;
else
segundos <= segundos + 1;
end if;
An <= "1011";
case contador is
when "0000" => display  <= "00000010";
when "0001" => display  <= "10011110";
when "0010" => display  <= "00100100";
when "0011" => display  <= "00001100";
when "0100" => display  <= "10011000";
when "0101" => display  <= "01001000";
when "0110" => display  <= "01000000";
when "0111" => display  <= "00011110";
when "1000" => display  <= "00000000";
when others => display  <= "00011000";
end case;
when "01"=> if CentSeg = "00111000" then
contador2 <= contador2 + 1 ;
CentSeg <= "00000000";
if contador2 = "1001" then
contador2 <= "0000";
end if;
else
CentSeg <= CentSeg + 1;
end if;
An <= "1110";
case contador2 is
when "0000" => display  <= "00000010";
when "0001" => display  <= "10011110";
when "0010" => display  <= "00100100";
when "0011" => display  <= "00001100";
when "0100" => display  <= "10011000";
when "0101" => display  <= "01001000";
when "0110" => display  <= "01000000";
when "0111" => display  <= "00011110";
when "1000" => display  <= "00000000";
when others => display  <= "00011000";
end case;
when others=> if DecSeg = "1111101000" then
contador1 <= contador1 + 1 ;
DecSeg <= "0000000000";
if contador1 = "1001" then
contador1 <= "0000";
end if;
else
DecSeg <= DecSeg + 1;
end if;
An <= "1101";
case contador1 is
when "0000" => display  <= "00000010";
when "0001" => display  <= "10011110";
when "0010" => display  <= "00100100";
when "0011" => display  <= "00001100";
when "0100" => display  <= "10011000";
when "0101" => display  <= "01001000";
when "0110" => display  <= "01000000";
when "0111" => display  <= "00011110";
when "1000" => display  <= "00000000";
when others => display  <= "00011000";
end case;
end case;
end if;
end if;
end process;
end Behavioral;

Comments

Popular posts from this blog

ALU ( arithmetic logic unit ) vhdl codigo

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity operaciones is port( clk: in std_logic; switch1,switch2,push1,push2: inout std_logic; display: out std_logic_vector (7 downto 0):="00000000"; leds, anodos: out std_logic_vector (3 downto 0):="0000"); end operaciones; architecture Behavioral of operaciones is signal barrido,bleds,modo: std_logic_vector (1 downto 0):="00"; signal break,break2: std_logic :='0'; signal mode,anod: std_logic_vector (3 downto 0):="0000"; signal contador: std_logic_vector (9 downto 0):="0000000000"; signal disp,disp1,disp2,disp3: std_logic_vector (7 downto 0):="00000010"; signal x,y,z,w: std_logic_vector (3 downto 0):="0000"; signal x2,y2,z2,w2: std_logic_vector (3 downto 0):="0000"; signal matr: std_logic_vector (3 downto 0):="0000"; signal dispa,disp1a,disp2a,disp3...

Adobe Flash Player ( Standalone ) Installer

para descargar los instaladores Offline de Adobe Flash Player nos debemos dirigir a la siguiente direccion: https://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-windows.html donde podemos encontrar para Internet Explorer, serian los dos primeros, si queremos que sean para Chrome, Firefox, etc... seleccionamos el Adobe Flash Player Plug in. Internet Explorer EXE Firefox NPAPI EXE Opera, Chrome PPAPI EXE

Multiplexor ( codigo ) vhdl

library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity Multiplexor is     Port ( a : in  STD_LOGIC;            b : in  STD_LOGIC;            c : in  STD_LOGIC;            d : in  STD_LOGIC;            sel : in  STD_LOGIC_VECTOR (1 downto 0);            x : inout  STD_LOGIC); end Multiplexor; architecture Behavioral of Multiplexor is signal g:std_logic; begin process (a,b,c,d,sel) begin if sel = "00" then x<=a; elsif sel = "01" then x<=b; elsif sel = "10" then x<=c; else x<=d; end if; end process; end Behavioral;