电子系统课程设计-基于EDA技术的数字时钟设计.doc_第1页
电子系统课程设计-基于EDA技术的数字时钟设计.doc_第2页
电子系统课程设计-基于EDA技术的数字时钟设计.doc_第3页
电子系统课程设计-基于EDA技术的数字时钟设计.doc_第4页
电子系统课程设计-基于EDA技术的数字时钟设计.doc_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

电子系统课程设计任务书设计题目:基于eda技术的数字时钟设计设计目的:课程设计是一种复杂的学习实践过程。设计过程采用系统设计的方法,先分析任务,得到系统设计的要求,然后进行总体设计,划分子系统模块,然后进行详细设计,编写各个功能子系统vhdl代码并进行功能仿真,最后进行整个系统总装并仿真。设计内容:设计一个采用0.5英寸led数码管显示的数字时钟系统,工作电源5v,它采用24小时制,具有“时”、“分”、“秒”显示,并且可以校正时间显示。设计要求:1. 由石英晶体多谐振荡器20mhz和分频器产生1hz标准秒脉冲;(说明:eda试验箱中晶振频率20mhz,经试验箱内一系列二分频可将频率降低,但无法直接产生1hz信号,需要大家根据实际情况编制分频器得到1hz信号);2. 秒电路、分电路均为60进制计数,时电路为24进制计数;3. 数码管采用动态扫描方式;4. 能动手校时,校时模块功能可以自由发挥。比如可用两个按钮实现校时,a按钮控制调整项目,b按钮调整数字,b按钮还可以根据按下时间长短实现慢调、快调功能。也可以用三个按钮实现增减两个方向的手动校时。校时用按钮开关不能超过4个;5. 扩展内容:1)进入校时状态后,被调整数字以2hz闪烁; 2)24/12小时可调,处于12小时制时,要有am/pm显示; 3)所有开关加入防抖设计; 4)加入检测外部环境亮度功能,夜间自动降低数码管显示亮度; 5)加入整点报时电路; 6)增加秒表功能; 7)增加报闹功能。6.以上电路功能除外部环境亮度检测电路外均由vhdl代码实现层次式设计,顶层电路可以采用eda电路图。设计成果:1. 课程设计说明书,要求内容完整,图表完备,条理清楚,字迹工整,程序完整有相应的注解,仿真波形设计合理有必要的分析,引用资料要注明出处。2. 顶层电路原理图,各层电路vhdl代码及仿真波形。设计说明书目录一、前言二、任务分析和方案设计三、外部输入输出要求四、内部各功能模块 1)分频模块2) 秒计数模块second3) 分计数模块minute 4)时计数模块hour 5)整点报时功能模块alert 6)扫描模块seltime 7)译码显示功能模块display 8)按键防抖模块key五、系统顶层设计图六、各模块块程序七、心得体会参考文献基于eda技术的数字时钟设计一前言 eda简介eda是电子设计自动化(electronic design automation)的缩写,在20世纪90年代初从计算机辅助设计(cad)、计算机辅助制造(cam)、计算机辅助测试(cat)和计算机辅助工程(cae)的概念发展而来的。eda技术就是以计算机为工具,设计者在eda软件平台上,用硬件描述语言hdl完成设计文件,然后由计算机自动地完成逻辑编译、化简、分割、综合、优化、布局、布线和仿真,直至对于特定目标芯片的适配编译、逻辑映射和编程下载等工作。eda技术的出现,极大地提高了电路设计的效率和可操作性,减轻了设计者的劳动强度。二任务分析和方案设计根据设计内容与要求知,本系统由分频模块(20mhz变为1hz)、秒计数模块(六十进制)、分计数模块(六十进制)、时计数模块(二十四进制)、时间数据扫描分时选择模块和8421bcd到7段码的译码模块,再加上一个整点报时模块和按键防抖模块作为发挥部分。设计框图三、外部输入输出要求1.输入接口 代表清零,调时,调分信号reset、sethour、setmin的引脚分别接高电平、key1、key2;代表计数时钟信号clk和扫描时钟信号clkdsp的引脚分别同hz时钟源和200hz(或更高)时钟源相连。.输出接口代表扫描显示驱动信号sel2.0连到sel2、sel1、sel0端,段码信号输出abcdefg连接到7段数码管的段码插口abcdefg端,小数点dp输出端同7段数码管的段码插口dp相连;代表扬声器驱动信号的引脚speaker同扬声器驱动接口speaker相连;代表花样led灯显示的信号引脚lamp2.0同3个led灯相连。四、内部各功能模块:1) freq分频模块: 整点报时用的200hz与时钟用的1hz的脉冲信号,这里的输入信号是20mhz信号,所以要设计两个分频器,将20mhz变为1hz、200hz。程序见后面。例图为1000分频,输入为5mhz,输出为5khz.2)秒计数模块second:60进制,带有进位和清零功能的,输入为1hz脉冲和高电平有效的清零信号reset。程序见后面。3)分计数模块minute60进制,带有进位和置数功能的,输入为1hz脉冲和高电平有效的使能信号en。程序见后面。4)时计数模块hour:24进制,输入为1hz脉冲和高电平有效的使能信号en。程序见后面。5)整点报时功能模块alert:输入为分秒信号,输出为speak信号。程序见后面。6)扫描模块seltime:输入为秒、分、时、扫描时钟clk1,输出为dp和显示控制信号sel。程序见后面。7)译码显示功能模块display:输入为num,输出为led。程序见后面。 8)按键防抖模块key 输入为按键信号和20mhz的时钟信号,输出为ck信号。程序见后面。五、系统顶层设计图六、各模块程序1.分频器a(20mhz分成1hz)程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity freq1 isport(clk:in std_logic;freout:out std_logic);end freq1;architecture behave of freq1 issignal full:std_logic;begin p1:process(clk) variable cqi:std_logic_vector(23 downto 0); begin if clkevent and clk=1 then if cqi0); end if; end if; if cqi=9999999 then full=1; else full=0; end if; end process; p2:process(full)variable cnt1:std_logic;begin if fullevent and full=1 then cnt1:=not cnt1; if cnt1=1 then freout=1; else freout=0; end if; end if; end process;end behave;2.分频器b(20mhz分为200hz)程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity freq2 isport(clk:in std_logic;freout:out std_logic);end freq2;architecture fun of freq2 isbegin p1:process(clk) variable cq:std_logic_vector(17 downto 0); begin if clkevent and clk=1 then if cq0); end if; end if; if cq=99999 then freout=1; else freout=0; end if; end process;end fun;由上面程序原理可得1000分频的波形图3.秒计数器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity second is port( clk,reset,setmin:in std_logic; enmin:out std_logic; daout:out std_logic_vector(6 downto 0);end entity second;architecture fun of second is signal count:std_logic_vector(6 downto 0); signal enmin_1,enmin_2:std_logic; enmin-1为59秒时进位信号 begin enmin-2:由clk调制后的手动调分脉冲信号串 daout=count; enmin_2=(setmin and clk); setmin为手动分控制信号、高电平有效 enmin=(enmin_1 or enmin_2); enmin为向分进位信号 process(clk,reset,setmin)begin if (reset=0) then count=0000000; 若reset为0,则异步清零(即直接复0) elsif (clkevent and clk=1) then 否则,若clk上升沿到 if (count(3 downto 0)=1001) then 若个位计数值恰好到“1001” if(count16#60#) then 又若count小于16#60#(即x“60” ;即60h,为十六进制数写法) if (count=1011001) then 又若count已到59d enmin_1=1;count=0000000;则置进位为1及count复0 else 若count未到59d count=count+7; 则加7,而+7=+1+6,即作“加6校正”,使前面16#60#的 end if; 个位转变为8421bcd的容量,即个位的最大值只能是1001了(注) else 若count不小于16#60#,(即count等于或大于16#60#) count=0000000; 则count复0(有此句,则对无效状态电路可自启动) end if; end if(count16#60#) elsif (count16#60#) then 若个位计数未达到“1001”则转到此句再判:否则若count16#60# count=count+1; 则count加1 enmin_1=0 after 100 ns; 没有进位发生 else 否则,若count不小于16#60#(即count等于或大于16#60#) count=0000000; 则count复0(有此句,则对无效状态电路可自启动) end if; end if(count(3 downto 0)=”1001”) end if; end if(reset=0) end process; end fun; 仿真波形图如下:4.分计数器library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity minute is port( clk,clk1,reset,sethour:in std_logic; enhour: out std_logic; daout:out std_logic_vector(6 downto 0);end entity minute;architecture fun of minute is signal count:std_logic_vector(6 downto 0); signal enhour_1,enhour_2:std_logic;begin daout=count; enhour_2=(sethour and clk1); enhour=(enhour_1 or enhour_2);process(clk,reset,sethour) begin if(reset=0)then count=0000000; elsif(clkevent and clk=1)then if(count(3 downto 0)=1001)then if(count16#60#)then if(count=1011001)then enhour_1=1; count=0000000; else count=count+7; end if; else count=0000000; end if; elsif(count16#60#)then count=count+1; enhour_1=0 after 100 ns; else count=0000000; end if; end if; end process;end fun;仿真波形如下图;5.小时文本library ieee;use ieee .std_logic_1164.all;use ieee .std_logic_unsigned.all;entity hour is port( clk,reset:in std_logic; daout:out std_logic_vector(5 downto 0);end entity hour;architecture fun of hour is signal count:std_logic_vector(5 downto 0);begin daout=count; process(clk,reset) begin if(reset=0)then count=000000; elsif(clkevent and clk=1)then if(count(3 downto 0)=1001)then if(count16#23#)then count=count+7; else count=000000; end if; elsif(count16#23#)then count=count+1; else count=000000; end if; end if; end process;end fun; 仿真波形如下图: 6.报警文本library ieee;use ieee .std_logic_1164.all;use ieee .std_logic_unsigned.all;entity alert is port( clk:in std_logic; dain:in std_logic_vector(6 downto 0); speak:out std_logic; lamp:out std_logic_vector(2 downto 0);end alert;architecture fun of alert is signal count:std_logic_vector(1 downto 0); signal count1:std_logic_vector(1 downto 0);beginspeaker:process(clk) begin speak=10)then count1=00; -count1为三进制加法计数器 else count1=count1+1; end if; end if; end if; end process speaker;lamper:process(clk) begin if(rising_edge(clk)then if(count=10)then if(count=00)then lamp=001; 循环点亮3只led灯 elsif(count=01)then lamp=010; elsif(count=10)then lamp=100; end if; count=count+1; else count=00; end if; end if; end process lamper;end fun;7.时间数据扫描分时选择模块文本library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity seltime is port( clk1,reset:in std_logic; sec,min: in std_logic_vector(6 downto 0); hour:in std_logic_vector(5 downto 0); daout:out std_logic_vector(3 downto 0); dp:out std_logic; sel:out std_logic_vector(2 downto 0);end seltime;architecture fun of seltime is signal count:std_logic_vector(2 downto 0);begin sel=count; process(clk1,reset) begin if(reset=0)then count=101)then count=000; else countdaout=sec(3 downto 0);dpdaout(3)=0; daout(2 downto 0)=sec(6 downto 4); 送出秒十位 dpdaout=min(3 downto 0);dpdaout(3)=0; daout(2 downto 0)=min(6 downto 4); 送出分十位 dpdaout=hour(3 downto 0);dpdaout(3 downto 2)=00; 送出小时十位daout(1 downto 0)=hour(5 downto 4);dp=0; 小时十位的dp不点亮end case;end processend fun;8.译码器文本library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity deled is port(num: in std_logic_vector(3 downto 0); led: out std_logic_vector(6 downto 0);end deled;architecture fun of deled isbegin-abcdefgled=1111110 when num=0000 else 7段管显示0,led6.0=7eh 0110000 when num=0001 else 7段管显示1,led6.0=30h 1101101 when num=0010 else 7段管显示2,led6.0=6dh 1111001 when num=0011 else 7段管显示3,led6.0=79h 0110011 when num=0100 else 7段管显示4,led6.0=33h 1011011 when num=0101 else 7段管显示5,led6.0=5bh 1011111 when num=0110 else 7段管显示6,led6.0=5fh 1110000 when num=0111 else 7段管显示7,led6.0=70h 1111111 when num=1000 else 7段管显示8,led6.0=7fh 1111011 when num=1001 else 7段管显示9,led6.0=7bh 1110111 when num=1010 else 7段管显示a,led6.0=77h 0011111 when num=1011 else 7段管显示b,led6.0=1fh 1001110 when num=1100 else 7段管显示c,led6.0=4eh 0111101 when num=1101 else 7段管显示d,led6.0=3dh 1001111 when num=1110 else 7段管显示e,led6.0=4fh 1000111 when num=1111 ; 7段管显示f,led6.0=47hend fun;9.按键a、b防抖程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity key isport(clk1,key1: in std_logic; ck1:out std_logic);end entity key;architecture fun of key is signal tmp1:std_logic_vector(9 downto 0);beginprocess(clk1) begin if rising_edge(clk1) then tmp1(0)=key1;tmp1(9 downto 1)=tmp1(8 downto 0); if tmp1=1111111111 then ck1=1;else ck1=0; end if ; end if;end process;end fun;仿真波形为:七、心得体会论文的撰写过程是对所学的电子技术基本理论知识的综合运用,对三年专业知识的一次综合应用、扩充和深化,也是对我们理论运用于实际设计的一次锻炼。通过毕业论文的撰写过程,我不仅温习了以前在课堂上学习的专业知识,同时我也得到了老师和同学的帮助,学习和体会到了电子技术的基本技能和思想。从开始接到论文题目到电路图的设计,再到论文文章的完成,每走一步对我来说都是新的尝试与挑战。在这段时间里,我学到了很多知识也有很多感受。当然在做的过程中也遇到过很多的麻烦,一些没有接触过的元件,它们的封装需要自己去书籍、网上搜索,在更新的时候会有一些错误,自己很难改正,只得求助老师,最后得以解决。这次毕业设计使我开始了自主的学习和试验,查看相关的资料和书籍,让自己头脑中模糊的概念逐渐清晰,使自己非常稚嫩作品一步步完善起来,每一次改进都是我学习的收获,每一次的成功都会让我兴奋好一段时间。此次设计过程中,各种系统的适用条件,各种程序的选用标准,各种元件的安装方式,我都是随着设计的不断深入而不断熟悉并学会应用的。和老师的沟通交流更使我对设计有了新的认识也对自己提出了新的要求。课题设计过程中我不怕失败,在失败中总结经验,为成功积累素材;学着自我超越,敢于尝试,在尝试中进步,这对我能力的提高大有好处。设计中有太多的不懂和陌生,但是我会多看、多想、多问、多学,认真的对待每一次老师交代的任务,每一个任务都是一个锻炼的机会和成长的过程,我在规定

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论