CivilAviationUniversityofChina电子技术应用设计报告基于FPGA的电子时钟设计专业:通信工程学号:xxxxxxx学生姓名:xxx所属学院:电信学院任课教师:xxx1摘要本设计采用EDA技术,采用原理图和硬件描述语言VHDL混合编程设计时钟逻辑系统,在QuartusII5.0工具软件环境下,采用自顶向下的设计方法,由各个基本模块共同构建了一个基于FPGA的电子时钟。本时钟系统主芯片采用EP1C6Q240C8N,具有显示时间、日期、时间及日期校准、整点报时、定时闹钟等功能。其中时间采用24小时循环计数,日期计数器具有闰年、月大、月小的判断并准确计数功能。通过按键控制可以实现:日期和时间的切换显示、日期和时间的校准、闹钟的开关控制。关键词:FPGA;电子时钟;原理图;VHDL语言;AbstractInmydesignEDAtechnologyisused,andIdesignedtheclocklogicsystembymeansofschematicandVHDLhardwaredescriptionlanguage.UnderQuartusII5.0Toolssoftwareenvironment,Iusedthetop-downdesignmethodology,wherevariousbasicmodulesworktogethertobuildaFPGA-basedelectronicclock.ThemainchipoftheclocksystemisEP1C6Q240C8N,whichhasthefunctionoftimedisplay,datedisplay,timeanddatecalibration,thewholepointoftime,andregularalarmclock.Furthermore,24-hourcycle,datecounterwhichtimehasleap-year,month,asmallmonth'sjudgmentandaccuratecountingfunctionaredesigned.Whatwecanachievethroughthecontrolbuttonsareasfollows:switchingthedisplayofdateandtime,calibrationofdateandtime,andthealarmswitchcontrol.Keywords:FPGA;electronicclock;schematic;VHDLlanguage;2目录电子技术应用设计报告.................................................................................................................................0基于FPGA的电子时钟设计..........................................................................................................................0摘要.................................................................................................................................................................1Abstract...........................................................................................................................................................1基于FPGA的电子时钟设计..........................................................................................................................31.FPGA介绍............................................................................................................................................32.电子时钟的设计方案.......................................................................................................................32.1时钟系统整体介绍...................................................................................................................32.2分频器.......................................................................................................................................42.3时间计数模块...........................................................................................................................52.4日期计数模块...........................................................................................................................62.5译码器模块...............................................................................................................................72.6显示模块...................................................................................................................................72.7校时模块...................................................................................................................................82.8闹钟模块.................................................................................................................................103实习总结............................................................................................................................................113.1本系统的优点.........................................................................................................................113.2本系统的不足.........................................................................................................................113.3想实现却又没实现的功能.....................................................................................................11附录1:分频器............................................................................................................................12附录2:时间计数器....................................................................................................................13附录3:日期计数器....................................................................................................................15附录4:译码器程序....................................................................................................................193基于FPGA的电子时钟设计1.FPGA介绍FPGA(Field-ProgrammableGateArray),即现场可编程门阵列,它是在PAL、GAL、CPLD等可编程器件的基础上进一步发展的产物。它是作为专用集成电路(ASIC)领域中的一种半定制电路而出现的,既解决了定制电路的不足,又克服了原有可编程器件门电路数有限的缺点。FPGA采用了逻辑单元阵列LCA(LogicCellArray)这样一个概念,内部包括可配置逻辑模块CLB(ConfigurableLogicBlock)、输出输入模块IOB(InputOutputBlock)和内部连线(Interconnect)三个部分。现场可编程门阵列(FPGA)是可编程器件。与传统逻辑电路和门阵列(如PAL,GAL及CPLD器件)相比,FPGA具有不同的结构,FPGA利用小型查找表(16×1RAM)来实现组合逻辑,每个查找表连接到一个D触发器的输入端,触发器再来驱动其他逻辑电路或驱动I/O,由此构成了既可实现组合逻辑功能又可实现时序逻辑功能的基本逻辑单元模块,这些模块间利用金属连线互相连接或连接到I/O模块。FPGA的逻辑是通过向内部静态存储单元加载编程数据来实现的,存储在存储器单元中的值决定了逻辑单元的逻辑功能以及各模块之间或模块与I/O间的联接方式,并最终决定了FPGA所能实现的功能,FPGA允许无限次的编程。2.电子时钟的设计方案2.1时钟系统整体介绍本时钟系统主要由分频器模块、计数模块、译码模块、显示模块、校时模块以及闹钟模块构成。由分频器从48MHZ晶振中得到1HZ信号给计数器提供标准时钟,译码器将计数器数据译码数码管能显示的信号,显示模块扫描译码器数据并显示。由于计数的起始时间不可能与标准时间(如北京时间)一致,故需要在电路上加一个校时