找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3041|回复: 1
打印 上一主题 下一主题
收起左侧

VHDL编程60s时钟及显示程序

[复制链接]
跳转到指定楼层
楼主
ID:51090 发表于 2014-9-29 17:11 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
entity dianzibiao is
Port(clk,key:in std_logic;
     ww:out std_logic_vector(1 downto 0);
     qqq:out std_logic_vector(3 downto 0);
   Q:out std_logic_vector(6 downto 0));
end;
Architecture dzb of dianzibiao is
signal q1,q2,disp:std_logic_vector(3 downto 0);
signal tt:std_logic_vector(7 downto 0);
signal d1,d2,d3,d4,cp,c1,c2:std_logic;
signal t:std_logic_vector(25 downto 0);
begin
    process(clk)
     begin
      if clk'event and clk='1' then t<=t+1;tt<=tt+1;
        if t=19999999 then
         t<="00000000000000000000000000";c1<='1';
        else c1<='0';
        end if;
     end if;
    end process;
----------------------------
process(c1)
begin
if c1'event and c1='1' then q1<=q1+1;
   if q1=9 then q1<="0000";q2<=q2+1;  
   end if;
   if q2=5 and q1=9 then q2<="0000";
   end if;
  end if;
end process;
  ------------------------------
process(q1,q2)
   begin
   if tt<128 then disp<=q1;ww<="01";       --位显示1显示,0不显示
   else disp<=q2;ww<="10";
   end if;
end process;
----------------------------  
process(disp)
begin  
   case disp is
      when "0000"=>Q<="0000001";     --段码显示开发板共阳极,所以0显示,1不显示。
      when "0001"=>Q<="1001111" ;
      when "0010"=>Q<="0010010" ;
      when "0011"=>Q<="0000110" ;
      when "0100"=>Q<="1001100" ;
      when "0101"=>Q<="0100100" ;
      when "0110"=>Q<="0100000" ;
      when "0111"=>Q<="0001111" ;
      when "1000"=>Q<="0000000" ;
      when "1001"=>Q<="0000100" ;
      when others=>null;
      end case;
     end process;
end;

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:69862 发表于 2014-12-8 20:52 | 只看该作者
表示看不明白呀
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表