2015 - M. Schwartz, O. Manickum - Programming Arduino With LabVIEW
2015 - M. Schwartz, O. Manickum - Programming Arduino With LabVIEW
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity caja_fuerte is
Port (
clk : in STD_LOGIC;
filas : in STD_LOGIC_VECTOR (3 downto 0);
columnas : out STD_LOGIC_VECTOR (3 downto 0);
reset : in STD_LOGIC;
display : out STD_LOGIC_VECTOR(7 downto 0);
seg : out STD_LOGIC_VECTOR(6 downto 0; );
end caja_fuerte;
begin
-- asignaciones de inicio
display <= "11111110";
col<=scol;
multi<= U4*nfila;
--registro de estado
process(clk,reset)
begin
if(reset='1') then
presente<=reposo;
--Camino de datos
process(clk,presente,tecla,scol,fila)
begin
case presente is
when reposo=>
scol<='1111';
contador<= U0L;
when inicio=>
scol<="0111";
when cuenta=>
contador<= contador+1;
when rotacion=>
scol<= scol(2 downto 0) & scol(3);
contador<= U0L;
when DfilaCol=>
case fila is
when "0111"=> nfila <= U0;
when "1011"=> nfila <= U1;
when "1101"=> nfila <= U2;
when "1110"=> nfila <= U3;
when others=> nfila <= U0;
end case;
case scol is
when "1110"=> scol4 <= U0;
when "1101"=> scol4 <= U1;
when "1010"=> scol4 <= U2;
when "0111"=> scol4 <= U3;
when others=> scol4 <= U0;
end case;
when Dtecla=>
if fila(3)='0' then
tecla<=U0;
else
tecla<= sol4+multi(3 downto 0);
end if;
when mostrar=>
case tecla is
process (presente,fila,contador) is
begin
case presente is
when reposo=>futuro<=inicio;
when inicio=>futuro<=cuenta;
when cuenta=>
if contador="111111111" then
futuro<= rotacion;
else
futuro<=cuenta;
end if;
when rotacion=>
if(fila="1111") then
futuro<=cuenta;
else
futuro<=DfilaCol;
end if;
when DfilaCol=>
futuro <= Dtecla;
when Dtecla=>
futuro <= mostrar;
when mostrar=>
futuro <= rotacion;
end case;
end process;
end caja_fuerte;