2761
- 收藏
- 点赞
- 分享
- 举报
彩灯及键盘抖动的演示
右边2个数码管用作显示右边按钮产生的脉冲数
左边2个数码管用作显示左边按钮产生的脉冲数
8个端口输出不同频率的脉冲
8个LED按一定的规律闪烁
小数点轮流显示在4个数码管上
library IEEE;
--The IEEE standard 1164 package, declares std_logic, rising_edge(), etc.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
--This package is a version of the Synopsys package and has been
-- optimized for use with the Express compiler.
library SYNOPSYS;
use SYNOPSYS.attributes.all;
entity TEST is
port (
JIL,JIR:IN STD_LOGIC;
LED,SWOUT:INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);
SEG: OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
BCD: OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
IO: OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
BEEP,POINT:OUT STD_LOGIC
);
end TEST;
architecture TEST_arch of TEST is
COMPONENT clkhu
PORT (CLKOUT:out STD_LOGIC);
END COMPONENT;
SIGNAL COUNT1:STD_LOGIC_VECTOR(9 DOWNTO 0);
SIGNAL COUNTR,COUNTL:STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL BCD_T:STD_LOGIC_VECTOR(6 DOWNTO 0);
SIGNAL COUNT2:STD_LOGIC_VECTOR(5 DOWNTO 0);
SIGNAL CLKIN,CLK1,CLK2:STD_LOGIC;
SIGNAL BCD_S,BCD1,BCD2,BCD3,BCD4:STD_LOGIC_VECTOR(3 DOWNTO 0);
begin
-- <>
U1:CLKHU PORT MAP (CLKIN);
SWOUT<=COUNT1(9 DOWNTO 2);
P1:PROCESS(CLKIN,COUNT1)
BEGIN
IF(CLKIN='1' AND CLKIN'EVENT)THEN
COUNT1<=COUNT1+1;
END IF;
CLK1<=COUNT1(9);
END PROCESS;
P2:PROCESS(CLK1,COUNT2)
BEGIN
IF(CLK1='1' AND CLK1'EVENT)THEN
COUNT2<=COUNT2+1;
CLK2<=COUNT2(1);
END IF;
END PROCESS;
P3:PROCESS(CLK2,COUNT2,LED)
BEGIN
IF(CLK2='1' AND CLK2'EVENT)THEN
IF(COUNT2( 5 DOWNTO 4)="00")THEN
LED(0)<='0';
LED(1)<=LED(0);
LED(2)<=LED(1);
LED(3)<=LED(2);
ELSIF(COUNT2(5 DOWNTO 4)="01")THEN
LED(0)<='1';
LED(1)<=LED(0);
LED(2)<=LED(1);
LED(3)<=LED(2);
ELSIF(COUNT2(5 DOWNTO 4)="10")THEN
LED(3)<='0';
LED(2)<=LED(3);
LED(1)<=LED(2);
LED(0)<=LED(1);
ELSE
LED(3)<='1';
LED(2)<=LED(3);
LED(1)<=LED(2);
LED(0)<=LED(1);
END IF;
END IF;
END PROCESS;
LED(7)<=LED(0);
LED(6)<=LED(1);
LED(5)<=LED(2);
LED(4)<=LED(3);
BEEP<=JIR AND JIL;
PS:PROCESS(COUNT1)
BEGIN
CASE COUNT1(1 DOWNTO 0) IS
WHEN "00"=>SEG<="1110";BCD_S<=BCD1;IO(1 DOWNTO 0)<="00";
WHEN "01"=>SEG<="1101";BCD_s<=BCD2;IO(1 DOWNTO 0)<="01";
WHEN "10"=>SEG<="1011";BCD_S<=BCD3;IO(1 DOWNTO 0)<="10";
WHEN "11"=>SEG<="0111";BCD_S<=BCD4;IO(1 DOWNTO 0)<="11";
WHEN OTHERS=>NULL;
END CASE;
IF(COUNT2(4 DOWNTO 3)=COUNT1(1 DOWNTO 0) )THEN
POINT<='1';
ELSE
POINT<='0';
END IF;
END PROCESS;
IO(2)<=CLKIN;
PR:PROCESS(JIR,COUNTR)
BEGIN
IF(JIR'EVENT AND JIR='1')THEN
COUNTR<=COUNTR+1;
END IF;
END PROCESS;
BCD1<=COUNTL(3 DOWNTO 0);
BCD2<=COUNTL(7 DOWNTO 4);
PL:PROCESS(JIL,COUNTL)
BEGIN
IF(JIL'EVENT AND JIL='0')THEN
COUNTL<=COUNTL+1;
END IF;
END PROCESS;
BCD3<=COUNTR(3 DOWNTO 0);
BCD4<=COUNTR(7 DOWNTO 4);
--HEX-to-seven-segment decoder
-- HEX: in STD_LOGIC_VECTOR (3 downto 0);
-- LED: out STD_LOGIC_VECTOR (6 downto 0);
--
-- segment encoding
-- 0
-- ---
-- 5 | | 1
-- --- <- 6
-- 4 | | 2
-- ---
-- 3
with BCD_S SELect
BCD_T<= "1111001" when "0001", --1
"0100100" when "0010", --2
"0110000" when "0011", --3
"0011001" when "0100", --4
"0010010" when "0101", --5
"0000010" when "0110", --6
"1111000" when "0111", --7
"0000000" when "1000", --8
"0010000" when "1001", --9
"0001000" when "1010", --A
"0000011" when "1011", --b
"1000110" when "1100", --C
"0100001" when "1101", --d
"0000110" when "1110", --E
"0001110" when "1111", --F
"1000000" when others; --0
BCD<=NOT BCD_T;
End TEST_arch;
左边2个数码管用作显示左边按钮产生的脉冲数
8个端口输出不同频率的脉冲
8个LED按一定的规律闪烁
小数点轮流显示在4个数码管上
library IEEE;
--The IEEE standard 1164 package, declares std_logic, rising_edge(), etc.
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
--This package is a version of the Synopsys package and has been
-- optimized for use with the Express compiler.
library SYNOPSYS;
use SYNOPSYS.attributes.all;
entity TEST is
port (
JIL,JIR:IN STD_LOGIC;
LED,SWOUT:INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);
SEG: OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
BCD: OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
IO: OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
BEEP,POINT:OUT STD_LOGIC
);
end TEST;
architecture TEST_arch of TEST is
COMPONENT clkhu
PORT (CLKOUT:out STD_LOGIC);
END COMPONENT;
SIGNAL COUNT1:STD_LOGIC_VECTOR(9 DOWNTO 0);
SIGNAL COUNTR,COUNTL:STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL BCD_T:STD_LOGIC_VECTOR(6 DOWNTO 0);
SIGNAL COUNT2:STD_LOGIC_VECTOR(5 DOWNTO 0);
SIGNAL CLKIN,CLK1,CLK2:STD_LOGIC;
SIGNAL BCD_S,BCD1,BCD2,BCD3,BCD4:STD_LOGIC_VECTOR(3 DOWNTO 0);
begin
-- <
U1:CLKHU PORT MAP (CLKIN);
SWOUT<=COUNT1(9 DOWNTO 2);
P1:PROCESS(CLKIN,COUNT1)
BEGIN
IF(CLKIN='1' AND CLKIN'EVENT)THEN
COUNT1<=COUNT1+1;
END IF;
CLK1<=COUNT1(9);
END PROCESS;
P2:PROCESS(CLK1,COUNT2)
BEGIN
IF(CLK1='1' AND CLK1'EVENT)THEN
COUNT2<=COUNT2+1;
CLK2<=COUNT2(1);
END IF;
END PROCESS;
P3:PROCESS(CLK2,COUNT2,LED)
BEGIN
IF(CLK2='1' AND CLK2'EVENT)THEN
IF(COUNT2( 5 DOWNTO 4)="00")THEN
LED(0)<='0';
LED(1)<=LED(0);
LED(2)<=LED(1);
LED(3)<=LED(2);
ELSIF(COUNT2(5 DOWNTO 4)="01")THEN
LED(0)<='1';
LED(1)<=LED(0);
LED(2)<=LED(1);
LED(3)<=LED(2);
ELSIF(COUNT2(5 DOWNTO 4)="10")THEN
LED(3)<='0';
LED(2)<=LED(3);
LED(1)<=LED(2);
LED(0)<=LED(1);
ELSE
LED(3)<='1';
LED(2)<=LED(3);
LED(1)<=LED(2);
LED(0)<=LED(1);
END IF;
END IF;
END PROCESS;
LED(7)<=LED(0);
LED(6)<=LED(1);
LED(5)<=LED(2);
LED(4)<=LED(3);
BEEP<=JIR AND JIL;
PS:PROCESS(COUNT1)
BEGIN
CASE COUNT1(1 DOWNTO 0) IS
WHEN "00"=>SEG<="1110";BCD_S<=BCD1;IO(1 DOWNTO 0)<="00";
WHEN "01"=>SEG<="1101";BCD_s<=BCD2;IO(1 DOWNTO 0)<="01";
WHEN "10"=>SEG<="1011";BCD_S<=BCD3;IO(1 DOWNTO 0)<="10";
WHEN "11"=>SEG<="0111";BCD_S<=BCD4;IO(1 DOWNTO 0)<="11";
WHEN OTHERS=>NULL;
END CASE;
IF(COUNT2(4 DOWNTO 3)=COUNT1(1 DOWNTO 0) )THEN
POINT<='1';
ELSE
POINT<='0';
END IF;
END PROCESS;
IO(2)<=CLKIN;
PR:PROCESS(JIR,COUNTR)
BEGIN
IF(JIR'EVENT AND JIR='1')THEN
COUNTR<=COUNTR+1;
END IF;
END PROCESS;
BCD1<=COUNTL(3 DOWNTO 0);
BCD2<=COUNTL(7 DOWNTO 4);
PL:PROCESS(JIL,COUNTL)
BEGIN
IF(JIL'EVENT AND JIL='0')THEN
COUNTL<=COUNTL+1;
END IF;
END PROCESS;
BCD3<=COUNTR(3 DOWNTO 0);
BCD4<=COUNTR(7 DOWNTO 4);
--HEX-to-seven-segment decoder
-- HEX: in STD_LOGIC_VECTOR (3 downto 0);
-- LED: out STD_LOGIC_VECTOR (6 downto 0);
--
-- segment encoding
-- 0
-- ---
-- 5 | | 1
-- --- <- 6
-- 4 | | 2
-- ---
-- 3
with BCD_S SELect
BCD_T<= "1111001" when "0001", --1
"0100100" when "0010", --2
"0110000" when "0011", --3
"0011001" when "0100", --4
"0010010" when "0101", --5
"0000010" when "0110", --6
"1111000" when "0111", --7
"0000000" when "1000", --8
"0010000" when "1001", --9
"0001000" when "1010", --A
"0000011" when "1011", --b
"1000110" when "1100", --C
"0100001" when "1101", --d
"0000110" when "1110", --E
"0001110" when "1111", --F
"1000000" when others; --0
BCD<=NOT BCD_T;
End TEST_arch;
我来回答
回答0个
时间排序
认可量排序
暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2008-08-18 22:21:13
-
2023-03-15 10:14:43
-
2009-11-04 15:13:24
-
2023-11-16 11:29:47
-
2021-02-19 15:17:06
-
2015-05-05 14:33:31
-
2020-10-22 14:55:26
-
2016-06-29 07:00:55
-
2018-07-04 14:27:00
-
2018-07-12 19:34:40
-
2008-11-27 18:42:34
-
2018-07-26 14:18:25
-
2012-12-24 15:30:38
-
2019-02-25 14:29:33
-
2018-09-12 14:32:27
-
2018-12-07 17:42:51
-
2012-12-24 15:16:39
-
2023-03-15 14:59:42
-
2008-08-24 15:26:21
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
-
10求HI3519DV500_SDK_V2.0.1.1
-
5有偿求HI3516DV500 + OV5647驱动
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认