




免费预览已结束,剩余7页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
数字逻辑电路实验报告姓名:班级:学号:指导老师:耿霞学校:江苏大学目录一、实验目的3二、设计要求3三、具体设计思路31. 24进制计数器的设计42. 60进制计数器的设计53. 二路选择器的设计64. 分频器的设计65. 动态扫描的涉及76. 整点报时功能的设计87. 选择显示与闹钟设置的设计9四、顶层图10五、各个模块111. 计时模块112. 整点报时与闹钟模块11六、设计总结12一:实验目的1. 学会应用数字系统方法进行电路设计;2. 进一步学会应用Quartus软件开发应用能力;3. 培养综合实验的能力。二:设计要求设计一个多功能数字时钟,具有以下几个功能:(1) 能进行正常的时、分、秒计时。 使用一个二十四进制和两个六十进制的计数器级联。分计数器以秒计数器的进位作为计数脉冲,小时计数器以分计时器的进位作为计数脉冲。 给秒1Hz。(2) 可以使用以EP1C12F324C8为核心的硬件系统上的脉冲按键或者拨动开关实现“校时”,“校分”及清零功能。(3) 可以使用系统上的扬声器进行整点报时 计时到59分50秒时,每两秒一次低音报时,整点进行高音报时。 低音报时用512Hz,高音报时用1kHz。(4) 设置闹钟,并连接扬声器实现闹铃功能。 设定闹钟时间与新的计数器进行存储,与正常计时互不干扰。 与正常计时状态进行切换。 设定一个比较模块,当计时与闹钟相等时,驱动扬声器鸣叫。 闹钟响声控制在一分钟之内,可以在一分钟设置按键取消闹时状态(5) 用动态数码管显示时间。 用6个数码管,分别用一组独立的七段码进行驱动显示,将小时高位到秒低位共6组时间经过7段译码,按照顺序锁定到数码管上。 用动态扫描的方式显示。 扫描频率越高越稳定。三:具体设计思路利用按键实现“校时”,“校分”及清零功能。(1) SA:校时键。按下SA键时,时计数器迅速递增,按24小时循环,并且计满23时回到00.(2) SB:校分键。按下SB键时,分计数器迅速递增,按60小时循环,并且计满59时回到00,但不向时进位。(3) SC:秒清零。按下SC时,秒计数器清零。(4) 要求按键均不产生数字跳变,因此需要进行销抖处理。用D触发器。实现:1. 24进制计数器的设计: VHDL语言描述:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity cnt24 is port(rst,clk:in std_logic; co:out std_logic; qout:out std_logic_vector(7 downto 0); end cnt24; architecture behave of cnt24 is signal qh,ql:std_logic_vector(3 downto 0); signal tco:std_logic; begin process(clk,rst) begin if (rst=0) then qh=0000; ql=0000; tco=0;/若rst为0时,十位qh以及个位ql都清零,且不进位 elsif (clkevent and clk=1) then if (ql9 and (qh=0 or qh=1) then /当个位ql小于9,十位qh等于0或1时ql=ql+1;qh=qh; /个位ql加1,qh不变 end if; if(ql=9) then / /当个位ql等于9时ql=0000; /个位ql清零 qh=qh+1; /十位qh加1end if; if(ql4 and qh=2) then /当十位qh等于2,个位ql小于4时 ql=ql+1;qh=qh; /个位ql加1,十位qh不变 end if; if(ql=3 and qh=2) then /当十位qh等于2,个位ql等于3 qh=0000;ql=0000; /十位、个位都清零 end if; end if; qout=qh&ql;co=tco; /通过qout输出十位个位 end process;end behave;2. 60进制计数器的设计: VHDL语言描述:library ieee;use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity cnt60 is port(rst,clk:in std_logic; co:out std_logic; qout:out std_logic_vector(7 downto 0); end cnt60; architecture behave of cnt60 is signal qh,ql:std_logic_vector(3 downto 0); signal tco:std_logic; begin process(clk,rst) begin if (rst=0) then qh=0000; ql=0000; tco=0;/当rst为0时,十位qh和个位ql清零,不进位 elsif (clkevent and clk=1) then if (ql=9) then /当个位ql等于9时 if (qh=5) then qh=0000;ql=0000;tco=1;/如果是为qh等于5,则十位qh和个位ql为零,并产生一个进位信号 else qh=qh+1;ql=0000;tco=0;/如果qh不是等于5,则十位qh加1,个位ql为零,不产生进位信号 end if; else ql=ql+1;qh=qh; tco=0; /如果个位ql不为9,则个位ql加1,十位qh不变,并不产生进位信号 end if; end if; qout=qh&ql;co=tco; /通过qout输出十位和个位 end process; end behave;3. 二路选择器的设计:VHDL语言描述:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity dex2 is port(panduan,wubai,yiqian:in std_logic; shuchu:out std_logic);end entity dex2; architecture behave of dex2 is beginprocess(panduan,wubai,yiqian) begin if(panduan=0) then shuchu=wubai; /当panduan为0时,输出wubai端口的输入 else shuchu=yiqian; /否则shuchu端口输出yiqian的端口输入 end if;end process;end behave;4. 分频器的设计:VHDL语言描述: library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fenpin is port(clk:in std_logic; hz1,hz4,hz64,hz512:out std_logic);end entity fenpin;architecture behavior of fenpin is signal q:std_logic_vector(9 downto 0); begin process(clk)beginif(rising_edge(clk) then q=q+1;end if;end process;hz1=q(9);hz4=q(7);hz64=q(3);hz512=q(0);end behavior; /将1KHz分为1Hz、4Hz、64Hz、512Hz输出5. 动态扫描的设计:VHDL语言描述:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity dtsm is port( clk:in std_logic; s:in std_logic_vector(7 downto 0); m:in std_logic_vector(7 downto 0); h:in std_logic_vector(7 downto 0); ledag:out std_logic_vector(6 downto 0); sel:out std_logic_vector(2 downto 0);end dtsm;architecture behave of dtsm is signal out1:std_logic_vector(3 downto 0); signal sel1:std_logic_vector(2 downto 0); begin p1:process(clk) begin if rising_edge(clk) then /当有一个上升沿脉冲 sel1=sel1+1; /sel自增1 end if; selout1out1out1out1out1out1out1ledagledagledagledagledagledagledagledagledagledagledagledag=0000000; /当不是09时,不显示 end case; end process p3; end behave;6. 整点报时功能的设计:VHDL语言描述: library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity zdbs is port( s:in std_logic_vector(7 downto 0); m:in std_logic_vector(7 downto 0); shuchu,panduan:out std_logic);end entity zdbs;architecture behave of zdbs is begin p1:process(s,m)beginif(1001=m(3 downto 0)and(0101=m(7 downto 4)and(0101=s(7 downto 4)and s(3 downto 0)=0000)or(1001=m(3 downto 0)and(0101=m(7 downto 4)and(0101=s(7 downto 4)and s(3 downto 0)=0010)or(1001=m(3 downto 0)and(0101=m(7 downto 4)and(0101=s(7 downto 4)and s(3 downto 0)=0100)or(1001=m(3 downto 0)and(0101=m(7 downto 4)and(0101=s(7 downto 4)and s(3 downto 0)=0110)or(1001=m(3 downto 0)and(0101=m(7 downto 4)and(0101=s(7 downto 4)and s(3 downto 0)=1000)then panduan=1;shuchu=0;/当分钟为59分,且秒钟为50秒、52秒、54秒、56秒、58秒时,panduan输出1,shuchu输出0(即低音报时)elsif(0000=m(3 downto 0)and(0000=m(7 downto 4)and(0000=s(7 downto 4)and s(3 downto 0)=0000)then panduan=1;shuchu=1;/当分钟和秒钟都为0,即整点时,panduan输出1,shuchu输出1(即高音报时)else panduan=0; /否则panduan输出0,即不报时end if;end process;end behave;7. 选择显示与闹钟设置的设计:VHDL语言描述: library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity nz is port( shuru:in std_logic; ndm:in std_logic_vector(7 downto 0); ndh:in std_logic_vector(7 downto 0); m:in std_logic_vector(7 downto 0); h:in std_logic_vector(7 downto 0); outh:out std_logic_vector(7 downto 0); outm:out std_logic_vector(7 downto 0); shuchu:out std_logic);end nz;architecture behave of nz is begin process(shuru,ndm,ndh,m,h)beginif(shuru=0)then outm(7 downto 0)=m(7 downto 0);outh(7 downto 0)=h(7 downto 0);/如果shuru等于0,则输出显示现在时间 if(ndm(7 downto 0)=m(7 downto 0)and ndh(7 downto 0)=h(7 downto 0)then shuchu=1;/如果现在时间和设定的闹钟时间相等,则shuchu输出1(闹钟响) else shuchu=0; /否则shuchu输出0(闹钟不响
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 安全无毒消杀培训内容课件
- 生产安全单位安全培训课件
- 农业碳汇项目碳排放监测与减排效果评估报告
- 理财课程解读课件
- 改造工程标段划分方案(3篇)
- 饭堂净水工程方案(3篇)
- 顶管工程测量方案(3篇)
- 安全文明施工内容培训课件
- 猫郑振铎课件简介
- 分包工程接口方案(3篇)
- saas货运管理办法
- excel操作考试题及答案
- 2025新疆生产建设兵团草湖项目区公安局面向社会招聘警务辅助人员考试参考试题及答案解析
- 2026届广东省广州市高三上学期8月调研考试语文试题(含答案)
- 江苏省南通市如皋市2025-2026学年高三上学期开学考试数学试卷
- 2025年高一语文开学第一课指导课件
- 2025年事业单位工勤技能-河北-河北计算机操作员二级(技师)历年参考题库含答案解析(5套)
- 社会资本测量方法-洞察及研究
- 无菌GMP基础知识培训课件
- 喷雾干燥课件
- 《网页设计与制作Dreamweaver-cs6》教学课件(全)
评论
0/150
提交评论