1、 use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all;-实体- entity miaobiao isport(en,rst,clk: in std_logic;-暂停,复位,频率- dian,bell: out std_logic;-数码管点和蜂鸣器- duan: out std_logic_vector(5 downto 0);-数码管的段显示- cout:out std_logic_vector(6 downto 0);-数码管的位选-end;-结构体- arc
2、hitecture one of miaobiao is signal clk_1k:std_logic; signal clk_1h: signal cnt6:integer range 0 to 5; signal data:std_logic_vector(5 downto 0); signal dout: signal s:std_logic_vector(6 downto 0); signal led1,led2,led3,led4,led5,led6:begin-1k分频-process(clk) variable cnt1: integer range 0 to 250; var
3、iable cnt2: integer range 0 to 100; begin if clkevent and clk=1 then if cnt1=250 then cnt1:=0; if cnt2=100 then cnt2: clk_1k=not clk_1k; else=cnt2+1; end if;=cnt1+1;end process;-1h分频- integer range 0 to 4999; if cnt1=4999 then if cnt2=4999 then clk_1h=not clk_1h;-数码管-process(clk_1k) if clk_1kevent a
4、nd clk_1k=then if cnt6=5 then cnt6 else cnt6dout111101 when 2=111011 when 3=110111 when 4=101111 when 5=011111 when others=null; end case;process (dout)begin case dout is-数码管位地址相对应的输出段码信号- when =data= led1; dian= led2;0= led3;= led4;= led5;= led6;= null;-段显示地址-process(clk_1h)if rst=led6000010led5000
5、011led4000101led3001001led2led1 elsif clk_1hevent and clk_1h= if en= case led1 is000000 case led2 is case led3 is case led4 is case led5 is case led6 is led5 led4 led3 led2 led1 bell=led6-1; end case;=led5-1; bell=led4-1;=led3-1;=led2-1;=led1-1; -七段译码-process (data) case data iss0111111000001000011010110111001111000100110011011011010001101111101000111000011100100011111111101111duan=dout;cout=s;四、管脚分配体会与收获通过这个项目给我最大的体会就是不用害怕大项目,其实我们可以通过一个一个小项目完成好后在添加一些新的功能上去,不断的修改,整个项目完成我也是通过一个又一个简单小项目调试先,如先弄好寄存,再弄显示.一步一步加上一些功能上去,如果遇到不懂的和其他同学互相交流,有时候人家就那么几句话就可以让你灵感出现。要注重团队合作,一个人的力量毕竟是小的,互相学习借鉴人家,从中选择对自己有益的一面。
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1