




已阅读5页,还剩21页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
大连理工大学本科实验报告题目:多功能数字时钟设计课程名称: 数字电路与系统 学院(系): 电信学部 专 业: 电子信息工程(英强) 班 级: 学生姓名: 学 号: 201081505 完成日期: 2013-07-08 成 绩: 题目:多功能数字时钟1 设计要求1) 具有时、分、秒的十进制数字显示(小时从0023)2) 具有手动校时校分功能3) 具有整点报时功能,从00分00秒起,亮灯一分钟4) 具有秒表显示、计时功能(精确至百分之一秒),可一键清零5) 具有手动定时,及闹钟功能,LED灯持续提醒一分钟6) 具有240s倒计时功能,倒计时停止时有灯光提示,可一键清零2 设计分析及系统方案设计 1. 数字钟的基本功能部分,包括时、分、秒的显示,手动调时,以及整点报时部分。基本模块是由振荡器、分频器、计数器、译码器、显示器等几部分组成。利用DE2硬件中提供的50MHZ晶振,经过分频得到周期为1s的时钟脉冲。将该信号送入计数器进行计算,并把累加结果以“时”“分”“秒”的形式通过译码器由数码管显示出来。进入手动调时功能时,通过按键改变控制计数器的时钟周期,使用0.5s的时钟脉冲进行调时计数(sreset,mreset,hreset对时、分、秒进行清零复位,mset调分,hset调时),并通过译码器由七位数码管显示。从0分0秒开始,数字钟进入整点报时功能。(本设计中以一个LED灯代替蜂鸣器,进行报时)2. 多功能数字钟的秒表功能部分,计时范围从00分00.00秒至59分59.99秒。可由输入信号(resetsc1)异步清零,并由按键(startsc1)控制计时开始与停止。将DE2硬件中的50MHZ晶振经过分频获得周期为0.01秒的时钟脉冲,将信号送入计数器进行计算,并把累计结果通过译码器由七位数码管显示。3. 多功能数字钟的闹钟功能部分,通过按键(nsetm,nseth)设定闹钟时间,当时钟进入闹钟设定的时间(判断时钟的时信号hhs,hls与分信号mhs,mls分别与闹钟设定的时信号nhh,nhl与分信号nmh,nml是否相等),则以LED灯连续提示一分钟。4. 多功能数字钟的倒计时功能部分,可通过按键(startdjs/resetdjs)设定倒计时开始和清零。本设计为360秒的倒计时器。倒计时的时钟与数字钟的时钟相同,每迎到一个时钟上升沿,则计数器减一。计数器减至00时,分钟位、秒钟位恢复至59。倒计时结束时(即00分00秒),控制LED灯亮,表示倒计时结束。 本设计通过数据选择器控制译码器,使数码管独立显示,各功能之间互不影响。当selecetsignal=”01”时,则对秒表信号进行译码,数码管显示秒表数据;当selecetsignal=”10”时,则对闹钟信号进行译码,数码管显示闹钟数据;当selecetsignal=”11”时,则对倒计时信号进行译码,数码管显示倒计时信号数据;当selecetsignal=”00”时,则对正常时钟信号进行译码,数码管显示时钟信号数据。系统总体结构图:selecetsignal=”00”数码管显示译码器数据选择器时钟计数器分频(周期1s)50MHZ分频LED提醒分频(周期0.5s)报时 selecetsignal=”01”selecetsignal=”11”selecetsignal=”11”闹钟分频(周期0.01s)selecetsignal=”10”秒表计数器异步清零selecetsignal=”11”倒计时计数器系统总体模块电路图分别与1个数码管相连4个LED灯1个LED灯Sw12Sw13Sw10Sw4Sw5Sw0Sw8Sw7Sw6Sw1Sw2Sw11Sw350MHZSw93系统以及模块硬件电路设计1、分频电路设计 根据上式得到周期分别为1s,0.01s,0.5s的时钟。附图2系统硬件电路设计 2、引脚分配接口名称类型(输入/输出)引脚号说明clkinINPIN_N2晶振50MHz时钟输入sw0INPIN_N25时钟时针清零复位键sw1INPIN_N26时钟秒针清零复位键sw2INPIN_P25时钟时针设置键sw3INPIN_AE14时钟分针设置键sw4INPIN_AF14闹钟时间清零复位键sw5INPIN_AD13闹钟分针设置键sw6INPIN_AC13闹钟时针设置键sw7INPIN_C13倒计时清零重置键sw8INPIN_B13秒表清零重置键sw9INPIN_A13数码管显示数据低位选择键sw10INPIN_N1数码管显示数据高位选择键sw11INPIN_P1时钟秒针清零复位键sw12INPIN_P2倒计时器启动键sw13INPIN_T7秒表启动键zdledOUTPIN_W19整点报时显示LED灯seg16OUTPIN_V13数码管显示秒表100计时器最低位数值seg15OUTPIN_V14seg14OUTPIN_AE11seg13OUTPIN_AD11seg12OUTPIN_AC12seg11OUTPIN_AB12Seg20OUTPIN_AF10Seg26OUTPIN_AB24数码管显示秒表100计时器高位数值Seg25OUTPIN_AA23Seg24OUTPIN_AA24Seg23OUTPIN_Y22Seg22OUTPIN_W21Seg21OUTPIN_V21Seg20OUTPIN_V20seg30OutputPin_AB23秒钟低位数码管显示秒钟高位数码管显示分钟低位数码管显示分钟高位数码管显示时针低位数码管显示时针高位数码管显示闹钟报时显示LED灯seg31OutputPin_V22seg32OutputPin_AC25seg33OutputPin_AC26seg34OutputPin_AB26seg35OutputPin_AB25seg36OutputPin_Y24seg40OutputPin_Y23seg41OutputPin_AA25seg42OutputPin_AA26seg43OutputPin_Y26seg44OutputPin_Y25seg45OutputPin_U22seg46OutputPin_W24seg50OutputPin_U9seg51OutputPin_U1seg52OutputPin_U2seg53OutputPin_T4seg54OutputPin_R7seg55OutputPin_R6seg56OutputPin_T3seg60OutputPin_T2seg61OutputPin_P6seg62OutputPin_P7seg63OutputPin_T9seg64OutputPin_R5seg65OutputPin_R4seg66OutputPin_R3seg70OutputPIN_R2seg71OutputPIN_P4seg72OutputPIN_P3seg73OutputPIN_M2seg74OutputPIN_M3seg75OutputPIN_M5seg76OutputPIN_M4seg80OutputPIN_L3seg81OutputPIN_L2seg82OutputPIN_L9seg83OutputPIN_L6seg84OutputPIN_L7seg85OutputPIN_P9seg86OutputPIN_N9nled0OutputPIN_AE23nled1OutputPIN_AF23nled2OutputPIN_AB21nled3OutputPIN_AC224 系统的VHDL设计1、1Hz分频模块 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fenpin1hz is port( clk:in std_logic; clk1hz: out std_logic );end; architecture prt of fenpin1hz is signal tem_clk1: std_logic_vector(24 downto 0); signal div1: std_logic;begin process(clk) constant bb:std_logic_vector(24 downto 0):=1011111010111100000111111;begin if clkevent and clk=1 then if tem_clk1=bb then tem_clk10); div1=not div1; else tem_clk1=tem_clk1+1;end if;end if;end process;clk1hz=div1;end prt;2、2Hz分频模块 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fenpin2hz is port( clk:in std_logic; clk2hz: out std_logic );end; architecture prt of fenpin2hz is signal tem_clk2: std_logic_vector(23 downto 0); signal div2: std_logic;begin process(clk) constant bb:std_logic_vector(23 downto 0):=101111101011110000011111;begin if clkevent and clk=1 then if tem_clk2=bb then tem_clk20); div2=not div2; else tem_clk2=tem_clk2+1;end if;end if;end process;clk2hz=div2;end prt;3、100Hz分频模块 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fenpin100hz is port( clk:in std_logic; clk100hz: out std_logic );end; architecture prt of fenpin100hz is signal tem_clk3: std_logic_vector(17 downto 0); signal div3: std_logic;begin process(clk) constant bb:std_logic_vector(17 downto 0):=111101000010001111;begin if clkevent and clk=1 then if tem_clk3=bb then tem_clk30); div3=not div3; else tem_clk3=tem_clk3+1;end if;end if;end process;clk100hz=div3;end prt;4、秒计时模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity second is port(clk:in std_logic; setmin:in std_logic; reset:in std_Logic; enmin:out std_logic; sh:buffer std_logic_vector(3 downto 0); sl:buffer std_logic_vector(3 downto 0);end second;architecture prt of second isbeginprocess(clk,reset,setmin)beginif(setmin=1) thenenmin=clk;elsif (reset=1)thensh=0000;sl=0000;else if(clkevent and clk=1)thenif sh=0101and sl=1001then enmin=1;sh=0000;sl=0000;else enmin=0;end if;if sl=9 then sl=0000; sh=sh+1;else sl=sl+1;end if;end if;end if;end process;end; 5、分计时模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity minute is port(clk:in std_logic; seth:in std_logic; reset:in std_Logic; enh:out std_logic; mh:buffer std_logic_vector(3 downto 0); ml:buffer std_logic_vector(3 downto 0);end minute;architecture prt of minute isbeginprocess(clk,reset,seth)beginif(seth=1) thenenh=clk;elsif (reset=1)thenmh=0000;ml=0000;else if(clkevent and clk=1)thenif mh=0101and ml=1001then enh=1;mh=0000;ml=0000;else enh=0;end if;if ml=9 then ml=0000; mh=mh+1;else ml=ml+1;end if;end if;end if;end process;end;6、时计时模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity hour is port(clk:in std_logic; reset:in std_Logic; hh:buffer std_logic_vector(3 downto 0); hl:buffer std_logic_vector(3 downto 0);end hour;architecture prt of hour isbeginprocess(clk,reset)beginif (reset=1)thenhh=0000;hl=0000;elseif(clkevent and clk=1)thenif hh=0010and hl=0011then hh=0000;hl=0000;elsif hl=9 then hl=0000; hh=hh+1;else hl=hl+1;end if;end if;end if;end process;end;7、秒表模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity miaobiao is port( clk2:in std_logic; resetsc:in std_logic; ll,lh,sl1,sh1,ml1,mh1:out std_logic_vector(3 downto 0); startsc:in std_logic ); end;architecture prt of miaobiao is signal b,c,d,e,f,g: std_logic_vector(3 downto 0); signal c1,e1:std_logic;begin process(clk2,resetsc,startsc) begin if resetsc=1 then b=0000;c=0000; elsif rising_edge(clk2) then if startsc=1 then if b=1001 and c=1001then b=0000;c=0000;c1=1;elsif b=1001 then b=0000;c=c+1;c1=0;else b=b+1;c1=0; end if; end if;end if;ll=b;lh=c;end process;process(c1,resetsc,startsc) beginif resetsc=1 then d=0000;e=0000; elsif rising_edge(c1) then if startsc=1 then if d=1001 and e=0101then d=0000;e=0000;e1=1;elsif d=1001 thend=0000;e=e+1;e1=0; else d=d+1;e1=0; end if; end if;end if;sl1=d;sh1=e;end process;process(e1,resetsc,startsc) beginif resetsc=1 then f=0000;g=0000; elsif rising_edge(e1) then if startsc=1 then if f=1001 and g=0101then f=0000;g=0000;elsif f=1001 then f=0000;g=g+1;else f=f+1; end if; end if;end if;ml1=f;mh1=g;end process;end;8、闹钟模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity naozhong is port( clk2hz,clk1hz,seth,setm,reset:in std_logic; r1,r2,r3,r4: buffer std_logic_vector(3 downto 0); sl,sh,ml,mh,hl,hh:in std_logic_vector(3 downto 0); led:out std_logic_vector(3 downto 0) ); end;architecture ptr of naozhong is beginprocess(clk2hz,setm,reset) -闹钟分计数器begin if reset=1 then r2=0000; r1=0000; elsif rising_edge(clk2hz) then if setm=1 then -手动进行闹钟分设定 if r2=0101 and r1=1001 then r1=0000; r2=0000; elsif r1=1001 then r1=0000;r2=r2+1; else r1=r1+1; end if; end if; end if;end process;process(clk2hz,seth,reset) -闹钟小时计数器begin if reset=1 then r4=0000;r3=0000; elsif rising_edge(clk2hz) then if seth=1 then -手动进行闹钟小时设定 if r4=0010 and r3=0011 then r3=0000; r4=0000; elsif r3=1001 then r3=0000;r4=r4+1; else r3=r3+1; end if;end if;end if;end process;process(clk1hz,sl,sh,ml,mh,hl,hh,r1,r2,r3,r4) -数字钟与闹钟相符,以LED灯进行提示begin if rising_edge(clk1hz) thenif ml=r1 and mh=r2 and hl=r3 and hh=r4then led=ml;else led=0000;end if;end if;end process;end;9、倒计时模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity daojishu is port( clk3:in std_logic; resetdjs:in std_logic; startdjs:in std_logic; sl2,sh2,ml2,mh2:out std_logic_vector(3 downto 0); djsled:out std_logic ); end;architecture ptr of daojishu is signal z1,z2,z3,z4:std_logic_vector(3 downto 0);-倒计时计数器信号 signal alz1:std_logic;beginprocess(clk3,resetdjs,startdjs) -倒计时计数器begin if resetdjs=1 then z2=0101;z1=1001;alz1=0; elsif startdjs=1 then if rising_edge(clk3) then if z2=0000 and z1=0000then z2=0101;z1=1001;alz1=1;elsif z1=0000 then z1=1001;z2=z2-1;alz1=0;else z1=z1-1;alz1=0; end if; end if;end if; sl2=z1;sh2=z2;end process;process(alz1,resetdjs) begin if resetdjs=1 then z4=0000;z3=0101; elsif startdjs=1 then if rising_edge(alz1) then if z4=0000 and z3=0000then z4=0000;z3=0101;elsif z3=0000 then z3=0101;z4=z4-1;else z3=z3-1; end if; end if;end if; ml2=z3;mh2=z4;end process;process(z1,z2,z3,z4,clk3) begin if rising_edge(clk3)then if z1=0000 and z2=0000 and z3=0000 and z4=0000 then djsled= 1;else djsled=0;end if;end if;end process;end;10、选择器模块library ieee;use ieee.std_logic_1164.all;entity xuanze is port( vis1,vis2,vis3,vis4,vis5,vis6,vis7,vis8: out std_logic_vector(3 downto 0); a,b,c,d,e,f: in std_logic_vector(3 downto 0);-秒表计数器信号 r1,r2,r3,r4:in std_logic_vector(3 downto 0);-闹钟信号 z1,z2,z3,z4:in std_logic_vector(3 downto 0);-倒计时计数器信号 sl,sh,ml,mh,hl,hh:in std_logic_vector(3 downto 0);-数字钟计数器信号 load:in std_logic_vector(1 downto 0);end;architecture pty of xuanze is beginprocess( a,b,c,d,e,f,r1,r2,r3,r4,z1,z2,z3,z4,sl,sh,ml,mh,hl,hh,load) begin if load=01 then vis1=a;vis2=b;vis3=c;vis4=d;vis5=e;vis6=f; elsif load=10 then vis1=1111;vis2=1111;vis3=r1;vis4=r2;vis5=r3;vis6=r4;vis7=1111;vis8=1111; elsif load=11 then vis1=1111;vis2=1111;vis3=z1;vis4=z2;vis5=z3;vis6=z4;vis7=1111;vis8=1111; else vis1=1111;vis2=1111;vis3=sl;vis4=sh;vis5=ml;vis6=mh;vis7=hl;vis8q1q1q1q1q1q1q1q1q1q1q1=1111111; end case;end process;end;12、整点报时模块library ieee;use ieee.std_logic_1164.all;entity zdbaoshi is port(clkzd:in std_logic; zdsl,zdsh,zdml,zdmh:in std_logic_vector(3 downto 0); ledzd: out std_logic );end;architecture prt of zdbaoshi is begin process(clkzd) begin if clkzdevent and clkzd=1 then if zdsl=0000 and zdsh=0000 and zdml=0000 and zdml=0000 then ledzd=1; else ledzd=0; end if; end if;end process;end;顶层设计模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity clocknew is port( clkin:in std_logic;-50MHZ输入信号 mset,sreset,hset,mreset,hreset:in std_logic;-数字时钟时分秒设置/复位控制键 resetsc1,startsc1:in std_logic;-秒表复位/开始控制键 resetdjs1,startdjs1:in std_logic;-倒计时复位/开始控制键 nseth,nsetm,nreset:in std_logic;-闹钟时分设置/复位控制键 selecetsignal:in std_logic_vector(1 downto 0);-数据选择器选择信号 djsled1:out std_logic;-倒计时结束显示键 zdled:out std_logic;-整点报时指示灯 nled:out std_logic_vector(3 downto 0);-闹钟报时指示灯 seg1,seg2,seg3,seg4,seg5,seg6,seg7,seg8:out std_logic_vector(6 downto 0)-数码管显示 );end;architecture prt of clocknew is-1hz分频模块元件例化- component fenpin1hz port( clk:in std_logic; clk1hz: out std_logic );end component;-2hz分频模块元件例化- component fenpin2hz port( clk:in std_logic; clk2hz: out std_logic ); end component;-100hz分频模块元件例化- component fenpin100hz port( clk:in std_logic; clk100hz: out std_logic ); end component;-秒计时模块元件例化- component second port(clk:in std_logic; setmin:in std_logic; reset:in std_Logic; enmin:out std_logic; sh:buffer std_logic_vector(3 downto 0); sl:buffer std_l
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 嫁妆返还协议书模板
- 宿舍安全合同协议模板
- 学校驿站转让合同协议
- 店铺定位合同协议
- 委托购买车协议书范本
- 废渣处置合同协议
- 委外外包厂合作合同协议
- 宠物寄卖合同协议
- 干副购销合同协议
- 委托研发保密合同协议
- DB32-T 5082-2025 建筑工程消防施工质量验收标准
- 室速的观察及护理
- 贵州贵州路桥集团有限公司招聘考试真题2024
- 新湘教版三年级美术下册教案
- 急救中心担架工考核管理办法
- 自考中国近代史押题及答案
- 四川2025年03月四川省攀枝花市仁和区事业单位春季引进15名人才笔试历年参考题库考点剖析附解题思路及答案详解
- 4月15日全民国家安全教育日主题宣传教育课件
- 中小学无人机基础知识
- 2025年安徽淮北市建投控股集团有限公司招聘笔试参考题库含答案解析
- 通风空调施工培训
评论
0/150
提交评论