花样流水灯机械 0801-03 三个班的大一时的物理课件 library ieee; use ; use ; use ; entity led is port(clk:in std_logic; rst:in std_logic; Q:out std_logic_vector(7 downto 0)); end led; architecture one of led is signal W:std_logic_vector(21 downto 0); signal R:std_logic; signal T:std_logic; signal S:std_logic_vector(2 downto 0); begin p1:process(clk,rst) -- 控制灯闪的速度,如果外部时钟固定,可通过改变信号 W 的位数改变灯闪的速度, 也可通过外部时钟的改变而改变。 begin if (clk' enent and clk='1')then R<=W(21); W<=W+1; T<=not R and W(21); end if; end process p1; p2:process(t) -- 彩灯花型控制, 通过改变信号 S 的位数改变要控制图案的数目。 begin if(t' event and t='1')then S="000"; else S<=S+1; end if; case S is when"000"=>Q<="00000001"; when"001"=>Q<="00000010"; when"010"=>Q<="00000100"; when"011"=>Q<="00001000"; when"100"=>Q<="00010000"; when"101"=>Q<="00100000"; when"110"=>Q<="01000000"; when"111"=>Q<="10000000"; when others=>null; end case; end if; end process p2; end one; 大虾们帮忙啊,用 VHDL 设计一个简单的彩灯控制器电路!急~~10 0 分! 悬赏分: 100 - 解决时间: 2009-4-13 00:00 本人刚刚接触 VHDL , 又急需设计这个电路, 希望大虾能够帮忙~ 新手, 只能给 100 分,谢谢大侠们了啊~ 其原理图如下所示,用 CP1 控制两种图案的切换,用 CP 控制图案的状态改变。彩灯图案分别为: 1. 左右摆动: 0101 ←→ 1010 2. 暗带移动:0111 → 1011 → 1101 → 1110 要求: 1. 用波形输入法设计分频器模块 2. 图案转换方法不限问题补充:补充一下暗带移动,最后 1110 将返回到 1011 ,即: 0111 → 1011 → 1101 → 1110 → 1011 → 1101 → 1110 → 1011 ··· 提问者: 木木傻傻爱兜兜- 二级最佳答案 library ieee; use ; use ; entity control is port (CP1:in std_logic; CP: in std_logic; LAMP : out std_logic_vector(3 downto 0) ); end control; architecture behave of control is signal state:std_logic_vector(1 downto 0):="00"; signal state1:std_logic:='0'; signal data1:std_logic_vector(3 downto 0):="0101"; signal data2:std_logic_vector(3 downto 0):="0111"; begin LAMP<=data1 when(CP1='0') else data2; state1<='0' when(CP1='0') else '1'; process(CP) begin if(CP'event and CP='1') then case state is when "01" => data2 <= "1011"; when "10" => data2 <= "1101"; when "11" => data2 <= "1110"; when others => data2<
花样流水灯 来自淘豆网m.daumloan.com转载请标明出处.