Siao_Liao
Joined: 20 Jan 2006
Posts: 1
|
Posted:
Fri Jan 20, 2006 3:00 pm Post subject:
need help in VHDL program. |
|
|
Hi all...i need help in implementing another stop button.
Currently i had a reset button and a play button.
The program were as followed.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity lcddisplay is
Port ( clk, reset, play: in std_logic;
E: out std_logic;
DB : out std_logic_vector(9 downto 0));
end lcddisplay;
architecture Behavioral of lcddisplay is
constant count_end :std_logic_vector(5 downto 0):="101000";
signal play_pulse: std_logic;
signal count_top: std_logic_vector( 5 downto 0);
begin
P0: process(play, count_top)
begin
if play ='1' then
play_pulse<='1';
elsif count_top=count_end then
play_pulse<='0';
end if;
end process P0;
P1: process(clk, reset)
variable counta: std_logic_vector (5 downto 0);
variable sign1 : std_logic;
begin
if reset ='1' then
E<='0';
DB<="0000000001";
counta:="000000";
sign1:='1';
count_top<="000000";
elsif play_pulse='1' then
if clk'event and clk='1' then
if sign1 ='1'then
if counta < "101000" then
counta := counta + 1;
elsif counta = "101000" then
sign1 := '0';
counta := "000000";
E <= '0';
end if;
count_top<=counta;
case counta is
when "000010" =>DB<= "0000111000"; --function set
when "000011" =>E<= '1';
when "000100" =>E<= '0';
when "000101" =>DB<= "0000001110"; --display on/off
when "000110" =>E<= '1';
when "000111" =>E<= '0';
when "001000" =>DB<= "0000000001"; --display clear
when "001001" =>E<= '1';
when "001010" =>E<= '0';
when "001011" =>DB<= "0000000110"; --entry mode set
when "001100" =>E<= '1';
when "001101" =>E<= '0';
when "001110" =>DB<= "0000010100"; --shift cursor
when "001111" =>E<= '1';
when "010000" =>E<= '0';
when "010001" =>DB<= "0010000000"; -- set ddram address
when "010010" =>E<= '1';
when "010011" =>E<= '0';
when "010100" =>DB<= "1001110000"; --p
when "010101" =>E<= '1';
when "010110" =>E<= '0';
when "010111" =>DB<= "1001111100"; --l
when "011000" =>E<= '1';
when "011001" =>E<= '0';
when "011010" =>DB<= "1001100001"; --a
when "011011" =>E<= '1';
when "011100" =>E<= '0';
when "011101" =>DB<= "1001111001"; --y
when "011110" =>E<= '1';
when "011111" =>E<= '0';
when "100000" =>DB<= "1001101001"; --i
when "100001" =>E<= '1';
when "100010" =>E<= '0';
when "100011" =>DB<= "1001101110"; --n
when "100100" =>E<= '1';
when "100101" =>E<= '0';
when "100110" =>DB<= "1001100111"; --g
when "100111" =>E<= '1';
when "101000" =>E<= '0';
when others =>E<= '0';
end case;
end if;
end if;
end if;
end process;
end Behavioral; |
|