




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、 | STYLEREF 1 整体电路图如下 课程设计报告设计题目: 多功能数字电子钟 所属院系: 计算机与控制工程学院 专 业: 软件工程 班 级:133-1 小组成员:刘壮谢磊张慧慧指导教师: 沈春华 设计要求 进行正常的时、分、秒计时功能,二十四小时制计时由数码管显示24h、60min、60s设置时间整点报时闹钟功能设计实现功能该数字电子钟能够实现时、分、秒计时功能;校准时和分的功能;校准时间时秒清零的功能;整点报时的功能;各个设计模块描述计时模块秒计数是由一个六十进制的计数器构成,生成元器件如下Clk:驱动秒计时器的时钟信号 Clr:校准时间时清零的输入端 En:使能端 Sec03.0
2、sec13.0:秒的高位显示,低位显示 Co:进位输出端,作为分的clk输入代码如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity second isport (clk,clr,en:in std_logic; sec0,sec1:out std_logic_vector(3 downto 0);co:out std_logic);end second;architecture sec of second isSIGNAL cnt1,cnt0:std_logic_vector(3
3、downto 0);beginprocess(clk)beginif(clr=0)thencnt0=0000;cnt1=0000;elsif(clkevent and clk=1)thenif(en=1)thenif cnt1=0101 and cnt0=1000 thenco=1;cnt0=1001;elsif cnt01001 thencnt0=(cnt0+1);else cnt0=0000;if cnt10101thencnt1=cnt1+1;else cnt1=0000;co=0;end if;end if;end if;end if;sec1=cnt1;sec0=cnt0;end p
4、rocess;end sec;仿真图如下:2分计数是由六十进制的计数器构成,生成元器件如下Clk:设置分输入和秒进位的或输入 En:使能输入 Min13.0 min03.0:分的高位显示,低位显示 Co:向时的进位输出代码如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity minute isport (clk,en:in std_logic; min1,min0:out std_logic_vector(3 downto 0);co:out std_logic);end minut
5、e;architecture min of minute isSIGNAL cnt1,cnt0:std_logic_vector(3 downto 0);beginprocess(clk)beginif(clkevent and clk=1)thenif en=1 thenif cnt1=0101 and cnt0=1001 thenco=1;cnt0=0000;cnt1=0000;elsif cnt01001 thencnt0=(cnt0+1);else cnt0=0000;cnt1=cnt1+1;co=0;end if;end if;end if;min1=cnt1;min0=cnt0;e
6、nd process;end min;仿真图如下:3时计数是由二十四进制的计数器构成,生成元器件如下Clk:设置时间输入和分进位输入的或en:使能端h13.0 h03.0:时的高位显示和低位显示代码如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity hour isport(clk,en:in std_logic;h1,h0:out std_logic_vector(3 downto 0);end hour;architecture beha of hour issignal cnt
7、1,cnt0:std_logic_vector(3 downto 0);beginprocess(clk)beginif(clkevent and clk=1) thenif en=1 thenif cnt1=0010 and cnt0=0011 thencnt1=0000;cnt0=0000;elsif cnt01001 thencnt0=cnt0+1;elsecnt0=0000;cnt1=cnt1+1;end if;end if;end if;h1=cnt1;h0=cnt0;end process;end beha;仿真图如下:设置时间模块按键去抖动,生成元器件如下Clk:256hz频率输
8、入Reset:接GNDDin:接按键Dout:输出传给按键选择器代码如下library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity debounce isport(clk,reset:in std_logic; -200HZdin:in std_logic;dout:out std_logic);end debounce;architecture a of debounce istype state is(s0,s1,s2);signal
9、 current:state;beginprocess(clk,reset,din)beginif(reset=1)thencurrent=s0;doutdout=1;if(din=0)thencurrent=s1;else currentdout=1;if(din=0)thencurrent=s2;else currentdout=0;if(din=0)thencurrent=s2;else currentdout=1;current=s0;end case;end if;end process;end a;仿真图如下:按键选择器,生成元器件如下:Clk:16hz输入Key1:按键调分的输入
10、Key2:按键调时的输入Key3:按键秒清零的输入Led1:输出信号给分元器件Led2:输出信号给时元器件Led3:输出清零信号给秒元器件代码如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity ctr1 isport(clk:in std_logic; -10HZkey1,key2,key3,key4:in std_logic;led1,led2,led3,led4:out std_logic);end ctr1;archi
11、tecture a of ctr1 isbeginprocess (clk)beginif(clkevent and clk=1)thenif(key1=0)thenled1=1;led2=0;led3=0;led4=0;elsif(key2=0)thenled1=0;led2=1;led3=0;led4=0;elsif(key3=0)thenled1=0;led2=0;led3=1;led4=0;elsif(key4=0)thenled1=0;led2=0;led3=0;led4=1;elseled1=0;led2=0;led3=0;led4=0;end if;end if;end proc
12、ess;end a;仿真图如下:整点报时模块生成元器件如下:Clk1:接512hzClk2 clk:En:使能输入M13.0 m03.0:接分的高位输出和低位输出S13.0 s03.0:接秒的高位输出和低位输出Speaker:连接蜂鸣器代码如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity xiang isport(m1,m0,s1,s0:in std_logic_vector(3 downto 0); en,clk1,clk2,clk:in std_logic; speaker:
13、out std_logic);end xiang;architecture sss_arc of xiang is begin process(clk,clk1,clk2,m1,m0,s1,s0) beginif(en=1)thenspeaker=clk;elsif(m1=0101and m0=1001)thenif(s1=0101)thenif(s0=1001)thenspeaker=clk2;-1024HZelsif(s0=0001 or s0=0011 or s0=0101 or s0=0111)thenspeaker=clk1;-512HZend if;elsespeaker=0;en
14、d if;elsif(m01001 or m10101or s10101)thenspeaker=0;end if; end process;end sss_arc;仿真图如下:显示时间模块模八的器件控制八个数码管显示的循环,生成元器件如下Clk:输入Clr:接GNDEn:使能端Y2.0:输出接数码管三个接受端代码如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity mo8 isport(clr,clk,en:in std_logic;y:out std_logic_vector(2
15、 downto 0);end mo8;architecture beha of mo8 issignal p:std_logic_vector(2 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenif en=1 thenif p=111 thenp=000;elsif p111 thenp=p+1;end if;end if;end if;yyyyyyyyyyyyyyyyyyyyy=1000000;end case;end process;end beha;仿真图如下:(五)分频模块分频器生成的元器件如下:Clk:时钟输入Cl
16、k512:512hz给响铃模块Clk1:1hz输出给秒计数器Clk16:16hz输出给按键选择器Clk256:256hz输出给按键抖动代码如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fenpin is port(clk:in std_logic; - q:out std_logic_vector(9 downto 0); clk512,clk4,clk1,clk16,clk256:out std_logic);end fenpin;architecture behave o
17、f fenpin issignal y:std_logic_vector(9 downto 0);begin process(clk) begin if(clk=1)then if(y=1111111111)then y=0000000000; clk512=y(0); clk256=y(1); clk16=y(5); clk4=y(7); clk1=y(9); else y=y+1; clk512=y(0); clk256=y(1); clk16=y(5); clk4=y(7); clk1=y(9); end if; end if; end process;end behave;仿真图如下:
18、闹钟模块比较器,比较当时显示时间与设置的闹钟时间是否相等,如相等,输出信号给蜂鸣器。生成元器件如下:Clk clk1:使能输入H03.0 h13.0:闹钟设置时间的分输入H33.0 h23.0:闹钟设置时间的时输入S03.0 s13.0:现在时间的分的输入S23.0 s33.0:现在时间的时的输入Y:输出信号给蜂鸣器代码如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity bijiao2 isport (clk,clk1:in std_logic; h0,h1,h2,h3,s0,s1,s2,s3:in std_logic_vector(3 downto 0);y:out std_logic);end bijiao2;architecture min of bijiao2 issignal c:std_logic;beginprocess(clk,clk1,h0,h1
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 预算编制工具与技巧试题及答案
- 个人承包荒山开发合同
- 农村土地流转承包合同模板
- 医药行业创新
- 2024秋九年级化学上册 第五单元 化学方程式 课题2 如何正确书写化学方程式教学设计3(新版)新人教版
- 六年级信息技术下册 十六神秘的神农架第二课时1教学实录 冀教版
- 人教版初中历史与社会七年级上册 3.4.2 现代化的大牧场 教学设计
- 2025年版:企业租赁经营合同样本(合同模板)
- 2025合同简易下载版
- 中药封包技术操作
- 2025山西地质集团招聘37人笔试参考题库附带答案详解
- 2024年新疆中考数学试卷(含答案解析)
- 建筑地基基础检测规范DBJ-T 15-60-2019
- 07FK02防空地下室通风设备安装图集
- 问诊教学课件
- 110KV升压站工程检验试验计划
- (新版)药品检验基本知识和药品质量标准考试题库(含答案)
- (完整版)高压开关柜技术协议(10KV配电所10KV高压成套开关柜设备供货)最新(精华版)
- 甲基丙烯酸甲酯生产工艺毕业设计-设备选型与布置
- (燃气)管径、壁厚计算公式
- 正五行日课神煞应用表
评论
0/150
提交评论