




已阅读5页,还剩11页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
多 功 能 数 字 电 子 钟一、 设计要求1、 具有以二十四小时计时、显示、整点报时、时间设置和闹钟的功能。2、 设计精度要求为1S。二系统功能描述1 . 系统输入:系统状态及校时、定时转换的控制信号为k、mode、set; 时钟信号clk,采用1024Hz; 系统复位信号为reset。输入信号均由按键产生。系统输出:LED显示输出,蜂鸣器声音信号输出。多功能数字钟系统功能的具体描述如下:2. 计时:正常工作状态下,每日按24h计时制计时并显示,蜂鸣器无声,逢整点报时。3. 校时:在计时状态显示下,按下“set键”,进入“小时”校准状态,之后按下“k键”则进入“分”校准状态,继续按下“k键”则进入“秒复零”状态,第三次按下“k 键”又恢复到正常计时显示状态。1)“小时”校准状态:在“小时”校准状态下,显示“小时”数码管以1Hz的频率递增计数。2)“分”校准状态:在“分”校准状态下,显示“分”的数码管以1Hz的频率递增计数。3)“秒”复零状态:在“秒复零”状态下,显示“秒”的数码管复零。4. 整点报时:蜂鸣器在“59”分钟的第“51”、“53”、“55”、“57秒发频率为512Hz的低音,在“59”分钟的第“59”秒发频率为1024Hz的高音,结束时为整点。5. 显示:要求采用扫描显示方式驱动6个LED数码管显示小时、分、秒。闹钟:闹钟定时时间到,蜂鸣器发出周期为1s的“滴”、“滴”声,持续时间为10s;闹钟定时显示。6. 闹钟定时设置:在闹钟定时显示状态下,按下“set键”,进入闹钟的“时”设置状态,之后按下“k键”进入闹钟的“分”设置状态,继续按下“k 键”则进入“秒”设置状态,第三次按下“k键”又恢复到闹钟定时显示状态。1) 闹钟“小时”设置状态:在闹钟“小时”设置状态下,显示“小时”的数码管以1Hz的频率递增计数。2) 闹钟:“分”设置状态:在闹钟“分”设置状态下,显示“分”的数码管以1Hz的频率递增计数。三、 控制器的MDS图及多功能数字系统结构逻辑框图1、 控制器的MDS图Mode=1,set=0S0S4S2S3S7S1S5S6Mode=1,set=0K=1K=0 set=1K=1K=0 set=1K=1K=1K=1K=1ChsChtCmsCmtCstCssS0:显示计时时间 s1:调计时的时 s2:调计时的分 s3:调计时的秒 S4:显示闹铃时间 s5:调闹铃的时 s6:调闹铃的分 s7:调闹铃的秒2、 多功能数字系统结构逻辑框图四、 各功能模块设计说明及源程序1、 控制器:设计说明:根据外部的输入控制信号,完成各个状态之间的转换,并在相应状态输出相应的控制信号,从而对整个系统的工作进行控制。控制器:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity contl isport(clk,reset,k,set:in std_logic;cht,cmt,cst,cha,cma,csa,flashh,sel_showflashm,flashs:out std_logic);end contl;architecture ar of contl istype state_type is(s0,s1,s2,s3,s4,s5,s6,s7);signal state:state_type;beginprocess(clk,reset,k,set)beginif(rising_edge(clk)thenif(reset=1)thenstatesel_show=1;cht=1;flashh=1;if(k=1)thenstate=s2;else statesel_show=1;cmt=1;flashm=1;if(k=1 )thenstate=s3;else statesel_show=1;cst=1;flashs=1;if(k=1 )thenstate=s0;else statesel_show=0;if(k=0 and set=1)thenstate=s5;elsif(k=1 and set=0)thenstate=s0;else statesel_show=0;cha=1;flashh=1;if(k=1)thenstate=s6;else statesel_show=0;cma=1;flashm=1;if(k=1 )thenstate=s1;else statesel_show=0;csa=1;flashs=1;if(k=0 and set=1)thenstate=s4;else statesel_show=1;if(k=0 and set=1)thenstate=s1;elsif(k=1 and set=0)thenstate=s4;else state=s0;end if;end case;end if;end process;end ar; 2、 计时校时电路:设计说明:该电路实现计时、校时功能。 源程序: 二十四进制计数器:源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity m24 isport(en,clk : in std_logic; p0,p1 :out std_logic_vector(3 downto 0);end m24;architecture ar of m24 issignal q0,q1:integer range 0 to 15;beginprocess(clk)beginif (rising_edge(clk) thenif (en=0 or (q0=3 and q1=2) thenq0=0; q1=0;elsif(q0=9) thenq0=0; q1=q1+1;else q0=q0+1;end if;end if;p0= conv_std_logic_vector(q0,4);p1= conv_std_logic_vector(q1,4);end process;end ar;六十进制计数器:源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity m60 isport(en,clk : in std_logic;x: out std_logic; p0,p1:out std_logic_vector(3 downto 0);end m60;architecture ar of m60 issignal q0,q1:integer range 0 to 15; beginprocess(clk)beginif (rising_edge(clk) thenif (en=0 or (q0=9 and q1=5) thenq0=0; q1=0; x=1;elsif(q0=9) thenq0=0; q1=q1+1;else q0=q0+1;x=0;end if;end if;p0= conv_std_logic_vector(q0,4);p1= conv_std_logic_vector(q1,4);end process;end ar;选择器源程序:library ieee;use ieee.std_logic_1164.all;entity conl isport(f1,f4,c: in std_logic;f :out std_logic);end conl;architecture ar of conl isbegin process(c,f1,f4)beginif(c=0)then f=f1;else f=f4;end if;end process;end ar;3、 显示控制电路:设计说明:该模块控制最终显示的计时时间还是闹铃时间。源程序:library ieee;use ieee.std_logic_1164.all;entity show_con isport(ts1,ts2,tm1,tm2,th1,th2,bs1,bs2,bm1,bm2,bh1,bh2:in std_logic_vector(3 downto 0);s1,s2,m1,m2,h1,h2,line:out std_logic_vector(3 downto 0);sel_show ,clk,flashs,flashm,flashh:in std_logic);end show_con;architecture ar of show_con issignal q:integer range 0 to 1;beginprocess(clk)begin if(rising_edge(clk)thenq=q+1;if(flashh=1and q=1)thenh1=1111;h2=1111;elsif(flashm=1and q=1)thenm1=1111;m2=1111;elsif(flashs=1and q=1)thens1=1111;s2=1111;elseif(sel_show=1 )thens1=ts1;s2=ts2;m1=tm1;m2=tm2;h1=th1;h2=th2;else s1=bs1;s2=bs2;m1=bm1;m2=bm2;h1=bh1;h2=bh2;end if;end if;end if;line=1110;end process;end ar; 4、 定时比较电路:设计说明:包含两个模块,定时模块和比较模块;完成定时时间的设定、定时时间的输出、计时时间与定时时间比较并输出相应的比较结果控制蜂鸣器的工作,从而实现闹铃功能。比较模块源程序:library ieee;use ieee.std_logic_1164.all;entity com_t_d isport(clk : in std_logic; comout: out std_logic; th1,th2,tm1,tm2,ts1,ts2,h1,h2,m1,m2:in std_logic_vector(3 downto 0); bh1,bh2,bm1,bm2,bs1,bs2:out std_logic_vector(3 downto 0);end com_t_d;architecture ar of com_t_d isbeginprocess(clk)beginif(rising_edge(clk)thenif(th1=h1 and th2=h2 and tm1=m1 and m2=tm2)thencomout=1; bh1= th1; bh2= th2; bm1= tm1; bm2= tm2; bs1= ts1; bs2= ts2;else comout=0; bh1= th1; bh2= th2; bm1= tm1; bm2= tm2; bs1= ts1; bs2= ts2;end if;end if;end process;end ar;定时模块逻辑框图:总图: 5、 报时闹铃电路:设计说明:该模块整点报时和闹铃输出。源程序:library ieee;use ieee.std_logic_1164.all;entity bel isport(m1,m2,s1,s2:in std_logic_vector(3 downto 0); bell:out std_logic;compout,f512,f1024,clk,k:in std_logic);end bel;architecture ar of bel isbeginprocess(m1,m2,s1,s2,compout,clk)beginif(rising_edge(clk)thenif(k=1)thenif(compout=1) then bell=f1024;elsif(m1=0101 and m2=1001 and s1=0101 and s2=0001 )then bell=f512;elsif(m1=0101 and m2=1001 and s1=0101 and s2=0011 )then bell=f512;elsif(m1=0101 and m2=1001 and s1=0101 and s2=0101 )then bell=f512;elsif(m1=0101 and m2=1001 and s1=0101 and s2=0111 )then bell=f512;elsif(m1=0101 and m2=1001 and s1=0101 and s2=1001 )then bell=f512;else bell=clk;end if;else bellqqqqqqqqq=XXXXXXXX;end case;end process;end ar;模八计数器:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;entity m8 isport(en,clk : in std_logic; q :out std_logic_vector(2 downto 0);end m8;architecture ar of m8 issignal q0 :integer range 0 to 10;beginprocess(clk)beginif (rising_edge(clk) thenif (en=0 or q0=7) thenq0=0;else q0=q0+1;end if;end if;qqqqqqqq
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 长沙商贸旅游职业技术学院《中医肿瘤防治学》2023-2024学年第一学期期末试卷
- 鹤壁汽车工程职业学院《景观设计表现技法》2023-2024学年第一学期期末试卷
- 西安邮电大学《藏药矿物学》2023-2024学年第一学期期末试卷
- 湖南电气职业技术学院《写实油画》2023-2024学年第一学期期末试卷
- 2025至2030(mPOS)移动POS终端行业产业运行态势及投资规划深度研究报告
- 大庆职业学院《思想政治教育原理》2023-2024学年第一学期期末试卷
- 大兴安岭职业学院《心理咨询与心理治疗》2023-2024学年第一学期期末试卷
- 2025至2030创新药CRO行业竞争态势及未来投资趋势预测报告
- 哈尔滨医科大学《游泳(二)》2023-2024学年第一学期期末试卷
- 外交学院《工程风险管理》2023-2024学年第一学期期末试卷
- 2025年中小学暑假安全教育主题家长会 课件
- 近视管理白皮书(2025)专家共识-
- 江苏省泰州市实验小学2025年五下数学期末监测试题含答案
- 免疫学(全套课件)
- 热力工程竣工资料模板(含换热站)全
- 半导体中载流子的统计分布和计算
- 心血管诊治与抢救标准操作规程(SOP)
- 桥梁养护与加固教案
- 中南大学自主招生综合素质测试面试试题答题技巧
- 密度计和浮力秤问题
- 国之瑰宝 京剧(说课课件)
评论
0/150
提交评论