




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
设计一个含有时/分/秒的时钟设计要求:1.具有秒,分,时时钟显示功能,在6个LED上显示小时按24小时制计时. 2.具有校准功能下面程序是没有控制系统在,而且有错误在,高手来帮我看看吧!library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity lb is port (clk : in std_logic; y0 : out std_logic_vector (7 downto 0); ds : out std_logic_vector (4 downto 0); end ;architecture fly of lb is signal d :integer range 0 to 5 ; begin process (clk) variable a : integer range 0 to 4000; begin if clkevent and clk =1 then if a4000 then a:=a+1; else a:=0; if d09 then d0=d0+1; else d0=0; if d15 then d1=d1+1; else d1=0; if d29 then d2=d2+1; else d2=0; if d35 then d3=d3+1; else d3=0; if d43 then d4=d4+1; else d4=0; if d52 then d5=d5+1; else d5 y0 y0 y0 y0 y0 y0 y0 y0 y0 y0 y0 y1 y1 y1 y1 y1 y1 y1 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y3 y3 y3 y3 y3 y3 y3 y4 y4 y4 y4 y2 y5 y5 y5 y=y0; ds y=y1; ds y=y2; ds y=y3; ds y=y4; ds y=y5; ds=101111; q=0 AND COUNT210 THEN COUNT2:=COUNT2+1; ELSE COUNT2:=0; DOUT2= NOT DOUT2; END IF; END IF;if clrm=1 then-当clr为1时,高低位均为0cnt1:=0000;cnt0:=0000;elsif clkevent and clk=1 then if stop=1 then cnt0:=cnt0; cnt1:=cnt1; end if;if cnt1=1001 and cnt0=1000 then-当记数为98(实际是经过59个记时脉冲)co=1;-进位cnt0:=1001;-低位为9elsif cnt01001 then-小于9时cnt0:=cnt0+1;-计数-elsif cnt0=1001 then-clk1=not clk1;elsecnt0:=0000;if cnt11001 then-高位小于9时cnt1:=cnt1+1;elsecnt1:=0000;co=0;end if;end if;end if;secm1=cnt1;secm0=cnt0;end process;end SEC; 3. 秒模块程序清单 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity SECOND isport(clk,clr:in std_logic;-时钟/清零信号 sec1,sec0:out std_logic_vector(3 downto 0);-秒高位/低位 co:out std_logic);-输出/进位信号end SECOND;architecture SEC of SECOND isbeginprocess(clk,clr)variable cnt1,cnt0:std_logic_vector(3 downto 0);-计数beginif clr=1 then-当ckr为1时,高低位均为0cnt1:=0000;cnt0:=0000;elsif clkevent and clk=1 thenif cnt1=0101 and cnt0=1000 then-当记数为58(实际是经过59个记时脉冲)co=1;-进位cnt0:=1001;-低位为9elsif cnt01001 then-小于9时cnt0:=cnt0+1;-计数elsecnt0:=0000;if cnt10101 then-高位小于5时cnt1:=cnt1+1;elsecnt1:=0000;co=0;end if;end if;end if;sec1=cnt1;sec0=cnt0;end process;end SEC; 4. 分模块程序清单 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity MINUTE isport(clk,en:in std_logic; min1,min0:out std_logic_vector(3 downto 0); co:out std_logic);end MINUTE;architecture MIN of MINUTE isbegin process(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clkevent and clk=1 thenif en=1 thenif cnt1=0101 and cnt0=1000 thenco=1;cnt0:=1001;elsif cnt01001 thencnt0:=cnt0+1;elsecnt0:=0000;if cnt10101 thencnt1:=cnt1+1;elsecnt1:=0000;co=0;end if;end if;end if;end if;min1=cnt1;min0=cnt0;end process;end MIN; 5. 时模块程序清单 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity HOUR isport(clk,en:in std_logic;-输入时钟/高电平有效的使能信号 h1,h0:out std_logic_vector(3 downto 0);-时高位/低位end HOUR;architecture hour_arc of HOUR isbeginprocess(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);-记数beginif clkevent and clk=1 then-上升沿触发if en=1 then-同时“使能”为1if cnt1=0010 and cnt0=0011 thencnt1:=0000;-高位/低位同时为0时cnt0:=0000;elsif cnt01001 then-低位小于9时,低位记数累加cnt0:=cnt0+1;elsecnt0:=0000;cnt1:=cnt1+1;-高位记数累加end if;end if;end if;h1=cnt1;h0=cnt0;end process;end hour_arc; 6. 动态扫描模块 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity SELTIME is port( clk:in std_logic;-扫描时钟 secm1,secm0,sec1,sec0,min1,min0,h1,h0:in std_logic_vector(3 downto 0);-分别为秒个位/时位;分个位/ daout:out std_logic_vector(3 downto 0);-输出 sel:out std_logic_vector(2 downto 0);-位选信号end SELTIME;architecture fun of SELTIME is signal count:std_logic_vector(2 downto 0);-计数信号begin sel=111) then count=000; else countdaoutdaoutdaoutdaoutdaoutdaoutdaoutdaout=h1; end case; end process;end fun;7. 报时模块 library ieee;use ieee.std_logic_1164.all;entity ALERT isport(m1,m0,s1,s0:in std_logic_vector(3 downto 0);-输入秒、分高/低位信号 clk:in std_logic;-高频声控制 q500,qlk:out std_logic);-低频声控制end ALERT;architecture sss_arc of ALERT is begin process(clk) begin if clkevent and clk=1 then if m1=0101 and m0=1001 and s1=0101 then-当秒高位为5,低位为9时且分高位为5 if s0=0001 or s0=0011 or s0=0101 or s0=0111 then-当分的低位为1或3或5或7时 q500=1;-低频输出为1
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 人体解剖试题及答案
- 小学生BP撰写攻略
- 驾驶员考试题及答案
- 券商托管面试题及答案
- 家电公司行政管理办法
- 普洱市重点中学2026届化学高三第一学期期中统考试题含解析
- 2026届福建省福州市三校联考化学高二第一学期期末质量检测试题含答案
- 专题09体会作者表达的思想感情(试题)六年级语文部编版-教师版
- 工厂减亏激励方案模板(3篇)
- 工厂器械防锈措施方案(3篇)
- 高级职称评定工作总结(3篇)
- 干部人事档案管理业务知识培训课件
- 软件项目开发需求规格说明书(标准模板)
- GB/T 9797-2022金属及其他无机覆盖层镍、镍+铬、铜+镍和铜+镍+铬电镀层
- GB/T 32288-2015电力变压器用电工钢铁心
- FZ/T 01008-2008涂层织物耐热空气老化性的测定
- 精神科病历书写精神科病历书写及范例
- 《乒乓裁判规则规程》考试题库(附答案)
- 依托自主化装备建设分布式能源三联供项目
- PCB全制程培训教材
- 应急保障措施及处置方案
评论
0/150
提交评论