内容发布更新时间 : 2024/12/22 19:37:34星期一 下面是文章的全部内容请认真阅读。
end div_500k; architecture c of div_500k is signal temp:integer range 0 to 4999999; begin p1:process(clk_in2) begin if clk_in2'event and clk_in2='1' then if temp=4999999 then temp<=0; else temp<=temp+1; end if; end if; end process p1; p2:process(temp) begin if temp=4999999 then clk_out2<='1'; else clk_out2<='0'; end if; end process p2; end c; 4.投币按键防抖模块 keyin.vhd --------------------------------------------- --File Name : keyin.vhd --Description : Help to achieve the function of auto ticket selling --Limition : None --System : Vhdl_9.0 --Soft : Quartus2_9.0 --Author : ChenDawen --Revision : Version 1.0 ,2012-10-31 --------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; entity keyin is --投币按键防抖 port(clk_in1:in std_logic; reset:in std_logic; resetn:out std_logic); end keyin; architecture b of keyin is signal resetmp1,resetmp2:std_logic; begin process(clk_in1) begin if clk_in1'event and clk_in1='1' then resetmp2<=resetmp1; resetmp1<=reset; end if;end process; resetn<= resetmp1 and (not resetmp2); end b; 五、 功能说明 a) 系统复位,SW0拨一次,Restart='1';LD7亮,系统进入第一个状态state=00001,系统所有数据清零,Selstyle,等待选择票种状态,6个数码管显示000000; 图15 b) 选择车票种类,BTN7,BTN6,BTN5分别代表2元车票,4元车票,6元车票,按下相应按钮后(此次选6元),数码管DISP5显示数字6,LD6亮,系统进入第二个状态state=00010,Selticket,等待选择购票数量状态,6个数码管显示600000; 图16