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

boleta, cliente, nombre en Java

import java.util.ArrayList; public class Cliente { private String nombre; private ArrayList boletas; public Cliente(String nombre) { this.nombre = nombre; this.boletas = new ArrayList(); } public String getNombre() { return this.nombre; } public void agregarBoleta(Boleta boleta) { boletas.add(boleta); } public void imprimirHistorial() { Boleta b; System.out.println("Nombre: " + nombre); for (int i=0; i b = (Boleta)boletas.get(i); b.imprimir(); } } } public class Articulo { private String descripcion; private int stock; private int precio; public Articulo(String descripcion,int stock,int precio){ this.descripcion = descripcion; this.stock = stock; this.precio = precio; } public String getDescripcion() { return this.descripcion; } public int getStock() { return this.stock; } public int getPrecio() { return this.precio; } } import java.util.ArrayList; public class Boleta { private String fecha; private int total; private ArrayList ar...

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...