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

下载本文档

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

文档简介

1、彩灯实验报告 设计八 彩灯控制器 要求: 1、 设计一个彩灯控制器,使彩灯(led 管)能连续发出四种以上不同得显示形式; 2、随着彩灯显示形式得变化,发出不同得音响声。 设计提示: : 1、彩灯显示得不同形式可由不同进制计数器驱动ed 显示完成; 2、 音响由选择不同频率 c脉冲驱动扬声器形成; 3、 彩灯显示形式由实验箱中拨码开关控制。 实验程序 lbary ieee; se ie、std_logic_14、al; use ieee、std_logic_unsigned、all; eniy cidekngzhiqi is port ( cl,rst,ck2 : ni std_ogic; c

2、ideng : ;)0 onwod 7(ocv_cigld toc:in std_ogcvectr(1 ownto 0); speake: ou d_loi ); e caidegnghiqi; artetur one of caidenkonghiq s ponent counter_8 pot ( clk,rs : in ;col_dtscont_ou : 7 ot 0 ega rgtni uo); en onent ; pent cidgongzi por ( ns: ;) otnwod (rotcev_ciol_dts niinpu : n intgr rang 0 to 7; : ;

3、cigolds noutut : ;)) otno 7(otcev_cgoldts tuen n ; ponnt fii port ( clk,rt : ;cig_tsnclk_1,lk_,cl_6,clk_8 : o toic ); nd pone ; ponent xz_ port ( rst :in std_ic; np: ;) otwod 1(rotcev_cigoldts niin1,i2,in3,in4 : ;cigol_ds nioutpt : o st_logi ); ed ponent ; ignal s,,k :sd_loic; sinal f:integr ange 0

4、o 3; signal :ntege ange 0 t 3; begin : outer_8 port m (k=ck1, rst=st, cou_u =); 2: cadengkongzh pot map (in=cz,npu=f, rrst, ouput =caideg); u3: fenpi por mp (clk=lk, rstst, c_1g, ck_4=m, clk_6=n, clk_8=k); u4: xzq4_1 prt mp (npcz, ,=2ni ,n ,ts=ts3n, n=k, optspear); end one; ibrry ieee; use ieee、std_

5、lic_1164、al; enit fnpinqi is op ( ,rst : ;cgol_dts n 8klc,_lc,4_kl,_l: gol_s tuo ;)end fenpnqi; archtetue d of fnpinqi s bin p:prcess(clk,rs) variable :inee rane 0 o ; in if =1 then c="0; a:; se if clkeven and lk=1hn if =3 hn a:=; cl_4="1; le :a1; clk_4"; n if; en if; end if; ed ocss

6、p; p2:procss(ck,rst) variable b:ntege rn 0 o 2; begin if rs=1 then c_0; :=0; ele i clkeet and lk=1the if b=5 then :=; cl_6=; else b:=b+1; k_6="0" end if; en if; en i; end roces 2; p3:proces(clk,rst) vaiabe :iteger range to 20; in if st=1" the k_8=0; c:0; ele if k"eet ad cl=1"

7、;th if c=7 the c:=0; cl_8"1; else c:=c+1; clk_8=0; end i; end if; end if; ed proces p3; p4:pos(lk,rs) vriable d:ntge range to 0; bein if rst=1" the l"0" d:=; ese if cevent an clk="1"hn if d=9 th :0; ck_0=1" else d:=d; clk_0=0"; en f; end f; nd if; ed rcss 4; e

8、n cd; libray eee; use ieee、sd_lgic_1164、all; entty xzq4_1 i ort ( rst:in stdlogc; inp:in s_vector(1 nto 0); ;cgl_dts ni : 4n,3ni,2ni,1i outpt : tuo t_logic ); ed x41; arcitetre of zq41 is bgin )pi,tsr( ssecorp nigeb if(rst=1) hen output=0" ee cs inp is wen 0'=tpt=i; whe 01'=outpt=in2; w

9、en 0=outpt=n3; when 11=uput=in4; when othrsll; end cas; ed if; nd pces; end a; libary eee; use eee、dloic_164、all; ntty counter_8 is tro ( tsr,l : std_lic; tu_nuo : 7 t 0 egnar regetni to ); ed cner_8; arciteue of conter_8 s begin )kc,tsr( ssorp vaable temp:intger rng to ; bein f rst" then ;0:pm

10、e eli (ck"evt nd lk=1") thn tp:temp+1; if(temp=8) ten temp:=0; end if; nd i; cont_ou=emp; ;ssecrp d end a; lirary ieee; use ee、std_logic_164、al; tiy caiengkonhi is por( sni :in sd_logic_ecto(1 donto 0); tpn : in itger range to 7; ;igolts i:tsr ptuo: tuo d_loi_ector(7 downto ); end adengkon

11、gzhi; architetue a of caidengkozi is bn )tpi( secop begn i rst then ouut=00000000'; else neh )00=sn(fi case nput is whn 0uput'000000; ;'00000010tuptuo=1 ehw ;000=tutuo=2 neh wn 3=output=000000; ;0001000'tuptuo4 ne whn output00000100; ;0000tuptuo= new ;'000000=ttuo7 nhw hen ohers=

12、ul; nd e; elsi(ins=1) th i upni e ;0100'=tut=0 nehw ;'0001100'=tutuo= nhw ;'011100=uptuo2 neh wen ouput='011100; wh utput01110; ;'1111110=tptuo5 neh ;01111111=uptuo= nhw ;11111=tuptu=7 ew ;u=srhto hw ;ec dne ne)'1sni(file si tupn e ;'100000'=tuptu=0 nhw when 1=output=1100001; ;1100011=uptuo2 hw when 3=output=110011; when 4=outut=11101'; ;11101'=tuptuo=5 nehw ;'111111tuptu6 nehw ;0000=uptuo= nhw he ohers=null; ;eac ne es si tup esc ;1100000'tuto=0 neh wen 1=otpu=00000110' ;1100=tptuo

温馨提示

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

评论

0/150

提交评论