Teclado matricial

 En esta clase se trabajo en el teclado matricial 

Como nos mostraba la pagina web, nos muestra la librería a utilizar y también la manera en que esta compuesto un teclado matricial y como podemos configurarlo.

En nuestro código en VHDL se tiene que hacer la instancia de la librería en el TOP de nuestro diseño, por ejemplo:

 

entity TOP_DIS is
PORT( CLK : in std_logic;
COLUMNAS : in std_logic_vector(3 downto 0);
FILAS : out std_logic_vector(3 downto 0);
TRANSISTOR : out std_logic_vector(3 downto 0);
DISPLAY : out std_logic_vector(7 downto 0)
);
end TOP_DIS;
architecture behavioral of TOP_DIS is
component LIB_TEC_MATRICIAL_4X4_INTESC_REVA is
generic( FREQ_CLK : integer := 50_000_000
);
port( CLK : in std_logic;
COLUMNAS : in std_logic_vector(3 downto 0);
FILAS : out std_logic_vector(3 downto 0);
BOTON_PRES : out std_logic_vector(3 downto 0);
IND : out std_logic
);
end component LIB_TEC_MATRICIAL_4X4_INTESC_REVA;
signal boton_pres : std_logic_vector(3 downto 0) := (others => '0');
signal ind : std_logic := '0';
begin
u1 : LIB_TEC_MATRICIAL_4X4_INTESC_REVA
generic map( FREQ_CLK => 50_000_000
)
port map( CLK => CLK,
COLUMNAS => COLUMNAS,
FILAS => FILAS,
BOTON_PRES => boton_pres,
IND => ind
);

 

Un ejemplo de cómo utilizar la librería es crear un contador el cual se incrementará sólo si se presiona la tecla “*”, el código quedaría de la siguiente manera:

 

process(CLK)
begin
if rising_edge(CLK) then
if ind = '1' and boton_pres = x"E" then
conta_tecla <= conta_tecla + 1;
if conta_tecla = 10 then
conta_tecla <= 0;
end if;
end if;
end if;
end process;

Comentarios

Entradas populares de este blog

Dispositivos Digitales Programables Pal y Gal

Arquitectura de los DSP y sus módulos embebidos

Bloques funcionales en PLD