跑马灯的设计doc

loading 分享 2026-8-21 下载文档

1.2彩灯控制模块

1)彩灯控制模块用来直接控制跑马灯的输出,使彩灯表现出不同的花样。 Rst:输入信号 使彩灯控制模块的输出为“00000000”,即让彩灯无输出。 Input[4..0]:输入信号 不同的输入使彩灯控制模块有不同的输出即彩灯显示出不同的花样。

Output[7..0]:输出信号 直接与彩灯相连来控制彩

图1.5 彩灯控制模块 2) 彩灯控制模块VHDL程序编写及仿真

LIBRARY ieee;

USE ieee.std_logic_1164.all; -- IEEE库使用声明 ENTITY caideng IS -- 实体端口声明 PORT(input: IN

output

INTEGER RANGE 0 TO 31;

: OUT std_logic_vector(7 downto 0);

rst:in std_logic;

sm :out std_logic_vector(6 downto 0) ); END caideng;

ARCHITECTURE a OF caideng IS --结构体功能描述语句 BEGIN

PROCESS (input,rst) BEGIN

if rst='1' then output<=\ --当rst复位时,灯全灭 else case input is

when 0=>output<=\ when 1=>output<=\ when 2=>output<=\ when 3=>output<=\ when 4=>output<=\ when 5=>output<=\

when 6=>output<=\ when 7=>output<=\ --当sm为110时,灯从左到右第一个开始亮 when 8=>output<=\

when 9=>output<=\ when 10=>output<=\ when 11=>output<=\ when 12=>output<=\ when 13=>output<=\ when 14=>output<=\ when 15=>output<=\ --当sm为11011时,灯从中间亮到两边 when 16=>output<=\ when 17=>output<=\ when 18=>output<=\ when 19=>output<=\ when 20=>output<=\ when 21=>output<=\ when 22=>output<=\ when 23=>output<=\

--当sm为1001111时,灯从两边亮到中间

when 24=>output<=\ when 25=>output<=\ when 26=>output<=\ when 27=>output<=\ when 28=>output<=\ when 29=>output<=\ when 30=>output<=\ when 31=>output<=\ when others=>null;

--当sm为0100110时,灯从右边亮到左边 end case;

end if; end process; end a;

图1 .6 .彩灯灯控制模块仿真波形

1.3 4选1选择器模块

1) Rst:输入信号 复位信号 使选择器的输出为“0”。 In1、in2、in3、in4:输入信号 接分频器的输出。

Inp[1..0]:输入信号 接4进制计数器的输出用来控制选择器的选择不同的输入选择不同的输出。

Output:输出信号 直接接扬声器即输出的是不同的频率来控制扬声器播放音乐。

图1.7 4选1选择器

2) 4选1选择器模块VHDL程序编写及仿真 Library ieee;

use ieee.std_logic_1164.all; -- IEEE库使用声明 entity mux41 is -- 实体端口声明 port( rst:in std_logic;

s:in std_logic_vector(1 downto 0);

a,b,c,d: in std_logic; y: out std_logic); end mux41;

architecture a of mux41 is --结构体功能描述语句

begin

process (rst,s,a,b,c,d) begin

if(rst='1') then y<='0'; else

case s is -- case选择语句

when \ when \ when \ when \ when others=>null; end case;

end if;

end process;

end a;

图1.8 4选1选择器仿真波形

第二章 系统结构及仿真

整个系统就是各个分模块组成来实现最后的彩灯控制功能,系统又两个时钟来控制一个

是控制32进制计数器即控制彩灯控制模块来实现彩灯的不同输出,

图 2.1 系统功能模块

图 2.2 系统功能仿真波形


跑马灯的设计doc.doc 将本文的Word文档下载到电脑
搜索更多关于: 跑马灯的设计doc 的文档
相关推荐
相关阅读