Skip to main content

Multimetro ( codigo ) vhdl

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;

Comments

Popular posts from this blog

Llamar a 1 800 en USA desde Mexico

Cómo llamar números gratis en USA [toll free] desde México Ok, resulta que alguna vez los números gratis, se llamaban números 1- 800 (01-800 desde México). Pero lo malo de los números es que se acaban, Sobre todo en USA que les encanta vender todo. Ahora los Números gratis pueden ser 1 - 800, 1 - 877, 1 - 866 Para los americanos es cuestion de acostumbrarse, pero para nosotros los usuarios de telmex ¿cómo le hacemos si queremos marcar? Pues en primera pagando, los números gratis en USA usualmente no son gratis desde otros paises. Y en segunda, marcando correctamente. Muchos ya se saben el de los 800, es nada mas cuestion de cambiar el 01 - 800 por 001 - 881, pero y los 1 - 866 ? y los 1 - 877 ? Ahhh pues en mi otro blog ya tenía una entrada con una tablita que lo explica: Si el numero comienza con 1 888 se marca: 001 881 Si el numero comienza con 1 877 se marca: 001 882 Si el numero comienza con 1 866 se marca: 001 883 ¿Por qué? No tengo la más mínima idea, supongo que

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

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 contad