(完整word版)基于eda的数字钟程序设计

上传人:pu****.1 文档编号:548065596 上传时间:2022-10-10 格式:DOC 页数:22 大小:1.25MB
返回 下载 相关 举报
(完整word版)基于eda的数字钟程序设计_第1页
第1页 / 共22页
(完整word版)基于eda的数字钟程序设计_第2页
第2页 / 共22页
(完整word版)基于eda的数字钟程序设计_第3页
第3页 / 共22页
(完整word版)基于eda的数字钟程序设计_第4页
第4页 / 共22页
(完整word版)基于eda的数字钟程序设计_第5页
第5页 / 共22页
点击查看更多>>
资源描述

《(完整word版)基于eda的数字钟程序设计》由会员分享,可在线阅读,更多相关《(完整word版)基于eda的数字钟程序设计(22页珍藏版)》请在金锄头文库上搜索。

1、数字电路课程设计报告一、课题要求:(1)技术要求:1、掌握多功能数字钟的工作原理。2、应用EDA技术,VHDL语言编写程序。3、层次化设计,设计原理框图。4、硬件设计及排版。(2)功能要求:1、基本功能:能进行正常的时、分、秒计时功能,分别由6个数码管显示24小时、60分钟、60秒的计数器 显示。2、扩展功能:(1)能够利用按键实现“校时” “校分” “清零”功能。(2)能利用扬声器做整点报时,整点前 五秒短声,整点长声。(3)本人工作:负责软件部分”编写各部分模块的VHDL程序,并且锁定引脚,将程序下载到芯片中。二、设计方案:n数字钟原理框图rwmri.即 wn.uj 3口 Bl n*sp.

2、Dqhip. eg wp q 理伦血rrand 口yiiEiir原理框图:mlp 罔MR H#IPJ|一共有11个小模块:分频,片选,按键,小时,分,秒,显示模块,七段显示译码器,报 时,扬声,36译码器。左边第一个是时钟信号输入端,50Mhz到分频模块。第二个为清零按键,第三个为校分按键,第四个为校时按键。右边第一个为七段显示译码器输出端,第二个为扬声器输出端,第三个为6个数码管输出端。中间模块为数字钟的核心,有计时,报时,校时功能。三、单元模块设计1、分频模块library ieee;use ieee. std_l.oqic_1164 all;entlty fenpin 13port(el

3、k:in stdlogic;qlOOOj qSj ql:out std_logic;end fenpin;architecture cccarc cf fenpin is signal x: std_l.ogic;beginprocess(elk)variable ent:integer range 0 to 2999; beginif cllt event and cllc= 1 11 thenif斗999 thenent: =cn匸+1;elseent:=0;x=not x;end if;end if;qlOOO-=x;end process;process x)var iab le cn

4、t2 : integer reinge 0 to 999; variable y:stdlogic;beginif x1evenv and x= 1 11 thenif cnt2999 thencnt2:=cnt2+l; qK-1 O;elsecnr2:=;ql=11;snd if;end i;if x1 event and x=111 theny:3not y;end if;qS=y;end process;end cccauc;该模块是将时钟脉冲50Mhz分频到1000、500和1,分别给报时模块和及时模 块。2、秒模块Library ieee;use ieee s匕1 丘马.厲丄丄:us

5、e leee . std_logicr_unsigneci. al 1;ent ity niiao iemlao*ielksec13.OclrsttOp. 0cdiinstLport fclJcclr : in std_Logic;seel,secO:out 已匚d_logic_vectDr(3 dounto 0):ua1:oux std_logic);end miac;arrbir.eeture mian_arc of itiiao issignal cntl, cntO : std_logic_vector (3 doirnlLO 0);signal mm; std_logic;tiepi

6、nprocess(clk clr)loeginif clr= CT then ent L=,*0000 ”: crLtO-F,OOOO,r;e Ise if c Ik event and c 1 lt= 1 thenif (ent 1=5 and cnt0=9) then ent 1=*0000;cnc0=0000H;Ttnn= 1 O; eIse if (cnt0=9) then, ent l=cnt 1+1; cntO= 0000,f; mra= 0 1 ;else cnt-K-cnt 1; Gnt0-cnt0+l;mii- * 0 1 :end end if;f (cnc 1=5 and

7、 cnr.0=8) then. ttnn= 1 11 ;end if;end if;end i;end process:sec l=cnt-l; secCK-cntO; col=irtm; end rtiianarc;仿真图dkJfcdILimjuwinnmjmnjuwinmjmjvumwmnwLmmwnnjmjmnnwnnjmjmnjuwuv_n:0)(-X7I3f:X5JG:r1 -jj)Ps10.f4 ssa.-tf ns30.TJ1S軌“5L2 IIS社牝“U.K osSi 92-isE sn. rLrLrLrLrLrLrLnjTrLrLrLrLrLrLrmjTmwvLrLTVirLr

8、LrLrL-JTJ_r_L_mr_L_mrL_nnL_nrL_nr-|_rnrL_rmnninrnrnri. . ri . R计时输出为秒的数该模块为60进制计数器,有分频模块得到的1hz进行计时, 值,在计时到59时进位1到co端。当按下S3时,秒清零。3、分模块|1 iJarary ieee;use leee - std_lagic!_1164 自丄1;eniminip. OJelkminDp.Dm2.ifenuse ie&e . stdlogic_un3igned. all; entity fen is port(enl,clk:in stdlogic;mini,iciinO: out

9、std_logic_vectDr (3 dovnto 0);co2:out std_logic);iriJtend fen;architecture min arc of fen issigna1 cout2;coutl:std_logic_vector(3 dounto 0);s i gn1 cc:stdiogic;beginprocess(elk,enl)beginIf enl11* thenif clk1event and clk=11)thenif (cout2=5 and coutl=9 thsn caut2=F,口dCJCI;coutl=p0000F*;cc=1 O;el3e if

10、 (coutl9) then cout2-cout2 + L; 31 = ,0000,; cc = 0 1 ;else cout2-coxit2;caucl=couc 1+1;cc= 1 0* ;end if;i(coutZ-S and coutL=S) then cc=111;end if;end i;end if;end i;end process;co2=cc;n)inl-c!aut2;min0coutl;end minarc;10.24皿 叩呻MT2 ui豹.爭 g51.2 m&1. U m71.3 us削.甲 x92. 4 mJULrLrLTLrLruLrLJULrLRrLnrLrL

11、rLrLrLRrLrLrLrLrLrLrLruLrLjLrLruuLruLrLjuLrLRrLrLruLrLrLrLnRrLJLrLruLruuLrLfULrLnrLj1;I厂P:HjI:JH *r riiti Ji仿真图elkid 0 vinJTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTjTTTTTJ-LrTTTTTTTTT-rLrLrLrL-rLrLnJ in j nJ : fej&J E 和砧: 田诚1dD(iD0 :in0Cio0 :该模块也为60进制计数器,计时输出为分的数值。在EN信号有效且时钟来时, 计数器加1、在s2按下时,EN使能端有效,实现校分功能。4、

12、时模块liferary ieee;use ieee sDd logiCllE血.曰11;hour一enihip.Cjelk hD3.O:instT1use ieee std_loic_unsigned a).丄;Ent;i匸 luour ispoirt (en2 t cll: in std logic;hlzhO:out std_logic_vector(3 downto 0); end hour;architecture hoMr_arc of hour issignal cout2,cout1:std logic_vector(3 downto 0);11 beginprocess(elk

13、,en2)beginif 1 thenif (elk1event and clk= * 11)theni:f (cout2=2 and cout 1=3) then cout2= F,0000r,;coutl=,r0000,r; else if (cout 1=9) then cout2=cout2+l; coutl=rrOOOOTF;els亡 cout2=cout2;coutK-cout1+1:end if;end if;end if;end if;end process;hK-coutS;hO std logic 1164 * al1; use ieee-std logic unsigned,al1;-entity pianxuan isport(elk:in 自tdLogic;q: out std logic vector (2 downto O);end pianxuan;archite匚tLiii:皀 selarc of pianxuan isbeginprocess(elk)variab le ent: std 丄ogic_viectoiz (2 downto 0); beginit elk1event and clk=111 thenif cnt5 then

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业/管理/HR > 商业计划书

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号