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

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

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

Voltimetro en VHDL

library IEEE; use IEEE.std_logic_1164.all; library work; use work.Estructuras_de_Datos.all; entity Voltimetro is         port (  clock: in std_logic;                         d : in std_logic;                         not_q: out std_logic;                                                  hs,vs: out std_logic;                         r,g,b: out std_logic                                                                      );           ...