彩灯实验报告_第1页
彩灯实验报告_第2页
彩灯实验报告_第3页
彩灯实验报告_第4页
彩灯实验报告_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、设计八 彩灯控制器要求:1、 设计一个彩灯控制器,使彩灯(led管)能连续发出四种以上不同的显示形式;2、随着彩灯显示形式的变化,发出不同的音响声。设计提示:1、彩灯显示的不同形式可由不同进制计数器驱动led显示完成;2、 音响由选择不同频率cp脉冲驱动扬声器形成;3、 彩灯显示形式由实验箱中拨码开关控制。实验程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity caidengkongzhiqi isport(clk1,rst,clk2 : instd_logic;caideng :

2、out std_logic_vector(7 downto 0);cz:in std_logic_vector(1 downto 0);speaker: out std_logic);end caidengkongzhiqi;architecture one of caidengkongzhiqi iscomponent counter_8port(clk,rst : instd_logic;count_out : out integer range 0 to 7);end component ;component caidengkongzhiport(ins:in std_logic_vec

3、tor(1 downto 0);input : in integer range 0 to 7;rst:in std_logic; output : out std_logic_vector(7 downto 0);end component ;component fenpinqiport(clk,rst: instd_logic;clk_10,clk_4,clk_6,clk_8 : out std_logic);end component ;component xzq4_1port( rst:in std_logic; inp:in std_logic_vector(1 downto 0);

4、in1,in2,in3,in4: in std_logic;output : out std_logic);end component ;signal s,g,m,n,k :std_logic; signal f:integer range 0 to 31;signal w:integer range 0 to 3;beginu1: counter_8 port map (clk=clk1, rst=rst, count_out =f);u2: caidengkongzhi port map (ins=cz,input=f, rst=rst, output =caideng);u3: fenp

5、inqi port map (clk=clk2, rst=rst, clk_10=g, clk_4=m, clk_6=n, clk_8=k);u4: xzq4_1 port map (inp=cz,rst=rst, in1=g, in2=m, in3=n, in4=k, output=speaker);end one;library ieee;use ieee.std_logic_1164.all;entity fenpinqi isport(clk,rst: instd_logic;clk_10,clk_4,clk_6,clk_8: out std_logic);end fenpinqi;a

6、rchitecture cd of fenpinqi isbeginp1:process(clk,rst) variable a:integer range 0 to 20; begin if rst=1 then clk_4=3 then a:=0; clk_4=1; else a:=a+1; clk_4=0; end if; end if; end if;end process p1;p2:process(clk,rst) variable b:integer range 0 to 20; begin if rst=1 then clk_6=5 then b:=0; clk_6=1; el

7、se b:=b+1; clk_6=0; end if; end if; end if;end process p2;p3:process(clk,rst) variable c:integer range 0 to 20; begin if rst=1 then clk_8=7 then c:=0; clk_8=1; else c:=c+1; clk_8=0; end if; end if; end if;end process p3;p4:process(clk,rst) variable d:integer range 0 to 20; begin if rst=1 then clk_10

8、=9 then d:=0; clk_10=1; else d:=d+1; clk_10=0; end if; end if; end if;end process p4;end cd;library ieee;use ieee.std_logic_1164.all;entity xzq4_1 isport( rst:in std_logic; inp:in std_logic_vector(1 downto 0);in1,in2,in3,in4: in std_logic;output: out std_logic);end xzq4_1;architecture a of xzq4_1 is

9、beginprocess (rst,inp)begin if(rst=1) then outputoutputoutputoutputoutputnull; end case; end if;end process;end a;library ieee;use ieee.std_logic_1164.all;entity counter_8 isport(clk,rst: instd_logic;count_out: out integer range 0 to 7);end counter_8;architecture a of counter_8 isbeginprocess (rst,c

10、lk) variable temp:integer range 0 to 8;beginif rst=1 then temp:=0;elsif (clkevent and clk=1) then temp:=temp+1; if(temp=8) then temp:=0; end if;end if; count_out=temp;end process;end a;library ieee;use ieee.std_logic_1164.all;entity caidengkongzhi isport(ins:in std_logic_vector(1 downto 0);input: in

11、integer range 0 to 7; rst:in std_logic; output: out std_logic_vector(7 downto 0); end caidengkongzhi;architecture a of caidengkongzhi isbeginprocess (input)begin if rst=1 then outputoutputoutputoutputoutputoutputoutputoutputoutputnull;end case;elsif(ins=01) thencase input iswhen 0=outputoutputoutputoutputoutputoutputoutputoutputnull; end case;elsif(ins=10)thencase input is when 0=outputoutputoutputoutputoutputoutp

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论