Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

Instituto Politécnico Nacional

Unidad Profesional Interdisciplinaria del Estado de Hidalgo

Unidad de Aprendizaje: Dispositivos Lógicos Programables

Catedrático: Dr. Eduardo Ramos Díaz

Actividad: Práctica 5

Alumno: Michell Alejandro López Sierra

Semestre: 6to Grupo: 2MM5


Circuito Diseñado
Botones y LEDs

Decodificador de Botones
Multiplexor

Decodificador BCD a 7 Segmentos


Código VHDL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using


-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating


-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity VELOCIMETRO is
Port ( BUTTON1 : in STD_LOGIC;
BUTTON2 : in STD_LOGIC;
BUTTON3 : in STD_LOGIC;
BUTTON4 : in STD_LOGIC;
BUTTON5 : in STD_LOGIC;
BUTTON6 : in STD_LOGIC;
BUTTON7 : in STD_LOGIC;
BUTTON8 : in STD_LOGIC;
LED1 : out STD_LOGIC;
LED2 : out STD_LOGIC;
LED3 : out STD_LOGIC;
LED4 : out STD_LOGIC;
LED5 : out STD_LOGIC;
LED6 : out STD_LOGIC;
LED7 : out STD_LOGIC;
LED8 : out STD_LOGIC;
a : out STD_LOGIC;
b : out STD_LOGIC;
c : out STD_LOGIC;
d : out STD_LOGIC;
e : out STD_LOGIC;
f : out STD_LOGIC;
g : out STD_LOGIC;
MULTIPLEXOR : in STD_LOGIC);
end VELOCIMETRO;

architecture Behavioral of VELOCIMETRO is


signal B01,B02,B11,B12,B21,B22: STD_LOGIC;
signal BI0,BI1,BI2,BI3: STD_LOGIC;
signal S0,S1: STD_LOGIC;
signal AI2,AI0: STD_LOGIC;
signal MSD: STD_LOGIC;
signal AIN,BIN,CIN,DIN: STD_LOGIC;
begin

B21 <= (BUTTON3 xor BUTTON4) or BUTTON2;


B11 <= BUTTON1 or ((not BUTTON3) and BUTTON4);
B01 <= BUTTON1 or (BUTTON3 and (not BUTTON4));
B22 <= BUTTON5 or BUTTON6 or (BUTTON7 and (not BUTTON8));
B12 <= B22;
B02 <= BUTTON6 or (BUTTON7 and (not BUTTON8));
--A3 y A1 son 0
S0 <= BUTTON1 or BUTTON2 or BUTTON3 or BUTTON5 or
BUTTON7;
S1 <= BUTTON4 or BUTTON8;
AI2 <= S0 and (not S1);
AI0 <= AI2;
BI3 <= BUTTON8;
MSD <= BUTTON1 or BUTTON2 or BUTTON3 or BUTTON4;
-- Multiplexor
process is
begin

if (MSD = '1') then


BI0 <= B01;
BI1 <= B11;
BI2 <= B21;
else
BI0 <= B02;
BI1 <= B12;
BI2 <= B22;
end if;
wait on MSD;
end process;
-- Codificador BCD a DISPLAY
AIN <= ((not MULTIPLEXOR) and AI0) or (MULTIPLEXOR and BI0);
BIN <= MULTIPLEXOR and BI1;
CIN <= ((not MULTIPLEXOR) and AI2) or (MULTIPLEXOR and BI2);
DIN <= MULTIPLEXOR and BI3;

a <= DIN or BIN or (CIN and AIN) or ((not CIN) and (not AIN));
b <= DIN or (not CIN) or ((not BIN) and (not AIN)) or (BIN and AIN);
c <= DIN or CIN or (not BIN) or AIN;
d <= ((not DIN) and CIN and (not BIN) and AIN) or ((not DIN) and (not
CIN) and BIN) or ((not CIN) and (not AIN)) or (BIN and (not AIN)) or DIN;
e <= ((not CIN) or BIN) and (not AIN);
f <= DIN or CIN or ((not BIN) and (not AIN));
g <= DIN or (CIN xor BIN) or (BIN and (not AIN));
--LEDS
LED1 <= BUTTON1;
LED2 <= BUTTON2;
LED3 <= BUTTON3;
LED4 <= BUTTON4;
LED5 <= BUTTON5;
LED6 <= BUTTON6;
LED7 <= BUTTON7;
LED8 <= BUTTON8;
end Behavioral;
Circuito Generado por Software
Simulación
Cuando tenemos el botón 1 encendido (35 millas/h) enciende el respectivo
LED
Aparece en el display el número 3 cuando el multiplexor está en estado alto,
cuando pasa a estado bajo cambia al número 5.

Cuando presionamos el botón 8 (80 millas/h) se enciende el LED8


Aparece en el display el número 8 cuando el multiplexor está en estado alto,
cuando pasa a estado bajo cambia al número 0.
Esto implementado en la práctica, da la impresión de observar un 35 y un 80,
respectivamente, en los displays del circuito, como se podrá observar en el
video.

Referencias
Floyd, T. L. (2006). Fundamentos de Sistemas Digitales. Madrid: Pearson Educación.

You might also like