版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、实验四:电子钟显示一、 实验目的(1)掌握较复杂的逻辑设计和调试。(2)学习用原理图+VHDL语言设计逻辑电路。(3)学习数字电路模块层次设计。(4)掌握ispLEVER 软件的使用方法。(5)掌握ISP 器件的使用。二、实验所用器件和设备在系统可编程逻辑器件ISP1032 一片示波器 一台万用表或逻辑笔 一只TEC-5实验系统,或TDS-2B 数字电路实验系统 一台三、 实验内容数字显示电子钟1、任务要求(1)、时钟的“时”要求用两位显示;上、下午用发光管作为标志;(2)、时钟的“分”、“秒”要求各用两位显示;(3)、整个系统要有校时部分(可以手动,也可以自动),校时时不能产生进位;(4)*
2、、系统要有闹钟部分,声音要响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); lig
3、htmin : 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_l
4、ogic; 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
5、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:st
6、d_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
7、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; e
8、lse 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; us
9、e 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);
10、-计数器的十位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) be
11、gin 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 (c
12、lk_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
13、 : 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 down
14、to 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=; 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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- T/CSPIA 005-2021公共安全视频图像分析多算法应用技术要求
- T/YYHG 0006-2023注射剂配液分配自控系统实施规范
- T/HAEPCI 45-2022农田土壤重金属污染修复与管控方案编制规范
- T/CIE 207-2024Linux操作系统内核接口调用参考规范
- T/CAOE 47-2023大洋多金属结核资源量估算技术指南
- T/CSAE 465-2025乘用车智能底盘矢量控制及舒适加减速控制道路测试方法
- 2025-2026学年黑龙江省鸡西市初中数学九年级期末上册模考能力提升卷详细参考解析
- PHP 初级面试题及详细答案(真实企业版)
- 2026年教育系统后备干部笔试试题及答案
- PET-CT物理师专业考核试题及详细答案
- 2026年建筑安全员C证考试真题及答案
- 2026年纪检监察案件查办政策考试题及答案
- 2026年江苏省粮食集团有限责任公司人员招聘笔试备考题库及详细答案解析
- 2026年普法考试题目(+答案解析)
- 2026年秋新版道德与法治(道法)六年级上册全册分课时作业附答案
- 2025年县属国有企业招聘考试笔试试题(含答案)
- 可压缩流体管道阻力降计算表
- 分布式光伏发电系统建设规范
- 企业商业秘密保护技术应用调研报告
- 物业服务满意度调研问卷设计
- 《物业设备设施管理(第2版)》-第二章
评论
0/150
提交评论