




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
实验四:电子钟显示一、 实验目的(1)掌握较复杂的逻辑设计和调试。(2)学习用原理图+VHDL语言设计逻辑电路。(3)学习数字电路模块层次设计。(4)掌握ispLEVER 软件的使用方法。(5)掌握ISP 器件的使用。二、实验所用器件和设备在系统可编程逻辑器件ISP1032 一片示波器 一台万用表或逻辑笔 一只TEC-5实验系统,或TDS-2B 数字电路实验系统 一台三、 实验内容数字显示电子钟1、任务要求(1)、时钟的“时”要求用两位显示;上、下午用发光管作为标志;(2)、时钟的“分”、“秒”要求各用两位显示;(3)、整个系统要有校时部分(可以手动,也可以自动),校时时不能产生进位;(4)*、系统要有闹钟部分,声音要响5秒(可以是一声一声的响,也可以连续响)。VHDL源代码:LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; -主体部分-ENTITY clock is port(clk,clr,put,clk1 : in std_logic; - clr 为清零信号,put 为置数脉冲,clk1 为响铃控制时钟choice : in std_logic; -用来选择时钟状态的脉冲信号lighthour : out std_logic_vector(10 downto 0); lightmin : out std_logic_vector(7 downto 0); lightsec : out std_logic_vector(7 downto 0); -输出显示ring : out std_logic); -响铃信号end clock; -60进制计数器模块ARCHITECTURE func of clock is component counter_60 port(clock : in std_logic; clk_1s : in std_logic; putust : in std_logic; clr : in std_logic; load : in std_logic; s1 : out std_logic_vector(3 downto 0); s10 : out std_logic_vector(3 downto 0);co : out std_logic); end component; -24进制计数器模块component counter_24 port(clock : in std_logic; clk_1s : in std_logic; putust : in std_logic; clr : in std_logic; load : in std_logic; s1 : out std_logic_vector(3 downto 0); s10 : out std_logic_vector(6 downto 0); end component; signal sec,a:std_logic; - 2 分频产生1s信号signal l1,l2,l3:std_logic; -判定对时间三部分修改signal c1,c2:std_logic; -进位信号signal load:std_logic_vector(1 downto 0); signal temp:integer range 0 to 2499; signal temp1:integer range 0 to 95; -计数信号signal sec_temp:std_logic_vector(7 downto 0); -总进程begin u1 : counter_60 port map (sec,sec,put,clr,l1,sec_temp(3 downto 0),sec_temp(7 downto 4),c1); u2 : counter_60 port map (c1,sec,put,clr,l2,lightmin(3 downto 0),lightmin(7 downto 4),c2); u3 : counter_24 port map (c2,sec,put,clr,l3,lighthour(3 downto 0),lighthour(10 downto 4); lightsec(7 downto 0) l1=0; -非修改状态l2=0; l3=0; load l1=0; -此状态下对小时进行修改l2=0; l3=1; load l1=0; -此状态下对分钟进行修改 l2=1; l3=0; load l1=1; -此状态下对秒进行修改 l2=0; l3=0; load=00; end case; end if; end process; -计数进程process(clk) beginif (clkevent and clk=1) then -分频if (temp=2499) thentemp = 0; sec=not sec; else temp = temp+1; end if; end if; end process; -响铃进程process(clk1) begin if(clk1event and clk1=1) thenif (temp1=95) thentemp1=0; a=not a; else temp1=temp1+1; end if; end if; end process; ring=a when (c2=1 and sec_temp5 and sec=1) else -5s整点响铃0; end func; library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity counter_60 is port (clock : in std_logic; -计数信号,即低位的进位信号或时钟脉冲信号clk_1s : in std_logic; -周期1s 的时钟信号putust : in std_logic; -调表置数信号clr : in std_logic; -清零load : in std_logic; -判定信号s1 : out std_logic_vector(3 downto 0); -计数器的个位s10 : out std_logic_vector(3 downto 0); -计数器的十位co : out std_logic ); end counter_60; if(load=1 ) -防止脉冲产生进位 co_ temp=0;architecture func of counter_60 is signal s1_temp: std_logic_vector(3 downto 0); signal s10_temp : std_logic_vector(3 downto 0); signal clk,co_temp : std_logic; begin clk=clock when load=0 else putust; process (clk,clr) begin if (clr=1) thens1_temp = 0000; s10_temp = 0000; elsif (clkevent and clk=1)then -进位判断if (s1_temp=9) thens1_temp = 0000;if (s10_temp=5) thens10_temp = 0000; co_temp=1; else co_temp=0;s10_temp = s10_temp+1;end if; elseco_temp=0; s1_temp = s1_temp+1; end if; end if; end process; s1 = s1_temp when (clk_1s=1or load=0) else1111; s10 = s10_temp when (clk_1s=1 or load=0) else1111; co = co_temp when (load=0) else0; end func; library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; -24进制计数器entity counter_24 is port(clock : in std_logic; -计数信号clk_1s : in std_logic; -周期1s 的时钟信号putust : in std_logic; clr : in std_logic; -清零信号load : in std_logic; -判定信号s1 : out std_logic_vector(3 downto 0); -计数器的个位s10 : out std_logic_vector(6 downto 0); -计数器的十位end counter_24; architecture func of counter_24 is signal s1_temp : std_logic_vector(3 downto 0); signal s10_temp : std_logic_vector(1 downto 0); signal clk : std_logic; begin clk=clock when load=0 else putust; process (clk,clr) begin if (clr=1) thens1_temp = 0000; s10_temp = 00; elsif (clkevent and clk=1) then if (s1_temp=3 and s10_temp=2) thens1_temp = 0000;s10_temp = 00; elsif (s1_temp=9) thens1_temp=0000; s10_temp=s10_temp+1;else s1_temp s10 s10 s10 null; end case; else s10=0000000; end if; end process; s1 = s1_temp when (clk_1s=1 or load=0) else 1111; end func;四、 实验小结:注意当时钟处于被修改
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 体育产业发展情况及未来发展研究
- 农业绿色发展2025:政策支持与精准农业技术应用分析
- 农产品深加工产业园区建设项目:环保标准与绿色发展报告
- 三育教育考试题及答案
- 2025年三基考核题目及答案
- 2025年市政工程施工员考试模拟试题及答案
- 2025年山西省晋中市事业单位工勤技能考试题库(含答案)
- 设备选型题库及答案
- 新质生产力从量变到质变
- 2025年趣味点子题目及答案
- 2025新疆天泽和达水务科技有限公司部分岗位社会招聘28人笔试参考题库附答案解析
- 涉警舆情应对课件
- 2025-2026年秋季第一学期学校“蒲公英”广播稿(22周):第1周 从烽火岁月里“穿越”来的青春答案
- 2025年四川省凉山彝族自治州中考道德与法治真题及答案
- (2025年标准)赛事承办协议书
- 2025下半年系统集成项目管理师考试真题及答案
- 急性结石型胆囊炎
- 无菌物品有效期课件
- 新媒体礼仪知识培训总结
- 人教版七年级上册数学教学计划
- 护理事业十五五发展规划(2026-2030年)
评论
0/150
提交评论