




全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
EDA课程设计(电子钟的设计)姓名:刘峰语学号:200820303110指导老师:谢斌同组人员:熊成、杨彬彬系别:自动化工程系专业:08级测控技术与仪器一设计要求:1.能实现时,分,秒计时。2.能实现整电报时。3.能进行对时和分的校准。二实验目的:1.掌握多位计数器相连的方法。2.掌握十六进制,二十四进制,六十进制计数器的设计方法。3.握CPLD技术的层次化设计法。4.了解软件的元件管理含义以及模块元件之间的连接概念。5.掌握电子电路一般的设计方法,并了解电子产品的研制开发过程,基本掌握电子电路安装和调试方法。6.培养独立分析问题,团结解决问题的能力。三硬件要求:1. 8位8段扫描共阴极数码显示管。2. 三个按键开关(清零,校时,校分)。四设计原理1.数字钟的计时周期为24小时,显示满刻度为23时59分59秒,另外具备校时功能和报时功能。因此,一个基本的数字钟主要由“时”“分”“秒”计数器校时电路组成。将标准信号送入“秒计数器”,“秒计数器”采用60进制计数器,每累加60 秒发送一个“分脉冲”信号,该信号将被送到“时计数器”,“时计数器”采用24进制计数器,可实现对一天24 小时的累计。译码显示电路将“时”“分”“秒”计数器的输出状态六段显示译码器译码。通过六位LED七段显示器显示出来2.校时电路是用来对“时”“分”显示数字进行校时调整的。3.顶层原理图如下:图1 顶层文件原理图时序仿真:程序仿真主要由计数器完成,在时钟脉冲作用下,完成始终功能,由时序图可以看出每个时钟上升沿到来时加一,当接受到REST信号,即REST为高电平,所有计数为零,并重新计数,SETMIN 和SETHOUR可以完成调节时钟功能,都是高电平调节,每来一个脉冲,相应的时或分加1。图2 时序仿真五电子时钟模块设计1. 分频模块FENPIN设计模块FENPIN原理图如下:图3 FENPIN原理图FENPIN源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity FENP isport(clk1:in std_logic;clk:out std_logic);end;architecture one of FENP issignal a:std_logic_vector(8 downto 0);signal b,c:std_logic;beginprocess(clk1)beginif clk1event and clk1=1 thenif a=100000000 thenb=1;a=000000000;elsea=a+1;b=0;end if;end if;end process;clk=b;end;仿真波形如下:图4 FENPIN 波形图2. 模块MIAO1设计模块MIAO1原理图如下,CLK和RESET控制DAOUT,SETIME和CLK控制ENMIN图5 SECOND的原理图MIAO1 的源程序如下library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity miao1 isport (clk,reset,setmin: in std_logic;daout: out std_logic_vector(6 downto 0);enmin:buffer std_logic);end;architecture two of miao1 issignal d:std_logic_vector(6 downto 0);signal enmin1,enmin2:std_logic;beginprocess(clk,reset,setmin)beginif reset=1then d=0000000;elsif (clkevent and clk=1) thenif d16#60# thenif d=1011001 thend=0000000;enmin1=1;else d=d+1;enmin1=0;if d(3 downto 0)=1001 then d=d+7;end if;end if;end if; end if; end process;daout=d;enmin=(enmin1 or enmin2);enmin2=(setmin and clk);end;波形仿真图如下图1-4 MIAO1 的波形仿真3. 模块FENZ设计模块FENZ原理图如下,CLK和RESET控制DAOUT,SEHOUR控制ENHOUR图6 MIN的原理图FENZ的源程序如下library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fenz isport (reset,clk,sethour,clk1: in std_logic;daout: out std_logic_vector(6 downto 0);enhour:buffer std_logic);end;architecture two of fenz issignal d:std_logic_vector(6 downto 0);signal enhour1,enhour2:std_logic;beginprocess(clk,clk1,reset,sethour)beginif reset=1then d=0000000;elsif (clkevent and clk=1) thenif d16#60# thenif d=1011001 thend=0000000;enhour1=1;else d=d+1;enhour1=0;if d(3 downto 0)=1001 then d=d+7;end if;end if;end if; end if; end process;daout=d;enhour=(enhour1 or enhour2);enhour2=(sethour and clk1);end;波形仿真图如下图7 FENZ 的波形仿真4. 模块HOUR设计模块HOUR原理图如下,CLK和RESET控制DAOUT。图8 HOUR的原理图HOUR的源程序如下library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity hour isport (reset,clk: in std_logic;daout: out std_logic_vector (5 downto 0);end;architecture two of hour issignal d:std_logic_vector(5 downto 0);beginprocess(clk,reset)beginif reset=1then d=000000;elsif (clkevent and clk=1) thenif d16#60# thenif d=100011 thend=000000;else d=d+1; if d(3 downto 0)=1001 then d=d+7;end if;end if;end if; end if; end process;daout=d;end;波形仿真图如下 图9 HOUR 的波形仿真5. 模块XIANS设计模块XIANS原理图如下,当SEL取不同值时DAOUT分别选择输出SEC .MIN .HOUR图10 SELTIME的原理图XIANS的源程序如下library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity xians isport(clk2,reset:in std_logic;miao1,fenz:in std_logic_vector(6 downto 0);hour :in std_logic_vector(5 downto 0);daout:out std_logic_vector(3 downto 0);sel:out std_logic_vector(2 downto 0);end;architecture one of xians issignal q: std_logic_vector(2 downto 0);beginprocess(clk2,reset,miao1,fenz,hour)beginif reset=1thenq=000;elsif (clk2event and clk2=1) then q=q+1;end if;end process;process(q,reset)beginif reset=1thendaoutdaoutdaout(2 downto 0)=miao1(6 downto 4);daout(3)daoutdaout(2 downto 0)=fenz(6 downto 4);daout(3)daoutdaout(1 downto 0)=hour(5 downto 4);daout(3 downto 2)null;end case; end if; end process;selddddddnull;end case; end process;process(d)begincase d iswhen 0000=yyyyyyyyyynull;end case;end process;end;仿真波形如下:图13 QIDUAN的波形图7模块BAOS设计BAOS原理图如下,当DAIN为0的时候SPEAK发声,在这段发声时间内LAMP的三个灯相继点亮。图14 BAOS原理图BAOS源程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity baos isport (clk: in std_logic;dain: in std_logic_vector(6 downto 0);speak:out std_logic;camp:out std_logic_vector(2 downto 0);end;architecture two of baos issignal a:std_logic_vector( 2 downto 0);beginprocess(clk)beginif (clkevent and clk=1) thenif dain=0000000 thena camp camp camp camp=000;end case;end if;end if;end process;process(clk)beginif (clkevent and clk=1) thenif dain=0000000 thenspeak=1;else speak=0;end if; end if; end process; end;仿真波形如下:图15 BAOS波形图实验总结:一 自己对原理图的修正1 如果将FENZ中的始终脉冲输入端CLK1接到second的输入端enmin上,则导致在时间校正上出现了问题,即:要等到六十秒才能加一,这样就导致校正时间的延长。2 如果将FENZ中的时钟脉冲输入端CLK接到CLK1上二 交通灯设计设计说明:现代,在城市的交通繁忙的交叉路口,行人比较多的路口,或学校附近都设有许多的红绿交通灯。它指示着行人、车辆有序的通行。其中,红灯停,绿灯行,黄灯表警示。在灯的旁边还有数字晶体显示器,用于提示行人、司机三种颜色的灯即将跳转所剩的时间,让其做好应有的准备。一 计要求:1 在十字路口的方向上各设一组红绿黄灯,显示顺序为:其中一个方向是绿灯、黄灯、红灯,另外一个方向是红灯、绿灯、黄灯。2 设置4个数码管,以倒计时的方式显示允许通过或禁止的时间,其中绿灯、黄灯、红灯的持续时间分别是30秒、5秒、35秒。二 设计原理图图1-1状态转换图三、顶层原理图图1-2 顶层原理图波形仿真图如下:图1-3交通灯仿真波形四、通灯控制器的各模块设计1、模块CNT8设计模块FENPIN如下图,该模块的功能是将时间256分频,得到占空比为1:256的方波。图1-4 CNT8顶层图分频器CNT8的源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity CNT8 isport ( clk : in std_logic;d: out std_logic;sel: buffer std_logic_vector(2 downto 0);end;architecture one of CNT8 issignal a : std_logic_vector(7 downto 0);beginprocess(clk)beginif clk event and clk =1 then a=a+1;sel=sel+1;end if; end process;d=a(7);end;波形仿真如下:图1-5 CNT8波形仿真图2、模块JTD设计如图1-2,该模块为整个程序的核心,它实现东西和南北方向的三种交通灯颜色的交替点亮、时间的倒计时。图1-6 JTD顶层图JTD源程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity JTD isport(clk,clr:in std_logic;ge,shi:buffer std_logic_vector(3 downto 0);dx,nb:buffer std_logic_vector(2 downto 0);end;architecture q of JTD istype w is(a,b,c,d);signal zhuangtai:w;beginprocess(clk,clr,zhuangtai)beginif clr=1 thendx=010;nb=100;ge=0101;shidx=100;nb=001;if ge=0000 thenif shi=0000 thenzhuangtai=c
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 贵州社区工作者考试真题及答案
- 考点攻克人教版八年级《简单机械》定向攻克试卷(含答案详解版)
- 中医基础应试考试题库及答案
- 解析卷-人教版八年级上册物理声现象《噪声的危害和控制》综合测评试卷(解析版含答案)
- 后勤财务岗位考试题及答案
- 难点解析-人教版八年级上册物理声现象《噪声的危害和控制》专项攻克试卷(含答案解析)
- 护士中医外科考试题库及答案
- 考点攻克人教版九年级《电功率》章节测试试卷(含答案详解)
- 一级二级考试题目及答案
- 山东中考信息技术考试题库及答案
- 肝癌中医治疗新进展
- 药品类体外诊断试剂专项培训课件
- 水处理设备运行与维护保养手册
- 高中数学新教材选择性必修第二册《4.2等差数列》课件
- 2025年九省联考新高考 数学试卷(含答案解析)
- 2025年九省联考新高考 语文试卷(含答案解析)
- 建筑识图与构造 课件 项目8 识读建筑详图
- 《湖南省职工基本医疗保险门诊慢特病基础用药指南(第一批)》
- 四年级上册道德与法治学科质量分析报告
- 2024风电齿轮箱润滑油生物基滤芯
- 未被列入违法失信名单承诺书
评论
0/150
提交评论