




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、课程设计报告设计名称: eda技术及应用课程设计报告作品名称:电子数字钟院(系): *专业班级:*姓名: *8学号:*8设计时间: 2011年6月18日设计地点:实验室目录一、题目二、任务与要求三、课程设计摘要及整体方框图四、课程设计原理分析五、各模块设计1、分频器模块2、 24小时时钟综合模块3 校时模块4、报时、响铃模块5、译码模块6、输出选择模块7、最终原理图六、心得体会与收获七、试验中遇到的问题及解决方法.一:题目本实验利用quartusii软件,结合所学的数字电路的知识设计一个24时多功能数字钟,具有正常时、分、秒计时,动态显示,整点报时、闹钟的功能。二:任务与要求本实验的任务就是设
2、计一个多功能数字钟,要求显示格式为小时分钟或者 分钟秒钟,整点报时,报时时间为40秒,即从整点前40秒开始进行报时提示,led灯开始闪烁,过整点后,按键停止闪烁。调整时间的按键用按键模块的k1和k2,k1调节小时,每按下一次,小时增加一个小时,k2调整分钟,每按下一次,分钟增加一分钟。还要通过按键来控制时钟与秒表显示的切换功能,按键k没按下时为分秒时钟显示功能,按下时为时分显示功能。开关按钮按两下复位,复位后全部显示0000三:课程设计摘要及方框图1:具有时,分,秒计数显示功能,以24小时循环计时,其中cnt60模块中counter_sec_l和counter_min_l为60进制bcd计数电
3、路,实现秒计时和分计时功能,shi24模块为24进制bcd码计时电路,实现小时计时功能,整个计数器具有调秒调分,调时功能,而且显示译码模块中在整点时具有报时功能。还可以设置整点报时的时间。通过切换能够实现时分与分秒转换的功能。2:有驱动8位七段共阴极扫描数码管的片选驱动信号输出和七段码输出,能够实现数字钟的功能。四:课程设计原理分析及相关的概述(1)时、分、秒计时器 时计时器为一个24进制计数器,分、秒计时器均为60进制计数器。当秒计时器接受到一个秒脉冲时,秒计数器开始从1计数到60,此时秒显示器将显示00、01、02、.、59、00;每当秒计数器数到00时,就会产生一个脉冲输出送至分计时器,
4、此时分计数器数值在原有基础上加1,其显示器将显示00、01、02、.、59、00;每当分计数器数到00时,就会产生一个脉冲输出送至时计时器,此时时计数器数值在原有基础上加1,其显示器将显示00、01、02、.、23、00。即当数字钟运行到23点59分59秒时,当秒计时器在接受一个秒脉冲,数字钟将自动显示00点00分或这00分00秒。(2)校时电路 当开关按下时为校时档时,电子钟秒计时工作,通过时、分校时开关分别对时、分进行校对,开关每按1次,与开关对应的时或分计数器加1,当调好分秒的设置时,再按下显示的切换键,调节时分。当调至需要的时与分时,继续按调时键;,电子钟从设置的时间开始往后计时。(3
5、)整点报时由计时模块输出分与秒的串联信息。对分与秒进行监测,当时钟走至每个小时的59分50秒时开始启动整点报时电路,当时钟走至00分00秒时,报时结束。当报时信号输出时,指示灯亮,需要有一个键将其熄灭。五各个模块设计1、分频器模块:由于实验台仅提供50mhz频率,所以,需要通过分频器电路分出所需频率的信号,对于时钟来说,最基本的是1hz信号,而对于数码管扫描最基本的是1khz,秒表是100hz,所以先通过分频器把50mhz分频为1hz和1khz。其vhdl语言如下:1hz模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_
6、arith.all;use ieee.std_logic_unsigned.all;entity c1hz isport(clk:std_logic; clk1:out std_logic);end entity c1hz;architecture art of c1hz isbeginprocess(clk) is variable cnt : integer range 0 to 49999999; begin if clk=1 and clkevent then if cnt=49999999 then cnt:=0; else if cnt25000000 then clk1=1; e
7、lse clk1=0; end if; cnt:=cnt+1; end if; end if; end process; end art ;生成框图1khz模块use ieee.std_logic_1164.all;use ieee.std_logic_arith.all; library ieee;use ieee.std_logic_unsigned.all;entity c1khz isport(clk:std_logic; clk2:out std_logic);end entity c1khz;architecture art of c1khz isbeginprocess(clk)
8、 is variable cnt : integer range 0 to 49999; begin if clk=1 and clkevent then if cnt=49999 then cnt:=0; else if cnt25000 then clk2=1; else clk2=0; end if; cnt:=cnt+1; end if; end if; end process; end art ;生成框图224小时时钟模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.
9、std_logic_arith.all;entity shuzizhong isport(clk_change ,ds: in std_logic;s_en,m_en,h_en:in std_logic;sel:in std_logic; secout,minout,hourout :out std_logic;sl,sh,ml,mh,hl,hh:out std_logic_vector(3 downto 0);a:out std_logic_vector(15downto 0);end shuzizhong;architecture behav of shuzizhong issignal
10、low_rega,high_rega,low_regb,high_regb,low_regc,high_regc :std_logic_vector(3 downto 0):=0000;signal sout,mout,hout :std_logic :=0;signal cnt:std_logic:=1; begin process (ds) begin if dsevent and ds=0 then -假设按键是低电平有效; cnt=not cnt; end if; end process;-秒的60进制进制 counter_sec_l : process(clk_change,cnt)
11、 begin sl=low_rega;sh=high_rega;ml=low_regb;mh=high_regb;hl=low_regc;hh=high_regc; if(cnt=0) then low_rega=low_rega; -定时 elsif clk_changeevent and clk_change=1 then if s_en=1 then if low_rega=1001 then low_rega = 0000; else low_rega = low_rega+1; end if; end if; end if; end process counter_sec_l; co
12、unter_sec_h : process(clk_change,low_rega) begin if(cnt=0) then high_rega=high_rega; elsif clk_changeevent and clk_change=1 then if s_en=1 then if low_rega=1001 then if high_rega =0101then high_rega = 0000; else high_rega = high_rega+1; end if; end if; end if; end if; end process counter_sec_h; sout
13、 = 1 when low_rega=1001 and high_rega=0101 else 0; -分钟的60进制设置 counter_min_l : process(clk_change) begin if(cnt=0) then low_regb=low_regb; elsif clk_changeevent and clk_change=1 then if m_en=1 then if sout=1or sel=0 then if low_regb=1001 then low_regb = 0000; else low_regb = low_regb+1; end if; end i
14、f; end if; end if; end process counter_min_l; counter_min_h : process(clk_change,low_regb) begin if(cnt=0) then high_regb=high_regb; elsif clk_changeevent and clk_change=1 then if sout=1or sel=0then if m_en=1 then if low_regb=1001 then if high_regb =0101then high_regb = 0000; else high_regb = high_r
15、egb+1; end if; end if; end if; end if; end if; end process counter_min_h; mout = 1 when low_regb=1001 and high_regb=0101and sout=1 else 0; -小时的24进制设置counter_hour_l : process(clk_change) begin if(cnt=0) then low_regc=low_regc ; elsif clk_changeevent and clk_change=1 then if h_en=1 then if mout=1or se
16、l=0then if low_regc=1001or hout=1 then low_regc = 0000; else low_regc = low_regc+1; end if; end if; end if; end if; end process counter_hour_l; counter_hour_h : process(clk_change,hout) begin if(cnt=0) then high_regc=high_regc ; elsif clk_changeevent and clk_change=1 then if mout=1 or sel=0then if h
17、_en=1 then if hout=1 then high_regc=0000; else if low_regc=1001 then high_regc = high_regc+1; end if; end if; end if; end if; end if; end process counter_hour_h; hout = 1 when low_regc=0011 and high_regc=0010 else 0; secout=sout;minout=mout;hourout=hout; a=high_regb&low_regb&high_rega&low_rega ; end
18、 behav; 生成模块图3.校时模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity key_press isport( set ,mode: in std_logic; clk1khz,clk1hz: in std_logic; secout,minout: in std_logic; clk_change,clk2hz_en:out std_logic ; sel,s_ce,m_ce,h_ce:out std_logic; s_en,m_en,h_en:out std_logic
19、 ); end key_press; architecture beh of key_press is signal key1,key2:std_logic; signal sce_reg, mce_reg ,hce_reg:std_logic ; signal ssl,ssen,mmen,hhen:std_logic; signal con : integer range 0 to 4 :=0; -按键按下(延时) begin key_press2 : process(set,clk1khz) variable cnt :integer range 0 to 999; begin if se
20、t=0 then if clk1khzevent and clk1khz=1then if cnt=50 and set=0 then cnt :=cnt+1; key2 = 1; else cnt:=cnt+1;key2 = 0; end if; end if; else cnt:=0; key2=0; end if; end process key_press2; key_press1 : process(mode,clk1khz) variable cnt :integer range 0 to 999; begin if mode=0 then if clk1khzevent and
21、clk1khz=1then if cnt=50 and mode=0 then cnt :=cnt+1; key1 = 1; else cnt:=cnt+1;key1 = 0; end if; end if; else cnt:=0; key1=0; end if; end process key_press1; count : process(key1,key2) begin if key1event and key1=1 then if con=4 then con=0; else con ssl=1; sce_reg = 0;ssen =1; mce_reg = 0;mmen =1; h
22、ce_reg = 0;hhen =1; clk2hz_en ssl=0; sce_reg = 0;ssen =1; mce_reg = 0;mmen =1; hce_reg = 0;hhen =1; clk2hz_en ssl=0; sce_reg = 1;ssen =1; mce_reg = 0;mmen =0; hce_reg = 0;hhen =0; clk2hz_en ssl=0; sce_reg = 0;ssen =0; mce_reg = 1;mmen =1; hce_reg = 0;hhen =0; clk2hz_en ssl=0; sce_reg = 0;ssen =0; mc
23、e_reg = 0;mmen =0; hce_reg = 1;hhen =1; clk2hz_en ssl=0; sce_reg = 0;ssen =1; mce_reg = 0;mmen =1; hce_reg = 0;hhen =1; clk2hz_en s_ce=sce_reg; m_ce=mce_reg; h_ce=hce_reg; clk_change s_ce=ssen; m_ce=mmen; h_ce=hhen; clk_change s_ce=ssen; m_ce=secout; h_ce=minout; clk_change=clk1hz; end case; end pro
24、cess sel_pro; sel=ssl;s_en=ssen;m_en=mmen;h_en=hhen; end beh;生成图4.报时模块 use ieee.std_logic_arith.all; -整点报时 entity baoshi isport(clk1khz,clk1hz : in std_logic;a:in std_logic_vector(15 downto 0);sel:in std_logic;led:out std_logic); end baoshi; architecture zhong of baoshi is signal c1,liang:std_logic;
25、 signal cnt:std_logic:=1; begin process (sel) begin if selevent and sel=1 then -假设按键是低电平有效; cnt c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1=0; end case; end process led_liang; bs: process(c1,cnt) begin if cnt=0 then if c1=1 then liang=1; else liang=0; end if; else liang=0; end if; end process bs; led dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout dataout null; end case; end process; end ;生成图6.
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 妇幼保健员职业知识整合试题及答案
- 妇幼保健员职业发展试题及答案
- 茶艺师必读的参考书籍试题及答案
- 2025年计算机专业技术资格考试必看题型试题及答案
- 2025计算机技术与软件资格初级考试高频试题及答案
- 2024年人力资源管理师考试常识与试题及答案
- 婴儿安全护理措施的落实方法试题及答案
- 二零二五年度城市医疗卫生一体化双向转诊合作协议
- 2025年度租赁住宅安全保障与居民安全教育培训协议
- 二零二五年度专科个体诊所医生长期聘用协议
- 生产调度培训
- 2024年镇江市高等专科学校高职单招语文历年参考题库含答案解析
- 语文-山东省2025年1月济南市高三期末学习质量检测济南期末试题和答案
- 小学防汛抗旱安全教育
- 术后患者发热原因及护理课件
- 《电加热熔盐储能热力站技术标准》
- 医院医德医风培训内容
- 服务项目质量保障体系及措施
- 腹腔镜下膀胱癌腹腔镜下膀胱癌根治性切除术+回肠原位新膀胱术教学查房
- 人民代表大会制度:我国的根本政治制度++教案 高中政治统编版必修三政治与法治
- 2024年学生魔方比赛活动方案
评论
0/150
提交评论