如何用vhdl语言编写一个8位七段数码管 实现动态扫描,比如让8位数码管在同一时刻分别显示876543210;
1个回答
展开全部
PROCESS (HighCLK) --动态数码管控制显示部分
BEGIN
IF HighCLK 'EVENT AND HighCLK ='1' THEN
CASE Q IS
WHEN 0 => Y<="000"; VIEW<=h(7 DOWNTO 4); Q<= 1;
WHEN 1 => Y<="001"; VIEW<=h(3 DOWNTO 0); Q<= 2;
WHEN 2 => Y<="010"; VIEW<=c(7 DOWNTO 4); Q<= 3;
WHEN 3 => Y<="011"; VIEW<=c(3 DOWNTO 0); Q<= 4;
WHEN 4 => Y<="100"; VIEW<=s(7 DOWNTO 4); Q<= 5;
WHEN 5 => Y<="101"; VIEW<=s(3 DOWNTO 0); Q<= 6;
WHEN 6 => Y<="110"; VIEW<="0000"; Q<= 7;
WHEN 7 => Y<="111"; VIEW<="0000"; Q<= 0;
WHEN OTHERS => Q <= 0;
END CASE;
ELSE NULL;
END IF;
END PROCESS;
给分吧
HighCLK是扫描时钟设一个较高的时钟就行,我一般是设定为2000 HZ,VIEW 接你要显示的信号,Y 控制第几个数码管显示,比如你要第一个数码管显示8就把第一条改成:
WHEN 0 => Y<="000"; VIEW<="1000"; Q<= 1;
BEGIN
IF HighCLK 'EVENT AND HighCLK ='1' THEN
CASE Q IS
WHEN 0 => Y<="000"; VIEW<=h(7 DOWNTO 4); Q<= 1;
WHEN 1 => Y<="001"; VIEW<=h(3 DOWNTO 0); Q<= 2;
WHEN 2 => Y<="010"; VIEW<=c(7 DOWNTO 4); Q<= 3;
WHEN 3 => Y<="011"; VIEW<=c(3 DOWNTO 0); Q<= 4;
WHEN 4 => Y<="100"; VIEW<=s(7 DOWNTO 4); Q<= 5;
WHEN 5 => Y<="101"; VIEW<=s(3 DOWNTO 0); Q<= 6;
WHEN 6 => Y<="110"; VIEW<="0000"; Q<= 7;
WHEN 7 => Y<="111"; VIEW<="0000"; Q<= 0;
WHEN OTHERS => Q <= 0;
END CASE;
ELSE NULL;
END IF;
END PROCESS;
给分吧
HighCLK是扫描时钟设一个较高的时钟就行,我一般是设定为2000 HZ,VIEW 接你要显示的信号,Y 控制第几个数码管显示,比如你要第一个数码管显示8就把第一条改成:
WHEN 0 => Y<="000"; VIEW<="1000"; Q<= 1;
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询