版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、精选优质文档-倾情为你奉上电子设计自动化大作业题 目 数字秒表设计 学 院 控制科学与工程学院班 级 自动化0803 姓 名 学 号 二OO一一年五月十二日题 目:数字秒表的设计一、设计要求:(1)数字秒表的计时精度是10ms; (2)复位开关可以在任何情况下使用,计时在计时过程中,只要按一下复位开关,计时器就清零,并做好下次计时的准备; (3)具有启/停开关,即按一下启/停开关,启动计时器开始计时,再按一下启/停开关则停止计时。 (4)数字秒表的计时范围是0秒59分59.99秒,显示的最长时间为59分59秒二、总体设计:1、总体结构图通过3-8译码器控制8位数码管的亮灭Sel模块选择输入信号
2、控制选择模块输出的数据时钟的分秒和毫秒 输入到CHOICE中通过数据的编码控制数码管的显示2、各模块功能1) SEL模块:将扫描信号输给选择(CHOICE)模块2)选择模块:按扫描信号的指定选择输出3)3-8译码模块:通过SEL给的信号来控制8位数码管位的亮灭4)计时模块:分别对毫秒,秒,分计时 5)显示模块:通过CHOICE模块的输出信号来控制 三、单元模块设计1、模块名: sel模块设计(1)模块功能: CLK为扫描时钟脉冲,SELOUT端不停的发出扫描到的信号(2)端口定义: CLK为信号输入端 SELOUT2.0为选择到的信号输出(3)VHDL源程序library ieee;use i
3、eee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity sel is port(clk: in std_logic; selout: out std_logic_vector(2 downto 0);end sel;architecture one of sel is signal count: std_logic_vector(2 downto 0);begin process(clk) begin if clk'event and clk='1' then if (count="101&q
4、uot;) then count<="000" else count<=count+1; end if; end if; end process; selout<=count; end one;(4)仿真结果说明:来一个上升沿,SELOUT的值增1,可以证明模块是正确的。2、模块名:选择模块设计(1)模块功能: 按扫描信号的指定选择输出(2)端口定义: a,b,c为控制信号; data13.0, data23.0, data33.0, data43.0, data53.0, data63.0分别是毫秒的低位,毫秒的高位,秒的低位,秒的高位,分的低位,分的高
5、位的数据值; ch_out3.0为选择输出端。(3)VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity choice isport(a,b,c:in std_logic;data1,data2,data3,data4,data5,data6:in std_logic_vector(3 downto 0); ch_out:out std_logic_vector( 3 downto 0);end choice;architecture behave of choice iss
6、ignal ch:std_logic_vector(2 downto 0);beginch(2)<=c;ch(1)<=b;ch(0)<=a; process(ch)begincase ch iswhen"000"=>ch_out<=data1;when"001"=>ch_out<=data2;when"010"=>ch_out<=data3;when"011"=>ch_out<=data4;when"100"=>ch_out
7、<=data5;when"101"=>ch_out<=data6;when others=> null;end case; end process;end behave;(4)仿真结果说明:abc的值递增,ch_out选择输出data1,data2,data3,data4,data5,data6的值,证明模块是正确的3、模块名: 3-8译码模块设计(1)模块功能: 通过SEL给的信号来控制8位数码管位的亮灭。(2)端口定义: 输入端SEL2.0值大小来选择输出Q的值输出端Q7.0来控制灯哪位亮(3)VHDL源程序LIBRARY ieee;use ie
8、ee.std_logic_1164.all;use ieee.std_logic_unsigned.all;ENTITY decode3_8 ISPORT(SEL: IN std_logic_vector(2 downto 0); Q: OUT std_logic_vector(7 downto 0);END decode3_8;ARCHITECTURE a OF decode3_8 ISBEGINQ <= "" when sel = 0 else "" when sel = 1 else "" when sel = 2 els
9、e "" when sel = 3 else "" when sel = 4 else "" when sel = 5 else ""END a;(4)仿真结果说明:Sel的值递增,Q的相应位会亮,证明模块是正确的。41模块名: 毫秒计时模块设计(1)模块功能: 对毫秒位的计数(2)端口定义: clk为信号时钟输入端 reset为复位端 pause为暂停端 co为进位信号输出端 qh:毫秒信号的高位输出端 ql: 毫秒信号的低位输出端(3)VHDL源程序library ieee;use ieee.std_logic
10、_1164.all;use ieee.std_logic_unsigned.all;entity m100 isport(clk:in std_logic; reset:in std_logic; pause:in std_logic; co:out std_logic; qh:buffer std_logic_vector(3 downto 0); ql:buffer std_logic_vector(3 downto 0);end m100;architecture behave of m100 isbeginco<='1' when (qh="1001&q
11、uot; and ql="1001") else '0' process(clk,reset,pause)begin if(reset='0') thenqh<="0000"ql<="0000" elsif(pause='0')then qh<=qh; ql<=ql; elsif (clk'event and clk='1') thenif (ql="1001") thenql<="0000"
12、if (qh="1001") then qh<="0000" else qh<=qh+1; end if; else ql<=ql+1;end if; end if; end process;end behave;(4)仿真结果说明:毫秒为100进制,高位和地位都是10进制,高位到10会有进位,可以证明模块的正确性4.2模块名: 秒计时模块设计(1)模块功能: 对毫秒位的计数(2)端口定义: clk为信号时钟输入端 reset为复位端 pause为暂停端 co为进位信号输出端 qh:毫秒信号的高位输出端 ql: 毫秒信号的低位输出端(3
13、)VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity m60_sec isport(reset:in std_logic; pause:in std_logic; ci:in std_logic; co:out std_logic; qh:buffer std_logic_vector(3 downto 0); ql:buffer std_logic_vector(3 downto 0);end m60_sec;architecture behave of m60_sec
14、isbegin co<='1' when (qh="0101" and ql="1001" and ci='1') else '0'process(reset,pause,ci)begin if(reset='0') thenqh<="0000"ql<="0000" elsif(pause='0')then qh<=qh; ql<=ql; elsif (ci'event and ci='1&
15、#39;) thenif (ql="1001") thenql<="0000" if (qh="0101") then qh<="0000" else qh<=qh+1; end if; else ql<=ql+1;end if; end if;end process;end behave;(4)仿真结果说明:秒进制为60进制,高位到6会有进位,低位为10进制,可以证明模块的正确性4.3模块名: 分计时模块设计(1)模块功能: 对毫秒位的计数(2)端口定义: clk为信号时钟输入端 rese
16、t为复位端 pause为暂停端 co为进位信号输出端 qh:毫秒信号的高位输出端 ql: 毫秒信号的低位输出端(3)VHDL源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity m60_min isport(reset:in std_logic; pause:in std_logic; ci:in std_logic; qh:buffer std_logic_vector(3 downto 0); ql:buffer std_logic_vector(3 downto 0);end
17、m60_min;architecture behave of m60_min isbeginprocess(reset,pause,ci)begin if(reset='0') thenqh<="0000"ql<="0000" elsif(pause='0')then qh<=qh; ql<=ql; elsif (ci'event and ci='1') thenif (ql="1001") thenql<="0000" if (
18、qh="0101") then qh<="0000" else qh<=qh+1; end if; else ql<=ql+1;end if; end if;end process;end behave;(4)仿真结果说明:高位为6进制,低位为10进制,ci为脉冲信号,当ql=9的时候,qh在下一时刻会增1,可以证明模块的正确性5、模块名: 显示模块设计(1)模块功能: 通过CHOICE模块的输出信号来控制(2)端口定义: adr是选择模块结果的输入端q_show是控制数码管段亮的输出端(3)VHDL源程序library ieee;us
19、e ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity BCD_7 isport(adr:in std_logic_vector(3 downto 0); q_show:out std_logic_vector(6 downto 0);end BCD_7;architecture behave of BCD_7 is beginprocess(adr)begincase adr iswhen "0000"=>q_show<=""when "0001"
20、=>q_show<=""when "0010"=>q_show<=""when "0011"=>q_show<=""when "0100"=>q_show<=""when "0101"=>q_show<=""when "0110"=>q_show<=""when "0111"=>q_show<=""when "1000"=>q_show<=""when "1001"=>q_show<=""when others=>null;end case;end process;end behave;(
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 羽毛球拍制作工改进知识考核试卷含答案
- 循环冷却水操作工复试能力考核试卷含答案
- 牧草栽培工安全生产规范考核试卷含答案
- 热硫化硅橡胶生产工改进强化考核试卷含答案
- 调味品品评师岗位质量能力考核试卷含答案
- 意匠工操作能力强化考核试卷含答案
- 芳香保健师保密竞赛考核试卷含答案
- 挤出拉制模具工岗中实操考核试卷含答案
- 数据安全管理员安全意识强化模拟考核试卷含答案
- 2025年甘肃省庆阳市镇原县三年级数学下学期期末检测模拟试题含答案
- 《航空材料无损检测》课件-任务一 绪论与行业特点
- 【课件】开启科学探索之旅+课件-2024-2025学年人教版(2024)八年级物理上册
- 氧化还原反应-专题训练及答案
- 传统中医养生讲座与体验行业跨境出海项目商业计划书
- 大专护理专业介绍
- 工程桩基施工验收标准与措施
- 2022年CSCO软组织肉瘤诊疗指南
- GB/T 44841-2024非合金及低合金铸铁焊接工艺评定试验
- DB41T 2466-2023 浸水电梯使用管理规范
- 2024年人教版七年级数学上册专项复习:绝对值【八大题型】原卷版+解析版
- 第二章 有理数及其运算 大单元教学设计2023-2024I学年北师大版七年级数学 上册
评论
0/150
提交评论