版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 用数据“对话”物理规律-高中物理“验证机械能守恒定律”实验数据处理深度教学教案
- 2026沈阳网络面试题目及答案
- 2026生态领域面试题目及答案
- 2026适应环境的面试题及答案
- 2026税务科长面试题目及答案
- 2026体育国考面试题目及答案
- 年产30万个聚氨酯发泡轮生产项目报告表
- 2026文旅面试题目及答案大全
- 2026年液压液力气动密封件制造工操作考核试卷及答案
- 客户业务办理管理办法
- DB37T 1914-2024 液氨存储与装卸作业安全技术规范
- 2025年曲靖市师宗县城区学校遴选教师考试笔试试题(含答案)
- 电工入场安全教育试卷(含答案)
- CJ/T 225-2011埋地排水用钢带增强聚乙烯(PE)螺旋波纹管
- 土地征收代理合同协议
- 地铁消防安全培训课件
- GB/T 20424-2025重有色金属精矿产品中有害元素的限量规范
- 2024专利代理人考试真题及答案
- 护士长进修汇报护理
- 液化气站双重预防体系手册
- DL∕ T 736-2010 农村电网剩余电流动作保护器安装运行规程
评论
0/150
提交评论