版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
電子時鐘設計設計要求設計一個電子時鐘。要求可以顯示時、分、秒。用戶可以設置時間。系統組成
系統可以分為以下模組:1.10進制可預置計數器模組2.6進制可預置計數器模組3.24進制可預置計數器模組4.LED解碼模組系統組成方框圖
置數按鍵控制按鍵基準時鐘計數器動態顯示解碼顯示1.10進制可預置計數器模組時鐘由時、分、秒組成,分、秒都為60進制。由於需要使用LED顯示時間,所以採用的計數器應該是10進制的,從而方便解碼模組的通用。而60進制計數器可以由10進制計數器和6進制計數器組成。2.6進制可預置計數器模組要組成一個可預置的60進制計數器,還需要一個6進制的計數器,使用10進制的進位作為6進制的計數器的時鐘信號可以組成一個60進制的計數器。24進制可預置計數器模組時鐘的小時是24進制的,所以必須設計一個24進制的可預置計數器。顯然,24進制計數器不可以使用6進制計數器和4進制計數器組成,因為這樣做的24進制計數器將給解碼帶來麻煩。4.解碼顯示模組一共有6個LED需要顯示,所以需要6個解碼模組。電子時鐘設計與仿真10進制計數器VHDL程式--檔案名:counter10.vhd。--功能:10進制計數器,有進位C--最後修改日期:2004.3.20libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entitycounter10isPort(clk:instd_logic;reset:instd_logic;din:instd_logic_vector(3downto0);
dout:outstd_logic_vector(3downto0);
c:out
std_logic);endcounter10;architectureBehavioralofcounter10issignalcount:std_logic_vector(3downto0);begin
dout<=count;
process(clk,reset,din) begin ifreset='0'thencount<=din;c<='0';
elsif
rising_edge(clk)thenifcount="1001"thencount<="0000";c<='1';elsecount<=count+1;c<='0';endif;endif;endprocess;endBehavioral;10進制計數器仿真6進制計數器VHDL程式--檔案名:counter6.vhd。--功能:6進制計數器,有進位C--最後修改日期:2004.3.20libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entitycounter6isPort(clk:instd_logic;reset:instd_logic;din:instd_logic_vector(2downto0);
dout:outstd_logic_vector(2downto0);
c:out
std_logic);endcounter6;architectureBehavioralofcounter6issignalcount:std_logic_vector(2downto0);begin
process(clk,reset,din)beginifreset='0'thencount<=din;c<='0';
elsif
rising_edge(clk)thenifcount="101"thencount<="000";c<='1';elsecount<=count+1;c<='0';endif;endif; endprocess;dout<=count;endBehavioral;6進制計數器仿真24進制計數器VHDL程式--檔案名:counter24.vhd。--功能:24進制計數器。--最後修改日期:2004.3.20libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entitycounter24isPort(clk:instd_logic;reset:instd_logic;din:instd_logic_vector(5downto0);
dout:outstd_logic_vector(5downto0));endcounter24;architectureBehavioralofcounter24issignalcount:std_logic_vector(5downto0);beginprocess(clk,reset,din)beginifreset='0'thencount<=din;
elsif
rising_edge(clk)then ifcount(3downto0)="1001"thencount(3downto0)<="0000"; count(5downto4)<=count(5downto4)+1;elsecount(3downto0)<=count(3downto0)+1;endif;ifcount="100011"thencount<="000000";endif;endif;endprocess;dout<=count;endBehavioral;24進制計數器仿真解碼器VHDL程式--檔案名:decoder.vhd。--功能:將4bit二進位數解碼,在LED上顯示相應數字。--最後修改日期:2004.3.20libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entitydecoderisPort(din:instd_logic_vector(3downto0);--四位二進位碼輸入dout:outstd_logic_vector(6downto0));--輸出LED七段碼enddecoder;architectureBehavioralofdecoderisbeginprocess(din)begincasediniswhen"0000"=>dout<="0000001";--0when"0001"=>dout<="1001111";--1when"0010"=>dout<="0010010";--2when"0011"=>dout<="0000110";--3when"0100"=>dout<="1001100";--4when"0101"=>dout<="0100100";--5when"0110"=>dout<="0100000";--6when"0111"=>dout<="0001111";--7when"1000"=>dout<="0000000";--8when"1001"=>dout<="0000100";--9whenothers=>dout<="1111111";endcase;endprocess;endBehavioral;頂層設計VHDL程式--檔案名:clock.vhd。--功能:時鐘的頂層設計。--最後修改日期:2004.3.20libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entityclockisPort(clk:instd_logic;--1Hzreset:instd_logic;--複位信號
dins:instd_logic_vector(6downto0);--秒鐘預置
dinm:instd_logic_vector(6downto0);--分鐘預置
dinh:instd_logic_vector(5downto0);--時鐘預置
secondl:outstd_logic_vector(6downto0);--秒鐘低位輸出
secondh:outstd_logic_vector(6downto0);--秒鐘高位輸出
minutel:outstd_logic_vector(6downto0);--分鐘低位輸出
minuteh:outstd_logic_vector(6downto0);--分鐘高位輸出
hourl:outstd_logic_vector(6downto0);--小時低位輸出
hourh:outstd_logic_vector(6downto0));--小時高位輸出endclock;architectureBehavioralofclockiscomponentcounter10is Port(clk:instd_logic;reset:instd_logic;din:instd_logic_vector(3downto0);
dout:outstd_logic_vector(3downto0);
c:out
std_logic);endcomponent;componentcounter6is Port(clk:instd_logic;reset:instd_logic;din:instd_logic_vector(2downto0);
dout:outstd_logic_vector(2downto0);
c:out
std_logic);endcomponent;componentcounter24is Port(clk:instd_logic;reset:instd_logic;din:instd_logic_vector(5downto0);
dout:outstd_logic_vector(5downto0));endcomponent;
componentdecoderis Port(din:instd_logic_vector(3downto0);
dout:outstd_logic_vector(6downto0)); endcomponent; signalc1,c2,c3,c4:std_logic; signaldoutsl,doutml:std_logic_vector(3downto0); signaldoutsh,doutmh:std_logic_vector(2downto0); signaldouth:std_logic_vector(5downto0); signalrdoutsh,rdoutmh:std_logic_vector(3downto0); signalrdouth:std_logic_vector(7downto0);begin
rdoutsh<='0'&doutsh;--將秒鐘高位數據變為4位,再進行解碼
rdoutmh<='0'&doutmh;--將分鐘高位數據變為4位,再進行解碼
rdouth<="00"&douth;--將時鐘高位數據變為4位,再進行解碼
u1:counter10portmap(clk=>clk,reset=>reset,din=>dins(3downto0),dout=>doutsl,c=>c1);u2:counter6portmap(clk=>c1,reset=>reset, din=>dins(6downto4),dout=>doutsh,c=>c2);u3:counter10portmap(clk=>c2,reset=>reset,din=>dinm(3downto0),
dout=>doutml,c=>c3);u4:counter6portmap(clk=>c3,reset=>reset, din=>dinm(6downto4),dout=>doutmh,c=>c4);
u5:counter24portmap(clk=>c4,reset=>reset, din=>dinh,dout=>douth);u
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 小学五年级体育与健康教学设计:足球定位球射门技战术提升与实战应用
- 陕西省咸阳市实验中学2026-2027学年高二上学期11月期中考试历史试卷
- 6.2 展现大国担当 课件(共21张) 统编版(新教材)道德与法治九年级下册
- 2026年计算机网络技术(网络布线实操)试题及答案
- 2026年中药学(中药资源学)试题及答案
- GBT 48599-2026《干部网络培训 直播要求》
- 达芬奇机器人手术体位安置规范
- 癃淋浊毒内蕴的中医护理查房
- 泌尿外科护理讲课课件
- 尿道悬吊术治疗女性压力性尿失禁的围手术期护理
- 2026年国家电网统招考试管理类专业知识模拟试题及答案(十一)
- 山东省烟台市2026-2027学年度高三上学期期中考试化学试卷
- 初中英语阅读理解长难句核心词汇2000词带音标
- 电力线路施工人员培训协议
- 2026交管12123学法减分题库200题(含答案完整版)
- 2026年放射治疗技师高频面试题包含详细解答
- 保密融入业务工作制度
- 《电子商务系统分析与设计》课程教学大纲
- 期中检测(1-5单元)(试题)-2025-2026学年六年级上册数学人教版 (含答案)
- 电风暴的临床处理课件
- 保安督察管理办法
评论
0/150
提交评论