编译什么的都通过了,但最后在板子上实验的时候就是不行。。 按键控制风扇风速的(强,中弱),小弟使用的是状态机控制 ,先在此感谢啦!!
library ieee;
use ieee.std_logic_1164.all;
entity feng_shan123 is
port(ting_zhi,feng_su,clk:in std_logic;
ruo,zhong,qiang:out std_logic);
end feng_shan123;
architecture one of feng_shan123 is
type state123 is(state0,state1,state2,state3);
signal pr_state0,nx_state0:state123;
signal kong_zhi:std_logic;
begin
process(ting_zhi,feng_su) -- 停止键有效时,系统停止
begin
if ting_zhi='0'
then pr_state0<=state0; -- 信号上升沿来时,现态等于次态
elsif(feng_su'event and feng_su='0')
then pr_state0<=nx_state0;
end if;
end process;
process(pr_state0)
begin
case pr_state0 is
when state0=>ruo<='1';zhong<='1';qiang<='1';
nx_state0<=state1;kong_zhi<='1';
when state1=>ruo<='0';zhong<='1';qiang<='1';
nx_state0<=state2;kong_zhi<='0';
when state2=>ruo<='1';zhong<='0';qiang<='1';
nx_state0<=state3;
when state3=>ruo<='1';zhong<='1';qiang<='0';
nx_state0<=state1;
end case;
end process;
end one; |