Sie sind auf Seite 1von 1

library IEEE;

use IEEE.std_logic_1164.all;
use IEEE.std_logic_textio.all;
use IEEE.numeric_std.all;
use IEEE.std_logic_signed.all;
use IEEE.std_logic_unsigned.all;
entity Conv_char_to_ASCII is
port (
black_button:
blue_button:
ASCII:
);
end entity;

in bit_vector(1 downto 0);


in bit_vector(15 downto 0);
out bit_vector(6 downto 0)

architecture behavior of Conv_char_to_ASCII is


shared variable ascii_aux: integer;
shared variable count: bit_vector(15 downto 0);
begin
process(blue_button, black_button)
begin
count := blue_button;
if(black_button = "01") or (black_button = "10") or (black_butto
n = "11") then
ascii_aux := 64;

-- Caracter 'A'

ascii_aux := 80;

-- Caracter 'Q'

na tabela ASCII
else
na tabela ASCII
end if;
while (count /= "0000000000000000") loop
ascii_aux := ascii_aux + 1;
count := count
srl 1;
end loop;
if (ascii_aux > 90) then
ascii_aux := 4;
end if;
end process;
ASCII <= to_bitvector(std_logic_vector(to_unsigned(ascii_aux,7)));
end architecture;

Das könnte Ihnen auch gefallen