求用VHDL设计一个秒表0—99秒显示两个数码管
答案:1 悬赏:80
解决时间 2021-02-17 15:58
- 提问者网友:孤凫
- 2021-02-17 05:54
求用VHDL设计一个秒表0—99秒显示两个数码管
最佳答案
- 二级知识专家网友:酒安江南
- 2021-02-17 07:16
给你讲下思路吧,,对于数码管显示,用动态扫描法,对应的二极管亮法对应着一个数字,这个网上随便搜就有了!!在程序中你可以用CASE WHEN语句来实现,而对于外部输入的三个控制信号,也就相当于是一个计数器的控制信号,,你可以这样
entity shuma is
port(clk,reset:in std_logic;
start,cs:in std_logic;
disp1,disp2:out std_logic_vector(7 downto 0);
led:out std_logic);
end entity;
architecture art of shuma is
signal count1:integer range 0 to ......;自已算
signal count2,count3:integer range 0 to 99;
signal clk_div,led_flag:std_logic;
begin
process(clk,reset,count1)----首先进行时钟分频,分成1hz的;
begin
if reset='1' then
count1<=0;
elsif clk'event and clk='1' then
if count1=?? then---这个倍数根据你的FPGA板的时钟频率和1hz进行计算
count1<=0;clk_div<=not clk_div;
else count<=count+1;
end if;
end if;
end process;
process(clk_div,reset,count2) ---数码管计数进程;
begin
if reset='1' then
count2<=0;
elsif clk_div'event and clk_div='1' then
if count2=99 then
led_flag<='1';--LED亮的标志;
count2<=0;
else count2<=count2+1;led_flag<='0';
end if;
end if;
end process;
process(count)--将计数的数值显示在数码管上,,用动态扫描法,对应关系
begin 自已查;
case count is
when 0=>disp1,disp2...
end case;
同样的LED和测试程序 就是一个计数器,和上面类似,,,我要去上课啦,,希望以上那些可以帮助你!!!
entity shuma is
port(clk,reset:in std_logic;
start,cs:in std_logic;
disp1,disp2:out std_logic_vector(7 downto 0);
led:out std_logic);
end entity;
architecture art of shuma is
signal count1:integer range 0 to ......;自已算
signal count2,count3:integer range 0 to 99;
signal clk_div,led_flag:std_logic;
begin
process(clk,reset,count1)----首先进行时钟分频,分成1hz的;
begin
if reset='1' then
count1<=0;
elsif clk'event and clk='1' then
if count1=?? then---这个倍数根据你的FPGA板的时钟频率和1hz进行计算
count1<=0;clk_div<=not clk_div;
else count<=count+1;
end if;
end if;
end process;
process(clk_div,reset,count2) ---数码管计数进程;
begin
if reset='1' then
count2<=0;
elsif clk_div'event and clk_div='1' then
if count2=99 then
led_flag<='1';--LED亮的标志;
count2<=0;
else count2<=count2+1;led_flag<='0';
end if;
end if;
end process;
process(count)--将计数的数值显示在数码管上,,用动态扫描法,对应关系
begin 自已查;
case count is
when 0=>disp1,disp2...
end case;
同样的LED和测试程序 就是一个计数器,和上面类似,,,我要去上课啦,,希望以上那些可以帮助你!!!
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯
• 手机登qq时,显示手机磁盘不足,清理后重新登 |
• 刺客的套装怎么选啊? |