Está en la página 1de 2

1.

Parpadeo de led cada segundo resuelto


2. Conteo de 3 leds propuesto
3. Reloj de minutos y segundos resuelto
4. Mostrar la palabra: Stop propuesto
5. Conteo de 0 a 2 en la matrix de 8x8 resuelto

Solucin 1:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;

entity led is
port ( clk: in std_logic;
blink: buffer std_logic);
end led;

architecture solucion of led is


signal cuenta: std_logic_vector(24 downto 0);
begin
process(clk)
begin
if rising_edge(clk) then
cuenta <= cuenta + 1;
if cuenta = 25000000 then
cuenta <= (others=>'0');
blink <= not blink;
end if;
end if;
end process;
end solucion;

Solucin 2:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity contador_3 is
port( clk: in std_logic;
q: buffer std_logic_vector(2 downto 0));
end contador_3;

architecture solucion of contador_3 is


signal cuenta: std_logic_vector(24 downto 0);
begin
process(clk)
begin
if rising_edge(clk) then
cuenta <= cuenta + 1;
if cuenta = 24000000 then
cuenta <= (others=>'0');
q <= q + 1;
end if;
end if;
end process;
end solucion;
Solucin 3:
entity min_seg is
port ( clk: in std_logic;
display: out std_logic_vector(7 downto 0);
trans: out std_logic_vector(3 downto 0));
end min_seg;
architecture solucion of min_seg is
-- En 5ms hay 240038 pulsos de 20.83ns (1/40MHz)
signal cuenta: std_logic_vector(17 downto 0);
signal segundos: std_logic_vector(25 downto 0);
signal sel: std_logic_vector (1 downto 0);
signal segmentos: std_logic_vector (3 downto 0);
signal unid_seg, dec_seg, unid_min, dec_min: std_logic_vector(3 downto 0);
begin
process(clk)
begin
if rising_edge(clk) then
cuenta <= cuenta + 1;
if cuenta = 240038 then
cuenta <=(others=>'0');
sel <= sel + 1;
end if;
end if;
end process;
with sel select trans <= "1110" when "00",
"1101" when "01",
"1011" when "10",
"0111" when others;

--abcdefgp
with segmentos select display <= "00000011" when "0000",
"10011111" when "0001",
"00100101" when "0010",
"00001101" when "0011",
"10011001" when "0100",
"01001001" when "0101",
"11000001" when "0110",
"00011111" when "0111",
"00000001" when "1000",
"00011001" when "1001",
"11111111" when others;

with sel select segmentos <= unid_seg when "00",


dec_seg when "01",
unid_min when "10",
dec_min when others;

process(clk)
begin
if rising_edge(clk) then
segundos <= segundos + 1;
if segundos = 48000000 then
segundos <= (others=>'0');
unid_seg <= unid_seg + 1;
if unid_seg = 9 then
unid_seg <= "0000";
dec_seg <= dec_seg + 1;
if dec_seg = 5 then
dec_seg <= "0000";
unid_min <= unid_min + 1;
if unid_min = 9 then
unid_min <= "0000";
dec_min <= dec_min + 1;
if dec_min = 5 then
dec_min <= "0000";
end if;
end if;
end if;
end if;
end if;
end if;
end process;
end solucion;

También podría gustarte