library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Multimetro is port(
clk: in std_logic;
tst: inout std_logic_vector (3 downto 0);
display: out std_logic_vector (7 downto 0):="00000000";
leds, anodos: out std_logic_vector (3 downto 0):="0000");
end Multimetro;
architecture Behavioral of Multimetro is
signal barrido: std_logic_vector (1 downto 0):="00";
signal anodo: std_logic_vector (3 downto 0):="0000";
signal contador: std_logic_vector (3 downto 0):="0000";
signal disp,disp1,disp2,disp3: std_logic_vector (7 downto 0):="00000010";
signal x,y,z,w: std_logic_vector (3 downto 0):="0000";
begin
process(clk)
begin
if(clk'event and clk='1') then
barrido<=barrido+'1';
if contador contador<=contador+'1';
elsif contador>tst then
contador<="0000";
x<="0000";
y<="0000";
z<="0000";
w<="0000";
else
leds<=not(contador);
end if;
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if w="1010" then
w<="0000";
end if;
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
case barrido is
when "00" => display<=disp;
anodos<="1110";
when "01" => display<=disp1;
anodos<="1101";
when "10" => display<=disp2;
anodos<="1011";
when others => display<=disp3;
anodos<="0111";
end case;
end if;
end process;
end Behavioral;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Multimetro is port(
clk: in std_logic;
tst: inout std_logic_vector (3 downto 0);
display: out std_logic_vector (7 downto 0):="00000000";
leds, anodos: out std_logic_vector (3 downto 0):="0000");
end Multimetro;
architecture Behavioral of Multimetro is
signal barrido: std_logic_vector (1 downto 0):="00";
signal anodo: std_logic_vector (3 downto 0):="0000";
signal contador: std_logic_vector (3 downto 0):="0000";
signal disp,disp1,disp2,disp3: std_logic_vector (7 downto 0):="00000010";
signal x,y,z,w: std_logic_vector (3 downto 0):="0000";
begin
process(clk)
begin
if(clk'event and clk='1') then
barrido<=barrido+'1';
if contador
elsif contador>tst then
contador<="0000";
x<="0000";
y<="0000";
z<="0000";
w<="0000";
else
leds<=not(contador);
end if;
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if w="1010" then
w<="0000";
end if;
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
case barrido is
when "00" => display<=disp;
anodos<="1110";
when "01" => display<=disp1;
anodos<="1101";
when "10" => display<=disp2;
anodos<="1011";
when others => display<=disp3;
anodos<="0111";
end case;
end if;
end process;
end Behavioral;
Comments