云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > FPGA实验报告 - 图文

FPGA实验报告 - 图文

  • 62 次阅读
  • 3 次下载
  • 2025/7/12 3:57:53

实验二、跑马灯设计

一、实验目的

1. 学习状态机的设计技巧; 2. 掌握CASE 语句的使用。

二、实验器材

1. KH-310 下载板; 2. KH-310 时钟模块;

3. KH-310 LED 显示模块。

三、文件档名

加载:led.sof 烧录:led.pof

项目工程文件:led.qpf

四、实验内容

控制8 个LED 进行花式显示,设计四种显示模式: 1. 从左到右逐个点亮LED; 2. 从右到左逐个点亮LED; 3. 从两边到中间逐个点亮LED; 4. 从中间到两边逐个点亮LED。

四种模式循环切换,由复位键rst 控制系统的运行与停止。

五、实验原理

图3.23

可用移位寄存器来控制逐个点亮LED 的操作,移位的频率为1Hz。

六、实验连线

输入信号:

时钟clk 接10Hz 输入(SW7) P152;

复位rst 接拨动开关I01(拨码开关SW3 左1)P1 ; 输出信号:

8 位输出信号接LED 模块O25—O32。P43~P50;

七、实验操作

下载程序,将SW7 拨至第二段(10Hz),拨码开关SW3 的IO1 拨至ON 的位置,此时,LED 灯的前8 位会有规律的闪烁。

八、实验程序

1. VHDL 程序

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity led is

port(clk:in std_logic; rst:in std_logic;

q :out std_logic_vector(7 downto 0)); end;

architecture led of led is

constant s0:std_logic_vector(1 downto 0):=\模式1 constant s1:std_logic_vector(1 downto 0):=\―模式2 constant s2:std_logic_vector(1 downto 0):=\―模式3 constant s3:std_logic_vector(1 downto 0):=\―模式4

signal present:std_logic_vector(1 downto 0); -- ――当前模式 signal q1:std_logic_vector(7 downto 0); signal count:std_logic_vector(3 downto 0); begin

process(rst,clk) begin

if(rst='0')then -- ――系统初始化 present<=s0;

q1<=(others=>'0');

elsif(clk'event and clk='1')then case present is

when s0 => if(q1=\――S0模式:从左到右逐个点亮LED

q1<=\

else if(count=\

count<=(others=>'0'); q1<=\ present<=s1;

else q1<=q1(0) & q1(7 downto 1); count<=count+1; present<=s0; end if; end if;

when s1 => if(count=\模式:从右到左逐个点亮LED count<=(others=>'0'); q1<=\ present<=s2;

else q1<=q1(6 downto 0) & q1(7); count<=count+1; present<=s1; end if;

when s2 => if(count=\模式:从两边到中间逐个点亮LED count<=(others=>'0'); q1<=\ present<=s3;

else q1(7 downto 4)<=q1(4) & q1(7 downto 5); q1(3 downto 0)<=q1(2 downto 0) & q1(3); count<=count+1; present<=s2; end if;

when s3 => if(count=\模式:从中间到两边逐个点亮LED count<=(others=>'0'); q1<=\ present<=s0;

else q1(7 downto 4)<=q1(6 downto 4) & q1(7); q1(3 downto 0)<=q1(0) & q1(3 downto 1); count<=count+1; present<=s3; end if; end case; end if;

end process; q<=q1; end;

搜索更多关于: FPGA实验报告 - 图文 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

实验二、跑马灯设计 一、实验目的 1. 学习状态机的设计技巧; 2. 掌握CASE 语句的使用。 二、实验器材 1. KH-310 下载板; 2. KH-310 时钟模块; 3. KH-310 LED 显示模块。 三、文件档名 加载:led.sof 烧录:led.pof 项目工程文件:led.qpf 四、实验内容 控制8 个LED 进行花式显示,设计四种显示模式: 1. 从左到右逐个点亮LED; 2. 从右到左逐个点亮LED; 3. 从两边到中间逐个点亮LED; 4. 从中间到两边逐个点亮LED。 四种模式循环切换,由复位键rst 控制系统的运行与停止。 五、实验原理 图3.23

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com