Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Practica 7- Instrucción
• Muestra de diferentes números en cada digito de 7 segmentos provenientes de un contador
cada uno. Con los PB btnL, btnU, btnC, btnD, se incrementa la cuenta manual cada vez que le
oprime manualmente dichos botones . Y Se muestran una cuenta hexadecimal (del 0 al F)
3
E3
8
ARCHIVO VHDL
A
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 17.02.2019 16:36:17
-- Design Name:
-- Module Name: ejemplo7 - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
MIELOAP03
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ejemplo7 is
Port ( clk : in STD_LOGIC;
btnL : in STD_LOGIC;
btnU : in STD_LOGIC;
btnC : in STD_LOGIC;
btnD : in STD_LOGIC;
an : inout STD_LOGIC_VECTOR (3 downto 0);
seg : out STD_LOGIC_VECTOR (6 downto 0));
end ejemplo7;
begin
PROCESS(clk)
BEGIN
IF(clk'EVENT and clk = '1') THEN
flipflops0(0) <= btnL;
flipflops0(1) <= flipflops0(0);
If(counter_set0 = '1') THEN --Reinicie el contador porque la entrada está
cambiando
counter_out0 <= (OTHERS => '0');
ELSIF(counter_out0(19) = '0') THEN --El tiempo de entrada de la tabla aún no se ha
cumplido.
counter_out0 <= counter_out0 + 1;
ELSE --tiempo de entrada estable se cumple
result0 <= flipflops0(1);
END IF;
END IF;
END PROCESS;
process(result0)
begin
if result0='1' and result0'event then
count_int0<= count_int0 + 1;
end if;
end process;
PROCESS(clk)
BEGIN
IF(clk'EVENT and clk = '1') THEN
flipflops1(0) <= btnU;
flipflops1(1) <= flipflops1(0);
If(counter_set1 = '1') THEN --Reiniciar el contador porque la entrada está
cambiando
counter_out1 <= (OTHERS => '0');
ELSIF(counter_out1(19) = '0') THEN --tiempo de entrada estable aún no se cumple
counter_out1 <= counter_out1 + 1;
ELSE --tiempo de entrada estable se cumple
result1 <= flipflops1(1);
END IF;
END IF;
END PROCESS;
process(result1)
begin
if result1='1' and result1'event then
count_int1<= count_int1 + 1;
end if;
end process;
PROCESS(clk)
BEGIN
IF(clk'EVENT and clk = '1') THEN
flipflops2(0) <= btnC;
flipflops2(1) <= flipflops2(0);
If(counter_set2 = '1') THEN --Reiniciar el contador porque la entrada está
cambiando
counter_out2 <= (OTHERS => '0');
ELSIF(counter_out2(19) = '0') THEN --tiempo de entrada estable aún no se cumple
counter_out2 <= counter_out2 + 1;
ELSE --tiempo de entrada estable se cumple
result2 <= flipflops2(1);
END IF;
MIELOAP03
END IF;
END PROCESS;
process(result2)
begin
if result2='1' and result2'event then
count_int2<= count_int2 + 1;
end if;
end process;
PROCESS(clk)
BEGIN
IF(clk'EVENT and clk = '1') THEN
flipflops3(0) <= btnD;
flipflops3(1) <= flipflops3(0);
If(counter_set3 = '1') THEN --Reiniciar el contador porque la entrada está
cambiando
counter_out3 <= (OTHERS => '0');
ELSIF(counter_out3(19) = '0') THEN --tiempo de entrada estable aún no se cumple
counter_out3 <= counter_out3 + 1;
ELSE --tiempo de entrada estable se cumple
result3 <= flipflops3(1);
END IF;
END IF;
END PROCESS;
process(result3)
begin
if result3='1' and result3'event then
count_int3<= count_int3 + 1;
end if;
end process;
process (clk)
begin
if clk='1' and clk'event then
divisor <= divisor + 1;
if divisor>= "10111110101111000010000000" then
divisor<="00000000000000000000000000";
one<= not one;
end if;
end if;
end process;
process (divisor(10))
MIELOAP03
begin
if divisor(10)='1' and divisor(10)'event then
case a is
when "0111" => b <= "1011";
when "1011" => b <= "1101";
when "1101" => b <= "1110";
when "1110" => b <= "0111";
when others => b <= "0111";
end case;
an<=b;
a<=b;
end if;
end process;
end Behavioral;
ARCHIVO CONSTRS
# Clock signal
set_property PACKAGE_PIN W5 [get_ports clk]
set_property IOSTANDARD LVCMOS33 [get_ports clk]
create_clock -add -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports
clk]
#7 segment display
set_property PACKAGE_PIN W7 [get_ports {seg[0]}]
set_property IOSTANDARD LVCMOS33 [get_ports {seg[0]}]
set_property PACKAGE_PIN W6 [get_ports {seg[1]}]
set_property IOSTANDARD LVCMOS33 [get_ports {seg[1]}]
set_property PACKAGE_PIN U8 [get_ports {seg[2]}]
set_property IOSTANDARD LVCMOS33 [get_ports {seg[2]}]
set_property PACKAGE_PIN V8 [get_ports {seg[3]}]
set_property IOSTANDARD LVCMOS33 [get_ports {seg[3]}]
set_property PACKAGE_PIN U5 [get_ports {seg[4]}]
set_property IOSTANDARD LVCMOS33 [get_ports {seg[4]}]
set_property PACKAGE_PIN V5 [get_ports {seg[5]}]
set_property IOSTANDARD LVCMOS33 [get_ports {seg[5]}]
set_property PACKAGE_PIN U7 [get_ports {seg[6]}]
set_property IOSTANDARD LVCMOS33 [get_ports {seg[6]}]
#Buttons
set_property PACKAGE_PIN U18 [get_ports btnC]
set_property IOSTANDARD LVCMOS33 [get_ports btnC]
set_property PACKAGE_PIN T18 [get_ports btnU]
set_property IOSTANDARD LVCMOS33 [get_ports btnU]
set_property PACKAGE_PIN W19 [get_ports btnL]
set_property IOSTANDARD LVCMOS33 [get_ports btnL]
OBSERVACIONES:
Cada vez que se oprime el botón btnL aumenta un digito de displey de 7 segmentos
0 1 23 4 5 6 7 8 9 A B C D E F; así respectivamente. btnU, btnC, btnD.
538b
MIELOAP03
538C