南京理工大学EDA设计 多功能数字钟的设计

合集下载

用EDA技术设计多功能数字钟

用EDA技术设计多功能数字钟

用EDA技术设计多功能数字钟摘要近年来,随着电子技术和通信技术的飞速发展,要求设计研究方面运用电子设计自动化(Electronic Design Automation,简称EDA)工具进行开发。

在20世纪90年代初从计算机辅助设计(CAD)、计算机辅助制造(CAM)、计算机辅助测试(CAT)和计算机辅助工程(CAE)的概念发展而来的。

EDA技术就是以计算机为工具,设计者在EDA软件平台上,用硬件描述语言HDL完成设计文件,然后由计算机自动地完成逻辑编译、化简、分割、综合、优化、布局、布线和仿真,直至对于特定目标芯片的适配编译、逻辑映射和编程下载等工作。

EDA技术的出现,极大地提高了电路设计的效率和可靠性,减轻了设计者的劳动强度。

本设计为通过EDA仿真软件MAX+PLUSII设计一个多功能数字钟,并下载到硬件中实现。

本系统的设计电路由计时电路、动态显示电路、闹钟电路、控制电路、显示电路等部分组成。

本系统采用动态显示的原理在数码管上显示12小时计时的时刻,具有清零、保持、校时、报时的功能,并在此基础上增加了闹铃、秒表、12小时制计时、A/P显示等功能。

在设计过程中,将各部分均模块化,各模块间相互独立,又相互联系。

本实验吸收了硬件软件化的思想,大部分功能通过软件来实现,使电路简单明了,系统稳定性大大提高。

本系统不仅成功的实现了要求的基本功能,发挥部分也得到完全的实现,而且有一定的创新功能。

关键词数字钟、计数器、多功能、动态显示、原理图、仿真、模块化AbstractRecently, with the rapid development of electronic and communication technology, it is required to use Electronic Design Automation (EDA) as a tool in designing systems. EDA derives from the concepts of Computer Aided Design, Computer Aided Manufacture, Computer Aided Test and Computer Aided Engineering in the 1990s. Designers use Hardware Describe Language to accomplish designing files on the platform of software. Then, computer will finish the work of logical compiling, simplification, division, synthesis, optimizing, layout, tracking and simulating automatically, and it can also accomplish the work of proper compiling, logical projecting and downloading of the target chip. As a result, it evidently improves the efficiency and reliability of the circuit design, and it also lighten designer’s workload.This experiment has designed a multifunctional digital clock via using the MAX+PLUSII, and the basic and extended performances and functions are successfully realized in the hardware. This system includes time circuit, alarm circuit, dynamic display circuit, control circuit, display circuit. In the system, the segment display can display time in the 24-hour format, it includes such functions as clear, hold, check the time and so on. We can also add alarm, stopwatch, 12-hour format display and other functions on that basic. In the designing process, many parts are modularized, they are not only independent but also related. Many functions are finished by the software. So it simples the circuit and enhances the stability of the system. Not only all the basic and extended performances and functions are successfully realized, but also accomplish some innovation functions.KeywordsDigital clock, arithmometer, multifunctional, dynamic display,schematic diagram, simulate, modularization目录摘要 1ABSTRACT 11、前言62、EDA技术的介绍及发展 73、总体方案设计 93.1 设计内容 93.2 方案比较 (9)3.3 方案论证 (10)3.4 方案选择 104、多功能数字中的设计 124.1 课题要求 124.2 课题分析 12 4.3 功能实现 134.3.1 秒计时模块 144.3.2 分计时模块 164.3.3 小时计时模块 17 4.3.4 校时校分模块 194.3.5 整点报时模块 194.3.6 时段控制模块 204.3.7 连接各模块 214.4 下载过程 234.5 总结报告 265、设计总结 285.1 设计小结 28 5.2 设计收获 285.3 设计改进 286、致谢 287、参考文献 301、前言本课题研究的背景和目的:二十一世纪是信息化高速发展的世纪,产业的信息化离不开硬件芯片的支持。

EDA多功能数字钟设

EDA多功能数字钟设

实验报告实验四多功能数字钟设计一、实验目的1、学习复杂数字电路系统的设计。

2、设计一个多功能数字钟。

二、实验要求1.数字显示当前的小时、分钟;2.可以预置为12小时计时显示和24小时计时显示;3.一个调节键,用于调节目标数位的数字。

对调节的内容敏感,如调节分钟或秒时,保持按下时自动计数,否则以脉冲计数;4.一个功能键,用于切换不同状态:计时、调时、调分、调秒、调小时制式。

三、实验仪器PC机、Quartus II软件、EDA实验箱四、实验原理1.系统需要两个六十进制计数器用于分钟和秒的计时,为方便译码采用60进制计数器(1)秒计时实验程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;USE IEEE.STD_LOGIC_ARITH.ALL;entity second ISport(clk1,rst1:in std_logic;cout1:out std_logic;cq0:out std_logic_vector(3 downto 0);cq1:out std_logic_vector(3 downto 0));END second;ARCHITECTURE behave of second isSIGNAL d: std_logic_vector(3 downto 0);SIGNAL g: std_logic_vector(3 downto 0);BEGINprocess(clk1,rst1,d,g)BEGINif (rst1 ='1') thend <="0000";g <="0000";elsif(clk1'EVENT and clk1='1')thenif(d=9 and g=5)thencout1<='1';elsecout1<='0';end if;if(d=9)thend<="0000";if(g=5)theng<="0000";elseg<=g+1;end if;elsed<=d+1;end if;end if;end process;cq0<=d;cq1<=g;end behave;clk1是时钟信号,rst1是复位信号, cout1作为下一模块分钟设计的时钟信号,cq0,cq1输出信号最后接在动态译管码芯片上。

南理工EDA2多功能数字钟设计实验报告(蒋立平)——优秀课件

南理工EDA2多功能数字钟设计实验报告(蒋立平)——优秀课件

EDAⅡ实验报告 --多功能数字钟学院专业:学生学号:指导老师:蒋立平交稿时间:2012年3月25日摘要本实验借助于quartusⅡ软件设计一个多功能的数字时钟,具有24小时计时、星期显示、保持、清零、校分校时校星期、整点报时等基本功能,并在此基础上添加了闹钟、音乐闹钟、秒表等附加功能。

同时,留有万年历的接口可以方便的进行扩展。

.利用quartusⅡ进行相应的设计、仿真、调试,最后下载到SmartSOPC实验系统上验证设计的正确性。

关键词:多功能数字时钟,quartusⅡ,计时,星期显示,整点报时,闹钟,秒表ABSTRACTThis experiment is to design a multifunctional digital clock with quartus Ⅱ.The multifunctional digital clock has varities of the functions like 24-hour timer,keeping,clearing zero,adjusting time and chime on integral hour .It also include additional functions such as week,keeping,clearing zero,adjusting week,60 seconds countdown and so on.At the sametimes,it can be added calendar.we designed and simulated with quartusⅡ.Finally downloaded it to the experiment platform to test.Key words:multifunctional digital clock,quartusⅡ,time,week,chime on integral hour, alarm clock,stopwatch目录1 ……………………………………………………设计要求2 ……………………………………………………方案论证3 ……………………………………基本计时模块设计原理3.1………………………………………基本计时电路的设计3.1.1……………………………………脉冲发生电路的设计3.1.2…………………………………………计时电路的设计3.2………………………………………………闹钟电路的设计3.2.1…………………………闹钟定时与计时校时校分复用电路3.2.2………………………………………………闹钟定时分清零3.2.3………………………………………………………比较电路3.2.4…………………………………………………硬件电路音乐3.2.5…………………………………………………VHDL音乐电路3.2.6……………………………………………闹钟音乐选择电路3.2.7……………………………………………报时音乐选择电路3.3………………………………………………秒表电路的设计3.3.1…………………………………………………模100计数器3.3.2……………………………………………………………秒表3.4…………………………………………切换模式电路的设计4 ………………………………多功能数字时钟的整体结构5………………………………………程序下载、仿真与调试6………………………………………………实验总结与感想多功能数字钟设计一、题目简介二、设计要求1.1设计一个基本的计时、计星期的数字时钟1.2 具体设计要求如下:1.2.1能够进行正常的星期、时、分、秒的计时功能;1.2.2 由七个数码管显示,从左到右分别为时十位、时个位、分十位、分个位、秒十位、秒个位、星期;星期为1、2、3、4、5、6、8来表示周一到周日;1.2.3 计时电路的开关分配(1)k1是计时电路的使能开关(k1=0正常计时,k1=1时钟保持);(2)k2是计时电路的清零/秒表清零/闹钟定时清零复用开关(在不同的模式显示下,k2=0时正常计,k2=1时清零);(3)k3是计时电路的校分/闹钟电路定分复用开关(k3=0正常计时,k3=1进行校分);(4)k4是计时电路的校时/闹钟电路定时复用开关(k4=0正常计时,k4=1进行校时);(5)k5是计时电路的校星期开关(k5=正常计时,k5=1进行校星期);(6)k6为闹钟开关,k7、k8是基本计时电路、闹钟、秒表的显示选择开关(k8k7=00显示基本计时模式;k8k7=01显示闹钟,但闹钟的开关k6=1时闹钟才进入闹钟模式,即k7k8 k6=011可以进行闹钟的定时,在这个显示下闹钟的音乐是《欢乐颂》,切换到其他的显示(且k6=1)如计时和秒表时闹钟的音乐就是《友谊地久天长》;k8k7=10是秒表模式,其中k6k7 k8=100秒表正常计时,k6k7k8=101秒表保持;k7k8=11是万年历模式,留做扩展时使用);1.2.4整点报时功能(当时钟计到59分53秒、55秒、57秒时报时频率为500hz,59秒报时频率为1Khz);1.2.5闹钟及音乐闹钟功能k6k7=01X闹钟模式中可以进行定时和音乐切换,本系统中有两首音乐,一- 1 -首是通过原理图实现的,另一首是通过VHDL语言实现的;1.2.6秒表功能秒表由分十位、分个位、秒十位、秒个位、分秒十位、分秒个位组成,分秒为模100的计数器工作于100hz频率,秒位和分位均为模60的计数器;1.2.7万年历功能由于时间问题并未将万年历实现,但是当时在进行电路设计时就考虑到要预留出必要的接口,方便以后的扩展。

EDA2_多功能数字钟设计_毕业设计论文

EDA2_多功能数字钟设计_毕业设计论文

EDA设计(2) ————多功能数字钟设计院系:电子工程与光电技术学院本实验利用QuartusII软件,结合所学的数字电路的知识,采用自顶向下的分析方法。

首先分析了多功能数字钟的设计要求、所需实现的功能,然后分析了实现每个功能所需要的基础模块,最后进一步分析了各种基础模块。

在具体设计时,采用的是自底向上的设计方法。

首先设计各种基础模块,然后设计各种功能模块,最后进行综合设计。

本次设计除了实现基本的时钟电路外,还实现了整点报时、闹钟、日期、星期、秒表等多种功能。

报告首先分析了整个数字中电路的工作原理,其中重点解释说明了个子模块的设计原理及调试、编译、仿真、下载等过程。

其次对最终结果进行总结及提出课后对于其他附加电路的部分思考。

在报告的最后总结了此次实验过程中出现的问题困难和相应解决方法。

Abstract:Using the QuartusII, we design a digital clock of 24 hours with learning electric circuit knowledge,adopts the top-down analysis method .Above all ,it analyses the design requirement and the required functionality of Multi function Digital Clock .And then it analyses the needed basic modules which can achieve each function .Lastly ,it analyses each basic module further .When it comes to the specific design ,it adopts the bottom-up design method .Firstly ,it designs each basic module .Then , it designs the function modules based on the basic modules .Finally ,it integrates all the designs .Besides the function of basic clock ,it also achieves functions of hourly chime, alarm, date, week and clock. To begin with,the report analysis functional theory of the whole digital circuit, in which emphasize designing principle of different parts separately and debugging, simulating, compiling, programming. Moving forward are the conclusion of the final out-coming and partial thinking about some other extra circuit which cannot accomplish in class. Finally, I will summarize sorts of problems and difficulties encountered in the process and respectively solutions关键词:计数功能组合多功能数字时钟同步整点报时下载检验Key word: counting combination of functions multi-function digital clock、Synchronous、 A little bit whole tell the time download inspection一、实验内容 (3)二、题目简介 (3)三、基本要求 (3)3.1 设计的基本要求 (3)3.2 设计提高部分要求 (3)四、方案论证 (3)五、基本电路各个功能的模块设计 (6)4.1 脉冲发生电路 (6)4.2 计时电路 (10)4.3 较分校时电路 (13)4.4 清零电路 (15)4.5 保持电路 (16)4.6 报时电路 (16)4.7 译码显示电路 (17)4.8 消颤电路 (19)4.9 各种组合电路 (20)六、附加功能的设计 (21)6.1 星期电路 (21)6.2 秒表电路 (22)七、实验的改进 (25)7.1 较分校时较星期的改进 (25)八、实验的电路设计总图 (26)九、实验中遇到的困难及改进方法 (26)9.1 最大的困难:数字钟计数器的设计 (26)十、正在设计还未能实现的功能 (27)10.1 闹钟电路 (27)十一、电路下载 (29)十二、实验感想 (30)十三、鸣谢 (31)十四、参考文献 (31)一、实验内容:利用QuartusII软件设计一个数字钟,并下载到SmartSOPC实验系统中。

南京理工大学EDA(2)实验报告

南京理工大学EDA(2)实验报告

南京理⼯⼤学EDA(2)实验报告南京理⼯⼤学EDA(2)实验报告--------多功能数字钟学⽣姓名:林晓峰学号:912104220143 专业:通信⼯程指导教师:2014年12⽉10⽇摘要本次实验利⽤QuartusII7.0软件设计了⼀个具有24⼩时计时、保持、清零、快速校时校分、整点报时、动态显⽰等功能的的多功能数字钟。

并利⽤QuartusII7.0软件对电路进⾏了详细的仿真,同时通过SMART SOPC实验箱对电路的实验结果进⾏验证。

报告分析了整个电路的⼯作原理,还分别说明了设计各⼦模块的⽅案和编辑、仿真、并利⽤波形图验证各⼦模块的过程。

并且介绍了如何将各⼦模块联系起来,合并为总电路。

最后对实验过程中产⽣的问题提出⾃⼰的解决⽅法。

并叙述了本次实验的实验感受与收获。

关键词:QuartusII7.0 多功能数字钟保持清零整点报时校时校分动态显⽰ SMART SOPCAbstractThis experiment uses the QuartusII7.0 software todesign one to have 24 hours time, the maintenance, the reset,the fast timing school minute,the integral point reportstime and so on digital clocks.And using the QuartusII software realizes the multi-purpose digital clock simulation. Through the SmartSOPC experiment box, I confirm the result of this experiment.The report analyzes the electric circuit principle of work,and also illustrates the design of each module and editing, simulation, and the process of using the waveformto testing each Sub module. Meanwhile,it describes how the modules together, combined for a total circuit. Finally the experimental problems arising in the process of presenttheir solutions. And describes the experience and resultof this experiment.Keywords:QuartusII7.0 Digital clock maintenancereset time alarm change minute and hour quickly dynamic display SMART SOPC⽬录封⾯ (1)摘要 (2)Abstract (3)⽬录 (4)1.设计要求 (5)2.实验原理 (6)3.模块电路设计 (7)3.1 脉冲发⽣电路 (7)3.2计数器 (10)3.3计时校正电路 (13)3.4整点报时电路 (17)3.5译码显⽰电路 (18)3.6附加电路 (19)4. 总电路图 (20)5.电路下载 (20)6.实验感想和收获 (21)6.1遇到的问题与解决⽅案 (22)6.2收获与感受 (23)6.3期望及要求 (23)7. 参考⽂献 (23)1.设计要求本次EDA设计利⽤Quartus II7.0软件设计⼀个多功能数字钟,并下载到Smart SOPC实验系统中进⾏验证。

EDAII实验报告—多功能数字钟2南京理工大学

EDAII实验报告—多功能数字钟2南京理工大学

EDA设计Ⅱ实验报告——多功能数字钟设计姓名:学号:11042203**指导老师:姜萍完成时间:2013年12月目录一、实验内容及要求 (5)二、电路设计原理 (5)三、各子模块设计 (7)1、脉冲信号发生电路 (7)2、计时电路 (10)3、译码显示电路 (15)4、校分(时)电路 (16)5、保持电路和清零电路 (18)6、整点报时电路 (18)7、最终的时钟电路 (19)四、调试仿真和编程下载 (20)五、实验总结 (21)附录、参考文献 (23)摘要:数字钟已经成为我们生活中不可或缺的一部分。

本文的内容便是多功能数字钟的设计,其具有24小时计时,调整时间,时间清零,时间保持,整点报时的功能。

首先文章介绍了实验的内容和要求,并对多功能数字钟的设计原理进行了介绍。

实验采用分模块设计最终整合的方法,对每一个模块进行封装,最终整合成一个总体的实验电路,完成多功能数字钟所要求的功能。

接着文章介绍了具体的试验方法和步骤。

我们利用可编程逻辑器件,在QuartusII软件上进行设计,实现多功能,这就是所谓的FPGA。

我们先是设计分频电路,对实验箱上的48MHZ信号进行分频得到所需信号,接着设计计时和译码显示电路,利用软件的仿真功能验证模块设计的正确性。

然后分别设计校分校时电路,保持清零电路,整点报时电路模块,仿真验证模块的正确性。

最后将各个模块整合,组合成完整的数字钟电路。

最后在对电路的引脚进行分配后,下载到SmartSOPC试验系统中,验证电路的设计是否正确。

关键词:数字钟,FPGA ,QuartusII,SmartSOPC,分模块设计Summary:Digital clock has been an necessary part of our daily life.The content of this essay is the design of multi-function digital clock, which has the functions of 24-hour timer,time adjustment, time cleared, the time to maintain, the whole point timekeeping and alarm.First,the content and demands of experiment is presented in the essay,the design principle of multi-function digital clock is also introduced.The method of module integration after designing and simulating each module is taken to implement the experiment.After packaging all module,all the modules are integrated to realize the final electric circuits,implementing all the demands of multi-function digital clock design.Second,the method and steps of the experiment is ing programmable logic devices,the electric circuits are designed in software QuartusII to realize the multi-function,which is called FPGA. Firstly, the frequency dividing circuit is designed to get the frequency required by dividing the frequency of 48MHZ from the experiment box.Then,the timing circuit and decoding-and-display circuit are also designed,which are all simulated in software to test their validity.After all,the timeadjustment circuit,the time maintain circuit,the time cleared circuit and the alarm circuit are also designed,which are simulated in the software to test their correctness.After packaging all the circuits into modules,the modules are integrated to finish the multi-function digital clock design.Last,the final circuit is downloaded to the SmartSOPC experiment system to test its validity after assigning all the pins of the final circuits.Keywords:digital clock, FPGA ,QuartusII,SmartSOPC,points module design一、实验内容及要求1、实验内容:利用QuartusII软件设计一个数字钟,并下载到SmartSOPC实验系统中。

南京理工大学电工电子实验报告(多功能数字计时器设计)

南京理工大学电工电子实验报告(多功能数字计时器设计)

南京理工大学电工电子实验报告(多功能数字计时器设计)1. 电路功能设计要求介绍2. 电路原理简介3. 单元电路设计3.1 脉冲发生电路3.2 计时电路3.3 译码显示电路3.4 清零电路3.5 校分电路3.6 仿电台报时电路4.总电路图5.电路调试和改进意见6.实验中遇到的问题、出现原因及解决方法7.实验体会8.附录8.1 元件清单8.2 芯片引脚图和功能表9.参考文献1.电路功能设计要求1、设计制作一个0分00秒~9分59秒的多功能计时器,设计要求如下:1)设计一个脉冲发生电路,为计时器提供秒脉冲(1HZ),为报时电路提供驱动蜂鸣器的高低脉冲信号(1KHZ、2KHZ);12)设计计时电路:完成0分00秒~9分59秒的计时、译码、显示功能;3)设计清零电路:具有开机自动清零功能,并且在任何时候,按动清零开关,可以对计时器进行手动清零。

4)设计校分电路:在任何时候,拨动校分开关,可进行快速校分。

(校分隔秒)5)设计报时电路:使数字计时器从9分53秒开始报时,每隔一秒发一声,共发三声低音,一声高音;即9分53秒、9分55秒、9分57秒发低音(频率1kHz),9分59秒发高音(频率2kHz);6)系统级联。

将以上电路进行级联完成计时器的所有功能。

7)可以增加数字计时器附加功能:定时、动态显示等。

2. 电路原理简介数字计时器由计时电路、译码显示电路、脉冲发生电路、校分电路、清零电路和报时电路这几部分组成。

其原理框图如下:3. 单元电路设计3.1 脉冲发生电路振荡器是数字钟的核心。

采用石英晶体构成振荡器电路,产生稳定的高频脉冲信号,作为数字钟的时间基准,再经过分频器输出标准秒脉冲(1HZ)。

分频器的功能主要有两个:一是产生标准秒脉冲(1HZ)。

二是提供功能扩展电路所需驱动脉冲信号(1KHZ、2KHZ)。

15 采用晶体的固有频率为32768HZ=2HZ。

2CC4060、74LS74电路图如下所示:2Q5Q4Q143.2 计时电路CC4518(分位、秒个位)、74LS161(秒十位)“0”“1”“o”“0”3.3 译码显示电路译码器 CC4511 显示器共阴LED七段字型数码管 33.4 清零电路3.5 校分电路3.6 仿电台报时电路44.总电路图Q5Q42Q145.电路调试和改进意见先接显示电路,显示电路接完,接入电源,当三个数码管都能正常显示8的时候说明接入正确。

EDA电子钟多功能数字时钟课程设计(含代码)[优秀]

EDA电子钟多功能数字时钟课程设计(含代码)[优秀]

多功能数字时钟设计说明:1.系统顶层框图:各模块电路功能如下:1.秒计数器、分计数器、时计数器组成最基本的数字钟,其计数输出送7段译码电路由数码管显示.2.基准频率分频器可分频出标准的1HZ频率信号,用于秒计数的时钟信号;分频出4HZ频率信号,用于校时、校分的快速递增信号;分频出64HZ频率信号,用于对按动“校时”,“校分”按键的消除抖动.2.多功能数字钟结构框图:一、系统功能概述已完成功能1.完成时/分/秒的依次显示并正确计数,利用六位数码管显示;2.时/分/秒各段个位满10正确进位,秒/分能做到满60向前进位,有系统时间清零功能;3.定时器:实现整点报时,通过扬声器发出高低报时声音;4.时间设置,也就是手动调时功能:当认为时钟不准确时,可以分别对分/时钟进行调整;5.闹钟:实现分/时闹钟设置,在时钟到达设定时间时通过扬声器响铃.有静音模式.待改进功能:1. 系统没有万年历功能,正在思考设计方法.2. 应添加秒表功能.二、系统组成以及系统各部分的设计1.时计数模块时计数模块就是一个2位10进制计数器,记数到23清零.VHDL的RTL描述如下:----cnt_h.vhdlibrary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt_h isport(en,clk,clr:in std_logic;dout:out std_logic_vector(7 downto 0);c:out std_logic);end cnt_h;architecture rtl of cnt_h issignal t:std_logic_vector(7 downto 0);beginprocess(en,clk,clr)variable t:std_logic_vector(7 downto 0);beginif en='1' then --异步使能if clk 'event and clk='1' thent:=t+1;if t(3 downto 0)=X"A" then --个位等于10则十位加1t(7 downto 4):=t(7 downto 4)+1;t(3 downto 0):=X"0"; --个位清零end if;if t>X"23" then --大于23清零t:=X"00";end if;end if;if clr='1' then --异步清零t:=X"00";end if;end if;dout<=t;end process;end rtl;时计数器模块仿真波形如下从仿真波形可知,当计数到23时,下一个时钟上升沿到来时就清零了,符合设计要求.时计数模块框图如下2.分及秒计数模块分及秒计数模块也是一个2位10进制计数器,记数到59清零.VHDL的RTL描述如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt_s isport(en,clk,clr:in std_logic;dout:buffer std_logic_vector(7 downto 0);c:out std_logic);end cnt_s;architecture rtl of cnt_s isbeginprocess(en,clk,clr)beginif en='1' thenif clr='1' then --异步清零dout<=X"00";elsif clk 'event and clk='1' thenif dout(3 downto 0)<9 thendout(3 downto 0)<=dout(3 downto 0)+1;c<='0';elsif dout(7 downto 4)<5 thendout(3 downto 0)<=X"0";dout(7 downto 4)<=dout(7 downto 4)+1;elsedout<=X"00";c<='1';end if;end if;else dout<="ZZZZZZZZ";end if;end process;end rtl;分和秒计数器模块仿真波形如下从仿真波形可知,当计数到59时,下一个时钟上升沿到来时就清零了,并且产生进位信号,符合设计要求.分和秒计数模块框图如下3.按键消抖动模块按键消抖动有很多方案,这里选择的是计数消抖,即只当有效电平到来后开始计数,当计数值大于一定值后再输出该有效电平,否则不输出,从而达到消抖目的. VHDL的RTL描述如下:library ieee;use ieee.std_logic_1164.all;entity haoin isport(din,clk:in std_logic;dout:out std_logic); end haoin;architecture rtl of haoin isbeginprocess(din)variable t: integer range 0 to 63:=0;beginif din='1' thenif clk 'event and clk='1'thent:=t+1;if t>10 thendout<='1';t:=t-1;else dout<='0';end if;end if;else dout<='0';t:=0;end if;end process;end rtl;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ring isport(clk: in std_logic;clk500: in std_logic;clk1k:in std_logic;beep:out std_logic);end ring;architecture rtl of ring isbeginprocess(clk)variable t: std_logic;variable n: integer range 0 to 15:=0;beginif clk 'event and clk='1' thent:=not t;n:=n+1;end if;if t='1' and n<11 thenbeep<=clk500;elsif n=11 thenbeep<=clk1k;else beep<='Z';end if;end process;end rtl;library IEEE;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;use IEEE.std_logic_unsigned.all;entity clock isport(SA: in std_logic;SB: in std_logic;SC: in std_logic;SD: in std_logic;clk1: in std_logic;dout: buffer std_logic_vector(23 downto 0);--seg_data:out std_logic_vector(7 downto 0);--seg_co米:out std_logic_vector(3 downto 0);beep: out std_logic--led:out std_logic_vector(3 downto 0));end entity clock;architecture rtl of clock isco米ponent cnt_s isport(en,clk,clr:in std_logic;dout:buffer std_logic_vector(7 downto 0);c:out std_logic);end co米ponent;co米ponent cnt_h isport(en,clk,clr:in std_logic;dout:buffer std_logic_vector(7 downto 0));end co米ponent;--co米ponent seg米ain is--port(clk,reset_n:in std_logic;--datain:in std_logic_vector(15 downto 0);--seg_data:out std_logic_vector(7 downto 0);--seg_co米:out std_logic_vector(3 downto 0));--end co米ponent;--co米ponent ring is--port( en: in std_logic;-- clk: in std_logic;--clk500: in std_logic;--clk1k:in std_logic;--beep:out std_logic);--end co米ponent;co米ponent haoin isport(din,clk:in std_logic;dout:out std_logic);end co米ponent;co米ponent naoling isport (h,米:in std_logic_vector(7 downto 0);clk4hzh,clk4hz米:in std_logic;sys_en,sys_rst:in std_logic;h_o,米_o: out std_logic_vector(7 downto 0);beep:out std_logic);end co米ponent;signal reg_h:std_logic_vector(7 downto 0);signal reg_米:std_logic_vector(7 downto 0);signal reg_s:std_logic_vector(7 downto 0);signal reg_米_s:std_logic_vector(7 downto 0):=X"59"; signal reg_米_米:std_logic_vector(7 downto 0):=X"59";signal reg_米_h:std_logic_vector(7 downto 0):=X"59";signal clk_h:std_logic;signal clk_米:std_logic;signal clk_s:std_logic;signal c_s :std_logic;signal c_米:std_logic;signal c_h :std_logic;signal sys_clk1:std_logic;signal sys_clk4:std_logic;signal sys_clk64:std_logic;signal sys_clk500:std_logic;signal sys_clk1k:std_logic;signal clki:integer:=750000;signal sys_rst:std_logic:='0';signal sys_en:std_logic:='1';signal clk_ring,米h:std_logic;signal SAc,SBc,SCc,SDc:std_logic;signal en_r:std_logic;signal NL_reg_h,NL_reg_米:std_logic_vector(7 downto 0);signal NL_ring:std_logic;signal sys_clk4_NL_h,sys_clk4_NL_米:std_logic;beginh:cnt_h port 米ap(en=>sys_en,clk=>clk_h,clr=>sys_rst,dout=>reg_h);米:cnt_s port 米ap(en=>sys_en,clk=>clk_米,clr=>sys_rst,dout=>reg_米,c=>c_米);s:cnt_s port 米ap(en=>sys_en,clk=>sys_clk1,clr=>SCc,dout=>reg_s,c=>c_s);--sled:seg米ain port 米ap(clk=>clk1,reset_n=>SCc,seg_data=>seg_data,seg_co 米=>seg_co米,datain=>dout(15 downto 0));--ring0:ring port 米ap(en=>en_r,clk=>clk_ring,clk500=>sys_clk500,clk1k=>sys_clk1k,beep=>beep); haoin1:haoin port 米ap( SA,sys_clk64,SAc);haoin2:haoin port 米ap( SB,sys_clk64,SBc);haoin3:haoin port 米ap( SC,sys_clk64,SCc);haoin4:haoin port 米ap( SD,sys_clk64,SDc);NL:naoling port 米ap(beep=>NL_ring,h=>reg_h,米=>reg_米,clk4hzh=>sys_clk4_NL_h,clk4hz米=>sys_clk4_NL_米,sys_en=>sys_en,sys_rst=>sys_rst,h_o=>NL_reg_h,米_o=>NL_reg_米);beep<=clk_ring and 米h;--led<=reg_s(3 downto 0);p_sys_clk:process(clk1)variable t1,t4,t64,t500,t1k:integer range 0 to 50000000;beginif clk1 'event and clk1='1' thent1:=t1+1;t4:=t4+1;t64:=t64+1;t500:=t500+1;t1k:=t1k+1;if t1=clki/2 thent1:=0;sys_clk1<=not sys_clk1;end if;if t4=clki/8 thent4:=0;sys_clk4<=not sys_clk4;end if;if t64=clki/128 thent64:=0;sys_clk64<=not sys_clk64;end if;if t500=clki/1000 thent500:=0;sys_clk500<=not sys_clk500;end if;if t1k=clki/2000 thent1k:=0;sys_clk1k<=not sys_clk1k;end if;end if;end process p_sys_clk;p_c:process(SAc,SBc,SCc,SDc)beginif SAc='1' and SDc='0' thenclk_h<=sys_clk4;elseclk_h<=c_米;end if;if SAc='1' and SDc='1' thensys_clk4_NL_h<=sys_clk4;elsesys_clk4_NL_h<='0';end if;if SBc='1' and SDc='0'thenclk_米<=sys_clk4;elseclk_米<=c_s;end if;if SBc='1' and SDc='1'thensys_clk4_NL_米<=sys_clk4;elsesys_clk4_NL_米<='0';end if;if SDc='0' thendout(7 downto 0)<=reg_s;dout(15 downto 8)<=reg_米;dout(23 downto 16)<=reg_h;elsedout(7 downto 0)<="ZZZZZZZZ";dout(15 downto 8)<=NL_reg_米;dout(23 downto 16)<=NL_reg_h;end if;end process p_c;P_ring:process(reg_米,reg_s,sys_clk1k)variable clk_ring_t:std_logic;variable t:std_logic_vector(3 downto 0);beginif reg_米=X"59" and (reg_s=X"50" or reg_s=X"52" or reg_s=X"54" or reg_s=X"56" or reg_s=X"58") thenclk_ring_t:=sys_clk500;elsif reg_米=X"00" and reg_s=X"00" thenclk_ring_t:=sys_clk1k;else clk_ring_t:='Z';end if;if NL_ring='1' thenclk_ring_t:=sys_clk1k;end if;if sys_clk1k 'event and sys_clk1k='1' thent:=t+1;end if;if t>1 then 米h<='1';end if;clk_ring<=clk_ring_t;end process p_ring;end rtl;。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

EDA数字钟的设计指导老师:***姜萍姓名:***学院:电子工程与光电技术学院专业:真空电子技术学号:**********完成时间:2011年4月目录:一.设计要求………………………………………………………………二.方案论证………………………………………………………………三.子模块设计……………………………………………………………1.频率源设计……………………………………………………………①模48计数器的设计………………………………………………②模1000计数器的设计……………………………………………③模2计数器的设计………………………………………………④ 1KHZ脉冲的设计…………………………………………………⑤ 500HZ脉冲的设计………………………………………………⑥ 1HZ脉冲的设计…………………………………………………2.计数部分电路设计……………………………………………………①模60计数器的设计………………………………………………②模24计数器的设计………………………………………………③计数器的设计……………………………………………………3.清零和保持电路的设计………………………………………………4.校分和校时电路的设计………………………………………………5.报时电路的设计………………………………………………………6.显示电路的设计………………………………………………………①模6计数器的设计………………………………………………② 24选4(或六选一)数据选择器的设计…………………………③动态显示设计……………………………………………………7.最终总体电路…………………………………………………………四.附加闹铃功能…………………………………………………………①频率源的设计……………………………………………………②闹铃的设计………………………………………………………五.编程下载………………………………………………………………六.实验总结和感受………………………………………………………七.参考文献………………………………………………………………中文摘要本实验利用QuartusII软件,结合所学的数字电路的知识设计一个24时多功能数字钟,具有正常计数、快速校分校时、整点报时功能。

论文分析了整个电路的工作原理,还分别说明了各子模块的设计原理和调试、仿真、编译下载的过程,并对最终结果进行总结,最后提出了在实验过程中出现的问题和解决的方案,以及后续设计思想。

通过实验掌握了一些电子器件的基本功能和用法,同时体会到了利用软件设计电路的方便快捷,避免了硬件布线的繁琐,提高了效率,同时它也为以后设计更复杂的电路打下了良好的基础。

关键词数字钟 QuartusII 计数校分报时调试仿真编译下载外文摘要Using the QuartusII software in this experiment, we design a digital clock of 24 hours with learning digital circuit knowledge. The circuit must have the functions of normally counting ,keeping the time, resetting, adjusting the minute and hour swiftly, ringing the time in the round number time . The thesis has analyzed the principle of the whole circuit and explained the designing principle of different parts separately. By the process of debugging, simulating, compiling and loading, we sum up the final result .At last,we put forwardthe problems we are subjected to in the whole experiment and some ways to settle them and other subsequent ideas of designing.I know about the basic functions and using method of some electric devices through this experiment. At the same time, I realize the convenience of making use of the software to carry on the electric circuit,which can avoid the tedious line of the hardware and improve the efficiency .Simultaneously it can also let us have a good foundation for designing a more complex system.Keywords digital clock, counting,adjusting the minute and hour ,ringing,debugging,simulating,compiling and loading一: 实验要求1)设计一个数字计时器,可以完成00:00:00到23:59:59的计时功能,并在控制电路的作用下具有保持、清零、快速校时、快速校分、整点报时等功能。

2)对数字计时器采用层次化的方法进行设计,其中构成整个设计的子模块既可以用原理图输入实现,也可以采用VHDL语言编程实现。

3)数字钟的具体设计要求具有如下功能:①数字计时器能够完成从00:00:00到23:59:59的计时功能;②在数字计时器正常计数的情况下,可以对其进行不断电复位,即拨动开关K1可以使时分秒位清零;③在数字计时器正常工作的情况下,拨动开关K2可以使数字计时器保持原有显示的读数,停止计时;④在数字计时器正常工作的情况下按下开关K3可以实现快速校分,按下开关K4可以实现快速校时;⑤数字计时器在每小时整点到来之前进行鸣叫,在每小时的59分53秒,55秒,57秒用500HZ的频率驱动蜂鸣器,在每小时的59秒用1KZ的频率驱动蜂鸣器。

4)对设计电路进行功能仿真。

5)将仿真通过的逻辑电路下载到EDA实验系统,对其功能进行验证。

二:方案论证数字计时器有时分秒,时分秒各有高低两位,其中时位为一个模24的计数器,分位和秒位为模60的计数器。

秒位每秒加一,分位每六十秒加一,时位每六十分加一,于是低位的进位信号可以用来驱动高位计数,这就是数字计时器的原理。

至于清零,保持,校分,校时电路则只需要通过简单的组合逻辑电路来用一个开关控制使能端或进位信号或它们的相关组合即可。

整点报时即当计时在某种状态下以一定的频率驱动蜂鸣器即可。

最后就是动态显示部分,动态显示利用的是人眼的视觉暂留效应,在闪烁频率大于48HZ时人眼便感觉不到闪烁。

利用这个原理可以使几个数码管在译码器的作用下以比较高的频率轮流进行工作,人眼看不到闪烁,看起来这些数码管是同时工作的,这样就可以达到动态显示。

三: 子模块设计1.频率源的设计在数字计时器的设计中我们需要用到的频率源有1HZ,1KHZ和500HZ,而实验中所给振荡频率源为48MHZ,显然不满足我们的需求,为此我们要将其进行48分频后可得1MHZ,再进行1000分频后可得1KHZ,将1KHZ 再进行1000分频后可得1HZ来提供计时脉冲,将1KZ进行2分频后可得500HZ。

为此我们需分别设计模48,模1000和模2计数器。

①模48计数器的设计我们采用了两片74160BCD计数器,左边的一片作为低位,右边的一片作为高位,我们采用的是置数法,将左边74160的RCO进位端连接到右边74160的使能端ENT和ENP,当左边低位74160计数超过9时便产生进位开始让右边一片高位74160开始计数,我们用QH[2],QL[0],QL[1],QL[2]通过一个与非门给置位端LDN,即计数计到23时会被置位,我们将所置的数DCBA赋以0000,这就是置数法。

当然我们需将左边74160的使能端ENT和ENP和清零端CLRN及右边74160的清零端都接VCC以保证两片74160都能正常工作,同时要在时钟CLK端给以时钟脉冲信号。

最后我们将置位端LDN通过一个非门之后输出即得48分频的信号。

编译调试通过后,我们给以波形上的仿真,结果如下:封装后得:②模1000计数器的设计我们采用了三片74160BCD计数器,最左边的一片作为最低位,最右边的一片作为最高位,将最左边一片的RCO进位端接到中间一片的使能端ENT和ENP,即最左边计到9时产生进位信号给中间一片让其开始计数,将最左边的一片的RCO进位端和中间一片的RCO进位端通过一个与门输出后给最右边一片的使能端ENP和ENT,即计到99时产生进位,于是最右边的一片开始计时,计到999后即开始清零重新再计。

当然还要将三片得置位端LDN和清零端CLRN接VCC,最左边一片的使能端ENP和ENT接VCC以保证3片74160能正常工作,同时在时钟CLK端给以时钟脉冲信号,从QC[3]输出得1000分频后的信号。

编译调试通过后,我们给以波形上的仿真(由于空间有限,只截了后面一部分)得:封装后得:③模2计数器的设计我们采用了一片D触发器,将D触发器的输出Q端通过一个与门后再接到输入端D即可。

当然我们需将使能端PRN和清零端CLRN接VCC 以保证D触发器能正常工作。

同时我们在时钟CLK端接上时钟脉冲信号。

从Q端输出即得到2分频的信号。

编译调试通过后,我们给以波形上的仿真得:封装后得:④1KHZ脉冲的设计将48MHZ脉冲从CLK48M端输入,在CLK1000输出端即得1KHZ脉冲。

⑤500HZ脉冲的设计将48MHZ从CLK48M输入端输入,在CLK500输出端即得500HZ脉冲。

⑥1HZ脉冲的设计将48MHZ从CLK48M输入端输入,在CLK500输出端即得1HZ脉冲。

2.计数部分电路设计①模60计数器的设计我们利用两片74160,左边的一片作为低位,右边的一片作为高位,我们将两片的使能端ENP接成整片的使能端EN,清零端CLRN接成整片的清零端k1qingling,将左边一片的进位端RCO接到右边一片的使能端ENT,即当左边一片计数计到9时产生进位信号,右边一片开始计数,同时将左边一片使能端ENT接VCC,时钟CLK端给以1HZ计数脉冲,我们采用置数法,考虑到使能端EN,我们用QH[2],QH[0],QL[0],QL[3]通过一个与门输出再与使能端EN通过一个与非门给置位端LDN,即在使能端EN为1的情况下,当计数计到59时开始置数,我们赋以置数DCBA为0000,即为置数法。

相关文档
最新文档