在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2039|回复: 4

[求助] VHDL写的一个数码管滚动流水显示,总是显示不正确,高手帮忙验证一下。

[复制链接]
发表于 2011-12-4 16:23:13 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x









复制代码

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity scan is
port(clk:in bit;     
     clr:in bit;
     led_sel: out std_logic_vector(5 downto 0);
     led_data: out bit_vector(7 downto 0)         
);
end scan;

architecture logic of scan is
type display is array(16 downto 0)of bit_vector(7 downto 0);
signal count : integer:=0;                                    
signal led_sel_t : std_logic_vector(5 downto 0) :="000001";
--
signal led_data_t: bit_vector(7 downto 0);
signal clk1: bit ;                                            
signal count1 :  integer range 0 to 12 :=11;      
constant led_display: display:=("11111111","11111111","11111111","11111111","11111111",
                                "00100101","00011001","00000011","00001101","00100101","00000011",
                                "11111111","11111111","11111111","11111111","11111111","11111111"
);                           



begin
process(clk,clr)
begin
if clr='1'then
count<=0;clk1<='0';
elsif(clk'event and clk='1')then
if(count=5)then
count<=0;
clk1<=not clk1;
else
count<=count+1;
end if;
end if;
end process;
-------------------------------------


-------------------数据滚动------------
process(clk,clr)
begin
if clr='1'then
  count1<=0;
elsif(clk1'event and clk1='1')then
  if(count1=12)then
   count1<=0;
  else
   count1<=count1+1;
  end if;
  end if;

end process;
----------------------------------------
----动态扫描 -----------                             
process(clr,clk)
variable count2: integer range 5 downto 0 :=5;
begin
if clr='1'then
  count2:=0;
  led_data_t<="11111111";
  led_sel_t<="111110";
elsif(clk'event and clk='1')then
for count2 in 5 downto 0 loop
  led_data_t<=led_display(count1 + count2);              ----led_data对应赋值----------
  led_sel_t<=led_sel_t(4 downto 0) & led_sel_t(5);     --------位选移位--------                              
  end loop;
  end if;
end process;
led_sel<=led_sel_t;
led_data<=led_data_t;
-------------------------------
end logic;
发表于 2011-12-4 17:38:16 | 显示全部楼层
先把代码写清晰,像这样乱乱的
发表于 2011-12-5 11:04:29 | 显示全部楼层
lz把问题描述清楚吧,主要是
for count2 in 5 downto 0 loop
  led_data_t<=led_display(count1 + count2);              ----led_data对应赋值----------
  led_sel_t<=led_sel_t(4 downto 0) & led_sel_t(5);  
这几行的问题吗? 如果没记错的话&应该是拼接符吧?而且究竟是什么地方错了都不知道,看到这么长的程序,就没往下读的冲动了!
发表于 2011-12-5 11:56:37 | 显示全部楼层
请把代码排版好,什么地方出错了说明清楚,附上出错时候的波形图。
发表于 2011-12-5 12:00:08 | 显示全部楼层
通读了下代码。技术不过关的时候,不要用constant、integer、bit_vector、variable,否则很难理解硬件和软件的区别
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-6-26 13:08 , Processed in 0.065015 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表