资源描述:
《彩灯实验报告.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、........设计八彩灯控制器要求:1、设计一个彩灯控制器,使彩灯(LED管)能连续发出四种以上不同的显示形式;2、随着彩灯显示形式的变化,发出不同的音响声。设计提示:1、彩灯显示的不同形式可由不同进制计数器驱动LED显示完成;2、音响由选择不同频率CP脉冲驱动扬声器形成;3、彩灯显示形式由实验箱中拨码开关控制。实验程序LIBRARYieee;USEieee.std_logic_1164.all;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYcaidengkongzhiqiISPORT(c
2、lk1,rst,clk2:INstd_logic;caideng:OUTstd_logic_vector(7downto0);cz:instd_logic_vector(1downto0);speaker:outstd_logic);ENDcaidengkongzhiqi;ARCHITECTUREoneOFcaidengkongzhiqiISCOMPONENTcounter_8PORT(clk,rst:INstd_logic;count_out:OUTintegerrange0to7);ENDCOMPONENT;COM
3、PONENTcaidengkongzhiPORT(Ins:instd_logic_vector(1downto0);Input:ININTEGERRANGE0TO7;Rst:instd_logic;output:OUTstd_logic_vector(7downto0));ENDCOMPONENT;COMPONENTfenpinqi.s...............PORT(clk,rst:INstd_logic;clk_10,clk_4,clk_6,clk_8:OUTstd_logic);ENDCOMPONENT;C
4、OMPONENTxzq4_1PORT(Rst:instd_logic;Inp:instd_logic_vector(1downto0);in1,in2,in3,in4:Instd_logic;output:OUTstd_logic);ENDCOMPONENT;SIGNALs,g,m,n,k:std_logic;SIGNALf:INTEGERRANGE0TO31;SIGNALw:integerrange0to3;BEGINu1:counter_8portmap(clk=>clk1,rst=>rst,count_out=>
5、f);u2:caidengkongzhiportmap(ins=>cz,input=>f,rst=>rst,output=>caideng);u3:fenpinqiportmap(clk=>clk2,rst=>rst,clk_10=>g,clk_4=>m,clk_6=>n,clk_8=>k);u4:xzq4_1portmap(inp=>cz,rst=>rst,in1=>g,in2=>m,in3=>n,in4=>k,output=>speaker);ENDone;LIBRARYieee;USEieee.std_logic
6、_1164.all;ENTITYfenpinqiISPORT(clk,rst:INstd_logic;clk_10,clk_4,clk_6,clk_8:OUTstd_logic);ENDfenpinqi;ARCHITECTUREcdOFfenpinqiISbeginp1:process(clk,rst)variablea:integerrange0to20;.s...............beginifrst='1'thenclk_4<='0';a:=0;elseifclk'eventandclk='1'thenif
7、a>=3thena:=0;clk_4<='1';elsea:=a+1;clk_4<='0';endif;endif;endif;endprocessp1;p2:process(clk,rst)variableb:integerrange0to20;beginifrst='1'thenclk_6<='0';b:=0;elseifclk'eventandclk='1'thenifb>=5thenb:=0;clk_6<='1';elseb:=b+1;clk_6<='0';endif;endif;endif;endproces
8、sp2;p3:process(clk,rst)variablec:integerrange0to20;beginifrst='1'thenclk_8<='0';c:=0;.s...............elseifclk'eventandclk='1'thenifc>=7thenc:=0;clk_8<='1';elsec:=c+