翻新时间:2023-08-07
EDA数字秒表的设计程序
程序说明:1。此程序包括分频,计数控制,显示控制部分。
2。开机显示00。00。00,用户课随时计时,暂停,清零,最大计时可到59 分59。99秒。
3。技术时钟为100HZ
4。采用时分复用的方法控制4个数码管的显示,可节省资源。
程序如下:
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity watch is
Port(sel: out std_logic_vector(6 downto
1) ;
seg:out std_logic_vector(7 downto 0);
Beginstop:in std_logic;
Reset:in std_logic;
Cp2:in std_logic);
End watch;
Architecture behave of watch is
Signal num1: std_logic_vector(3 downto 0);
Signal num2: std_logic_vector(3 downto 0);
Signal num3: std_logic_vector(3 downto 0);
Signal num4: std_logic_vector(3 downto 0);
Signal num5: std_logic_vector(3 downto 0);
Signal num6: std_logic_vector(3 downto 0);
Signal num: std_logic_vector(3 downto 0);
Signal numlet: std_logic_vector(2 downto 0);
Signal count: std_logic_vector(17 downto
1);
Signal selsig: std_logic_vector(6 downto
1);
Signal segsig: std_logic_vector(7 downto 0 );
Signal cp1: std_logic;
Signal cp3: std_logic;
Begin
Process(cp
2) ---- 分频。
Begin
If (cp2' event and cp2='1') then
if (Count="1100011010011111")then
count<="00000000000000000"; cp1<=not cp1;
else count<=count 1;
end if;
end if;
cp3<=count
(10);
end process;
process(cp
1)
begin
if reset ='1' then num1(3 downto 0) <="0000";
num2(3 downto 0) <="0000";
num3(3 downto 0) <="0000";
num4(3 downto 0) <="0000";
num5(3 downto 0) <="0000";
num6(3 downto 0) <="0000";
else if cp1' event and cp1='1' then
if beginstop='1' then num1<=num1 1;
if num1 (3 downto 0)="1001" then if num2 (3 downto 0)="1001" then
num2 (3 downto 0)<="0000"; num3<= num3 1;
if num3 (3 downto 0)="1001" then
num3 (3 downto 0)<="0000"; num4<= num4 1;
if num4 (3 downto 0)="0101" then
num4 (3 downto 0)<="0000"; num5<= num5 1;
if num5 (3 downto 0)="1001" then
num5 (3 downto 0)<="0000"; num6<= num6 1;
if num6 (3 downto 0)="0101" then
num6(3 downto 0)<="0000";
end if; end if; end if; end if; end if; end if; end if;
end if; end if;
end process;
process (cp
3)
begin
if (cp3' event and cp3='1')then
if(numlet(2 downto 0)="000") then
num<=num1;selsig(6 downto
1)<="111110"; end if;
if(numlet(2 downto 0)="001") then
num<=num2;selsig(6 downto
1)<="111101"; end if;
if(numlet(2 downto 0)="010") then
num<=num3;selsig(6 downto
1)<="111011"; end if;
if(numlet(2 downto 0)="011") then
num<=num4;selsig(6 downto
1)<="110111"; end if;
if(numlet(2 downto 0)="100") then
num<=num5;selsig(6 downto
1)<="101111"; end if;
numlet(2 downto 0)<=numlet(2 downto 0) 1;
if(numlet(2 downto 0)="101") then
numlet(2 downto 0)<="011111"; end if;
end if;
if (num (3 downto 0)="0000")then
segsig(7 downto 0)<="01111111"; end if;
if (num (3 downto 0)="0001")then
segsig(7 downto 0)<="00001101"; end if;
if (num (3 downto 0)="0010")then
segsig(7 downto 0)<="10110111"; end if;
if (num (3 downto 0)="0011")then
segsig(7 downto 0)<="10011111"; end if;
if (num (3 downto 0)="0100")then
segsig(7 downto 0)<="11001101"; end if;
if (num (3 downto 0)="0101")then
segsig(7 downto 0)<="11011011"; end if;
if (num (3 downto 0)="0110")then
segsig(7 downto 0)<="11111011"; end if;
if (num (3 downto 0)="0111")then
segsig(7 downto 0)<="00001111"; end if;
if (num (3 downto 0)="1000")then
segsig(7 downto 0)<="11111111"; end if;
if (num (3 downto 0)="1001")then
segsig(7 downto 0)<="11011111"; end if;
end process;
sel<=selsig;
seg(7 downto 0)<=segsig(7 downto 0);
end behave;
下载文档
网友最新关注
- 美丽的朝阳公园
- 假如我是神笔马良
- 我
- 炒鸡蛋
- 小金鱼的悄悄话
- 第一次喝酒
- 校园的春天
- 狐狸再骗老虎记
- 第一次吃大蛋糕
- 文静的小女孩
- 说说我自己
- 我的烦恼
- 新龟兔赛跑
- 买本子
- 三个愿望
- 节约能源的倡议书
- 医院就行业不正之风的倡议书
- 怎样写党性分析材料-写作指南
- 城市清明节文明祭祀倡议书
- 小学交通安全倡议书
- 交通邮电“窗口单位”优质服务倡议书
- ***同志的推荐材料
- 学校高级教师申报材料
- 创建学习型企业的倡议书
- 劳动模范推荐汇报材料
- 医院倡议书
- 创建全国文明县城倡议书
- 收费所文明创建申报材料
- 崇尚医德,创建人民满意医院倡议书
- 市爱心助学倡议书
- 在新形势下供电企业如何加强营销管理
- 浅探赵本山小品语言的喜剧性策略
- 公共空间在媒介化社会中的变迁
- 认知语言学架构下的修辞学研究
- 浅谈水彩画的发展与水色语言(
- 从心理语言学角度探究大学英语教学
- 将来时助动词语义
- 浅谈《共产党宣言》与中国特色社会主义
- 从《香妃戎装像》看舞蹈的神态
- 探析景观的科学与艺术
- 浅议服装销售技巧
- 论科学思想与西方文艺方法论对传统艺术的影响
- 分析民族舞蹈中舞蹈技巧的应用
- 计算机辅助语言学习与中学课堂的整合
- 浅述西方歌剧及其历史形成
- 《掌声》教学设计
- 《惊弓之鸟》教学设计之三
- 《中彩那天》教学设计之二
- 《荷花》教学设计
- 《掌声》教学设计
- 《一个小村庄的故事》说课设计
- 《一次成功的实验》教学设计之一
- 《一个小村庄的故事》教学设计之二
- 《一个小村庄的故事》综合资料
- 《中彩那天》教学设计之三
- 《掌声》教学设计一
- 《小摄影师》教学片断与评析
- 《三个儿子》说课设计
- 《三个儿子》其内在思想的?
- 《富饶的西沙群岛》教学特色试析