会宁在线

正文

彩灯控制器(vhdl语言设计一个8路彩灯控制器)

  • 发布:
  • 人气: 9
标签:

应用介绍

library ieee;

use ieee.std_logic_1164.all;

entity fengxi is port(

qin std_logic;

ystates;

signal kstd_logic;

signal y_out,y_out1:std_logic_vector(7 downto 0);

begin

process(clk,rst)--分频

begin

if rst='1' then

k<=0;clk_low<='0';

else

if(clk'event and clk='1') then

if k=3 then

k<=0; clk_low<=not clk_low;

else

k<=k+1;

end if;

end if;

end if;

end process;

process(clk,adjust)==调速

begin

if adjust='1' then

clk_use<=clk;end if;

if adjust='0' then

clk_use<=clk_low;

end if;

end process;

process(q)--手动

begin

if q="000000" then en<='1';else en<='0'; end if;

if q="000001" then y_out1<="00000001";end if;

if q="000010" then y_out1<="00000010";end if;

if q="000100" then y_out1<="00000011";end if;

if q="001000" then y_out1<="00000100";end if;

if q="010000" then y_out1<="00000101";end if;

if q="100000" then y_out1<="00000110";end if;

end process;

process(rst)--循环

begin

if (rst='1') then

state<=s0;else

if(clk_use'event and clk_use='1') then

case state is

when s0 =>

state<=s1;

when s1=>

state<=s2;

when s2=>

state<=s3;

when s3 =>

state<=s4;

when s4=>

state<=s5;

when s5=>

state<=s6;

when s6=>

state<=s1;

end case;

end if;

end if;

end process;

process(rst,q)

begin

if rst='1' then

y_out<="00000000";

else

case state is

when s0=>

y_out<="00000000";

when s1=>

y_out<="00000001";

when s2=>

y_out<="00000010";

when s3=>

y_out<="00000011";

when s4=>

y_out<="00000100";

when s5=>

y_out<="00000101";

when s6=>

y_out<="00000110";

end case;

end if;

if en='1' then

y<=y_out;end if;

if en='0' then

y<=y_out1;end if;

end process;

end;

年终奖计算(年终奖如何计算) 洗纹身药水(淘宝上买的洗纹身的药水真的有用吗) 电子商务设计师(做过电商美工的设计师,转型做UI设计可以吗 如何报考志愿(考研如何报志愿) 三国赤壁之战(赤壁之战简短概括20) 英雄联盟索拉卡(lol源代码索拉卡怎么样) 暑假旅游攻略(暑假到北京看升旗仪式的旅游攻略有哪些) 好学生评语(学校对学生的评语) 伤心的女人(女生分手后更伤心,还是男生分手后更伤心) 手上青筋明显(手掌上有青筋是怎么回事)

最新应用