首页 EDA课程设计——多功能数字钟课程设计报告

EDA课程设计——多功能数字钟课程设计报告

举报
开通vip

EDA课程设计——多功能数字钟课程设计报告多 功 能 数 字 电 子 钟 一、 设计要求 1、 具有以二十四小时计时、显示、整点报时、时间设置和闹钟的功能。 2、 设计精度要求为1S。 二.系统功能描述 1 . 系统输入:系统状态及校时、定时转换的控制信号为k、mode、set; 时钟信号clk,采用1024Hz; 系统复位信号为reset。输入信号均由按键产生。 系统输出:LED显示输出,蜂鸣器声音信号输出。 多功能数字钟系统功能的具体描述如下: 2.  计时:正常工作状态下,每日按24h计时制计时并显示,蜂鸣器无声,逢整点报时。 3.  校时:在计时...

EDA课程设计——多功能数字钟课程设计报告
多 功 能 数 字 电 子 钟 一、 设计 领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计 要求 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=0 S0:显示计时时间    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 is port(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 is type state_type is(s0,s1,s2,s3,s4,s5,s6,s7); signal state:state_type; begin process(clk,reset,k,set) begin if(rising_edge(clk))then if(reset='1')then state<=s0; end if; case state is when s1=>sel_show<='1'; cht<='1';flashh<='1'; if(k='1')then state<=s2; else state<=s1; end if; when s2=>sel_show<='1'; cmt<='1';flashm<='1'; if(k='1' )then state<=s3; else state<=s2; end if; when s3=>sel_show<='1'; cst<='1';flashs<='1'; if(k='1' )then state<=s0; else state<=s3; end if; when s4=>sel_show<='0'; if(k='0' and set='1')then state<=s5; elsif(k='1' and set='0')then state<=s0; else state<=s4; end if; when s5=>sel_show<='0'; cha<='1';flashh<='1'; if(k='1')then state<=s6; else state<=s5; end if; when s6=>sel_show<='0'; cma<='1';flashm<='1'; if(k='1' )then state<=s1; else state<=s0; end if; when s7=>sel_show<='0'; csa<='1';flashs<='1'; if(k='0' and set='1')then state<=s4; else state<=s7; end if; when s0=>sel_show<='1'; if(k='0' and set='1')then state<=s1; elsif(k='1' and set='0')then state<=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 is port(en,clk : in std_logic; p0,p1  :out std_logic_vector(3 downto 0)); end m24; architecture ar of m24 is signal q0,q1:integer range 0 to 15; begin process(clk) begin if (rising_edge(clk)) then if (en='0' or (q0=3 and q1=2)) then q0<=0;    q1<=0; elsif(q0=9) then q0<=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 is port(en,clk : in std_logic; x: out std_logic; p0,p1:out std_logic_vector(3 downto 0)); end m60; architecture ar of m60 is signal q0,q1:integer range 0 to 15; begin process(clk) begin if (rising_edge(clk)) then if (en='0' or (q0=9 and q1=5)) then q0<=0;    q1<=0;    x<='1'; elsif(q0=9) then q0<=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 is port(f1,f4,c: in std_logic; f :out std_logic); end conl; architecture ar of conl is begin process(c,f1,f4) begin if(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 is port(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 is signal q:integer range 0 to 1; begin process(clk) begin if(rising_edge(clk))then q<=q+1; if(flashh='1'and q=1)then h1<="1111";h2<="1111"; elsif(flashm='1'and q=1)then m1<="1111";m2<="1111"; elsif(flashs='1'and q=1)then s1<="1111";s2<="1111"; else if(sel_show='1' )then s1<=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 is port(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 is begin process(clk) begin if(rising_edge(clk))then if(th1=h1 and th2=h2 and tm1=m1 and m2=tm2)then comout<='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 is port(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 is begin process(m1,m2,s1,s2,compout,clk) begin if(rising_edge(clk))then if(k='1')then if(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 bell<=clk; end if; end if; end process; end ar; 6、 动态显示电路: 设计说明:该模块由一个八选一选择器、一个模8计数器、一译码驱动电路组成。用于控制显示正常计时时间或闹铃时间。 源程序: 八选一模块: library ieee; use ieee.std_logic_1164.all; entity mux8to1 is port (d0,d1,d2,d3,d4,d5,d6,d7: in std_logic_vector(3 downto 0); a :in std_logic_vector(2 downto 0); q : out std_logic_vector(3 downto 0)); end mux8to1; architecture ar of mux8to1 is begin process(d0,d1,d2,d3,d4,d5,d6,d7,a) begin case a is when"000"=>q<=d0; when"001"=>q<=d1; when"010"=>q<=d2; when"011"=>q<=d3; when"100"=>q<=d4; when"101"=>q<=d5; when"110"=>q<=d6; when"111"=>q<=d7; when others=>q<="XXXXXXXX"; end case; end process; end ar; 模八计数器: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; entity m8 is port(en,clk : in std_logic; q :out std_logic_vector(2 downto 0)); end m8; architecture ar of m8 is signal q0 :integer range 0 to 10; begin process(clk) begin if (rising_edge(clk)) then if (en='0' or q0=7) then q0<=0; else q0<=q0+1; end if; end if; q<= conv_std_logic_vector(q0,3); end process; end ar; 译码驱动电路 library ieee; use ieee.std_logic_1164.all; entity tra4to8 is port ( a :in std_logic_vector(3 downto 0); q : out std_logic_vector(6 downto 0)); end tra4to8; architecture ar of tra4to8 is begin process(a) begin case a is when"0000"=>q<="1111110"; when"0001"=>q<="0110000"; when"0010"=>q<="1101101"; when"0011"=>q<="1111001"; when"0100"=>q<="0110011"; when"0101"=>q<="1011011"; when"0110"=>q<="0011111"; when"0111"=>q<="1110000"; when"1000"=>q<="1111111"; when"1001"=>q<="1110011"; when"1111"=>q<="0000000"; when"1110"=>q<="0000001"; when others=>q<="XXXXXXX"; end case; end process; end ar; : 五.各个大模块的防真图 (一)、控制器 (二)、计时校时电路 (三)、显示控制电路 (四)分频器 (五)总体仿真图 六、 总结 初级经济法重点总结下载党员个人总结TXt高中句型全总结.doc高中句型全总结.doc理论力学知识点总结pdf 及体会 通过这次VHDL课程设计,我学到了很多,对于原本掌握的不好的数字逻辑相关知识,在课程设计具体实践中有了很深刻的认识,在对于MAX+plusⅡ的操作上也有很大的提高,增加了操作的熟练程度,现在我已经有信心做任何的设计课题。 在学到新知识的同时,我也认识到了VHDL设计的困难性 最后,感谢老师们帮我处理一些解决不了的问题,还要感谢在我思维陷入困境时给予我指点,让我获得灵感的同学们,谢谢大家!
本文档为【EDA课程设计——多功能数字钟课程设计报告】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_721103
暂无简介~
格式:doc
大小:57KB
软件:Word
页数:29
分类:工学
上传时间:2019-02-09
浏览量:20