已阅读5页,还剩21页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
此文档收集于网络,如有侵权,请联系网站删除石家庄经济学院信息工程学院电子信息工程专业EDA技术课程设计报告题目: 数 字 秒 表 姓 名 学 号 班 级 指导教师 2011年 1 月 14 日课程设计任务书班级 4081090102 姓名 陈 魏 学号 408109060127 课程设计题目 数字秒表 课程设计起止日期 2010年12月27日 至 2011年1月14日 实习地点 实验楼308 课程设计内容与要求设计一个以0.01s为基准计时信号的实用数字式秒表要求:1、及格:计时显示范围059min59.99s; 2、中:具有清零、启动计时、暂停计时及继续计时功能,操作按键(开关)不超过两个; 3、良:有倒计时功能; 4、优:具有记录最近10次计时操作结果的功能。 指导教师 董建彬 2010 年 12月 27 日课程设计报告一、设计原理与技术方法:包括:电路工作原理分析与原理图、元器件选择与参数计算、电路调试方法与结果说明;软件设计说明书与流程图、软件源程序代码、软件调试方法与运行结果说明。数字秒表计时电路控制电路显示电路时基分频六进制十进制扫描电路七段译码器 图1 数字秒表原理图时基分频:主要是给计时电路一个精确的脉冲信号 计时电路:执行计时功能,计时方法为对标准时钟脉冲计数。计时范围是0秒-59分59.99秒,那么计时采用2个六进制计数器和4个十进制计数器构成,其中毫秒位、十毫秒位、秒位和分位采用十进制计数器,十秒位和十分位采用六进制计数器。 控制电路:主要执行清零、启动、暂停和倒计时功能,分别由开关或按钮控制。 显示电路:计时显示电路的作用是将计时值在LED七段数码管上显示出来。计时电路值经过BCD七段译码后驱动LED数码管。显示则采用扫描显示,每次只驱动一位数码管,各位数据轮流驱动对应的数码管进行显示。图2 数字秒表流程图结束开始显示选通分十分控制开关十秒秒毫秒十毫秒流程图:注:此表可加附页及格:程序下载后计时从0开始到59分59.99s 图3 数字秒表(及格)整体组装设计原理图CB程序(时基分频):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cb isport(clk:in std_logic; clock:out std_logic);end cb;architecture art of cb issignal count:integer range 0 to 70000;signal clk_data:std_logic;beginprocess(clk) -时钟进程begin if clkevent and clk=1 then -上升沿时给脉冲 if count=70000 then -当脉冲计到70000时返回0 count=0; clk_data=not clk_data; -此时时钟信号变化 else count=count+1; -当脉冲没到70000时脉冲加1 end if;end if;clock=clk_data;end process;end art;COUNT10程序(十进制):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity count10 isPort(clk,en:in std_logic; Q:out std_logic_vector(3 downto 0); co:out std_logic);End count10;Architecture rtl of count10 isSignal count_4:std_logic_vector(3 downto 0);Begin Q(0)=count_4(0); -中间信号变量 Q(1)=count_4(1); Q(2)=count_4(2); Q(3)=1001)then -当开始计数,上升沿且计数到9时 co=1; -给下一个计数器一个时钟信号,计数值变为0 Count_4=0000; Else co=0; -计数值小于等于9时,只需把计数值加1即可 Count_4=count_4+1; End if; End if;End if;End process;End rtl; 图4 count10(十进制)仿真图COUNT6A程序(六进制):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity count6a isPort(clk,en:in std_logic; Q:out std_logic_vector(3 downto 0); co:out std_logic);End count6a;Architecture rtl of count6a isSignal count_4:std_logic_vector(3 downto 0);Begin Q(0)=count_4(0); Q(1)=count_4(1); Q(2)=count_4(2); Q(3)=count_4(3);Process(clk)Beginif(clkevent and clk=1)then If(en=1)then If(count_4=0101)then -当开始计数,上升沿且计数小于等于5时 co=0; -把计数值加1 Count_4=count_4+1; Else -计数大于5时,给下一个计数器一个时钟信号 co=1; 把计数值变为0 Count_4=0000; End if; End if;End if;End process;End rtl; 图5 count6a(六进制)仿真图COUNT6程序(六进制):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity count6 isPort(clk,en:in std_logic; Q:out std_logic_vector(3 downto 0);End count6;Architecture rtl of count6 isSignal count_4:std_logic_vector(3 downto 0);Begin Q(0)=count_4(0); Q(1)=count_4(1); Q(2)=count_4(2); Q(3)=count_4(3);Process(clk)Beginif(clkevent and clk=1)then If(en=1)then If(count_4=0100)then Count_4=count_4+1; Else Count_4=0000; End if; End if;End if;End process;End rtl;图6 count6(六进制)仿真图MUX6程序(六选一选通器):library ieee;use ieee.std_logic_1164.all;entity mux6 isport(INTPUT1:in std_logic_vector(3 downto 0); INTPUT2:in std_logic_vector(3 downto 0); INTPUT3:in std_logic_vector(3 downto 0); INTPUT4:in std_logic_vector(3 downto 0); INTPUT5:in std_logic_vector(3 downto 0); INTPUT6:in std_logic_vector(3 downto 0); a,b,c:in std_logic; y:out std_logic_vector(3 downto 0);end mux6;architecture rt1 of mux6 issignal sel:std_logic_vector(2 downto 0);beginsel=c&b&a;process(sel)beginif(sel=000)then -当sel为0时,选通十毫秒计数器y=INTPUT1;elsif(sel=001)then -当sel为1时,选通毫秒计数器y=INTPUT2;elsif(sel=010)then -当sel为2时,选通秒计数器y=INTPUT3;elsif(sel=011)then -当sel为3时,选通十秒计数器y=INTPUT4;elsif(sel=100)then -当sel为4时,选通分计数器y=INTPUT5; elsey=INTPUT6; -当sel为其他时,选通十分计数器end if;end process;end rt1;CNT6程序(扫描显示):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity cnt6 isPort(clk:in std_logic; qa,qb,qc:out std_logic); End cnt6;Architecture rtl of cnt6 isSignal count_3:std_logic_vector(2 downto 0);Begin Qa=count_3(0); Qb=count_3(1); Qc=count_3(2); Process(clk)Beginif(clkevent and clk=1)then If(count_3=100)then Count_3=count_3+1; Else Count_3=000; End if;End if;End process;End rtl;SEG7程序(七段译码):LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY seg7 IS PORT( A:IN STD_LOGIC_VECTOR(3 DOWNTO 0); Y:OUT STD_LOGIC_VECTOR(6 DOWNTO 0);END seg7;ARCHITECTURE a OF seg7 ISBEGIN WITH a SELECTY=1111110WHEN 0000, 七段译码器分别在LED数码管上显示a,b,c,d,e,f,g段 0110000WHEN 0001, 1101101WHEN 0010, 1111001WHEN 0011, 0110011WHEN 0100, 1011011WHEN 0101, 1011111WHEN 0110, 1110000WHEN 0111, 1111111WHEN 1000, 1111011WHEN 1001, 0000000WHEN OTHERS; END a;中:通过EN开关实现暂停/开启功能,通过CLR开关实现清零功能 CB10程序(时基分频):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cb10 isport(clk:in std_logic; clock:out std_logic);end cb10;architecture art of cb10 issignal count:integer range 0 to 70000;signal clk_data:std_logic;beginprocess(clk)begin if clkevent and clk=1 then if count=70000 then count=0; clk_data=not clk_data; else count=count+1; end if;end if;clock=clk_data;end process;end art;COUNT10程序(十进制):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity count10 isPort(clk,clr,en:in std_logic; Q:out std_logic_vector(3 downto 0); co:out std_logic);End count10;Architecture rtl of count10 isSignal count_4:std_logic_vector(3 downto 0);Begin Q(0)=count_4(0); Q(1)=count_4(1); Q(2)=count_4(2); Q(3)=count_4(3);Process(clk,clr)BeginIf(clr=1)then Count_4=1001)then co=1;Count_4=0000;Else co=0;Count_4=count_4+1;End if;End if;End if;End process;End rtl; 图7 count10(十进制)仿真图COUNT6A程序(六进制):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count6a isport(clk,clr,en:in std_logic; Q:out std_logic_vector(3 downto 0); co:out std_logic);end count6a;architecture rtl of count6a issignal count_4:std_logic_vector(3 downto 0);begin Q(0)=count_4(0); Q(1)=count_4(1); Q(2)=count_4(2); Q(3)=count_4(3);process(clk,clr)beginif(clr=1)then -当CLR控制开关为1时,清零 count_4=0000;elsif(clkevent and clk=1)then if(en=1)thenif(count_4=0100)then co=0;count_4=count_4+1;else co=1;count_4=0000;end if;end if;end if;end process;end rtl;图8 count6a(六进制)仿真图COUNT6程序(六进制):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity count6 isPort(clk,clr,en:in std_logic; Q:out std_logic_vector(3 downto 0);End count6;Architecture rtl of count6 isSignal count_4:std_logic_vector(3 downto 0);Begin Q(0)=count_4(0); Q(1)=count_4(1); Q(2)=count_4(2); Q(3)=count_4(3);Process(clk,clr)BeginIf(clr=1)then -当CLR控制开关为1时,清零 Count_4=0000;Elsif(clkevent and clk=1)then If(en=1)thenIf(count_4=0100)thenCount_4=count_4+1;Else Count_4=0000;End if;End if;End if;End process;End rtl;图9 count6(六进制)仿真图MUX6程序(六选一选通器):library ieee;use ieee.std_logic_1164.all;entity mux6 isport(INTPUT1:in std_logic_vector(3 downto 0); INTPUT2:in std_logic_vector(3 downto 0); INTPUT3:in std_logic_vector(3 downto 0); INTPUT4:in std_logic_vector(3 downto 0); INTPUT5:in std_logic_vector(3 downto 0); INTPUT6:in std_logic_vector(3 downto 0); a,b,c:in std_logic; y:out std_logic_vector(3 downto 0);end mux6;architecture rt1 of mux6 issignal sel:std_logic_vector(2 downto 0);beginsel=c&b&a;process(sel)beginif(sel=000)then y=INTPUT1;elsif(sel=001)theny=INTPUT2;elsif(sel=010)theny=INTPUT3;elsif(sel=011)theny=INTPUT4;elsif(sel=100)theny=INTPUT5;elsey=INTPUT6;end if;end process;end rt1;CNT6程序(扫描显示):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity cnt6 isPort(clk,clr:in std_logic; qa,qb,qc:out std_logic); End cnt6;Architecture rtl of cnt6 isSignal count_3:std_logic_vector(2 downto 0);Begin Qa=count_3(0); Qb=count_3(1); Qc=count_3(2); Process(clk,clr)BeginIf(clr=1)then -当CLR控制开关为1时,清零 Count_3=000;Elsif(clkevent and clk=1)then If(count_3=100)then Count_3=count_3+1;Else Count_3=000;End if;End if;End process;End rtl;SEG7程序(七段译码器):library ieee;use ieee.std_logic_1164.all;entity seg7 IS port( A:in std_logic_vector(3 downto 0); Y:out std_logic_vector(6 downto 0);end seg7;architecture a of seg7 isbegin with a selectY=1111110when 0000, 0110000when 0001, 1101101when 0010, 1111001when 0011, 0110011when 0100, 1011011when 0101, 1011111when 0110, 1110000when 0111, 1111111when 1000, 1111011when 1001, 0000000when others;end a;良好:通过UPDOWN开关实现倒计时功能 图10 数字秒表(良好)整体组装设计原理图CB10程序(时基分频):library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cb10 isport(clk:in std_logic; clock:out std_logic);end cb10;architecture art of cb10 issignal count:integer range 0 to 100000;signal clk_data:std_logic;beginprocess(clk)begin if clkevent and clk=1 then if count=100000 then count=0; clk_data=not clk_data; else count=count+1; end if;end if;clock=clk_data;end process;end art;COUNT10程序(十进制):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity count10 isPort(clk,updown,clr,en:in std_logic; Q:out std_logic_vector(3 downto 0); co:out std_logic);End count10;Architecture rtl of count10 isSignal count_4:std_logic_vector(3 downto 0);Begin Q(0)=count_4(0); Q(1)=count_4(1); Q(2)=count_4(2); Q(3)=count_4(3);Process(clk,clr)BeginIf(clr=1)then -当CLR控制开关为1时,清零 Count_4=1001)then co=1; Count_4=0000; else co=0; Count_4=count_4+1; end if; elsif(updown=0)then -当updown控制开关为0时进行倒计数 if(count_4=0000)then co=1; Count_4=1001; Else co=0; Count_4=count_4-1; End if; end if; End if;end if; End process;End rtl; 图11 count10(十进制)仿真图COUNT6A程序(六进制):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity count6a isPort(clk,clr,en,updown:in std_logic; Q:out std_logic_vector(3 downto 0); co:out std_logic);End count6a;Architecture rtl of count6a isSignal count_4:std_logic_vector(3 downto 0);Begin Q(0)=count_4(0); Q(1)=count_4(1); Q(2)=count_4(2); Q(3)=count_4(3);Process(clk,clr)BeginIf(clr=1)then Count_4=0101)then co=1; Count_4=0000; Else co=0; Count_4=count_4+1; end if; elsif(updown=0)then -当updown控制开关为0时进行倒计数 If(count_4=0000)then co=1; Count_4=0101; Else co=0; Count_4=count_4-1; end if; end if;End if;End if;End process;End rtl; 图12 count6a(六进制)仿真图COUNT6程序(六进制):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity count6 isPort(clk,clr,en,updown:in std_logic; Q:out std_logic_vector(3 downto 0);End count6;Architecture rtl of count6 isSignal count_4:std_logic_vector(3 downto 0);Begin Q(0)=count_4(0); Q(1)=count_4(1); Q(2)=count_4(2); Q(3)=count_4(3);Process(clk,clr)BeginIf(clr=1)then Count_4=0101)then Count_4=0000; Else Count_4=0000)then Count_4=0101; Else Count_4=count_4-1; end if; end if;End if;End if;End process;End rtl; 图13 count6(六进制)仿真图MUX6程序(六选一选通器):library ieee;use ieee.std_logic_1164.all;entity mux6 isport(INTPUT1:in std_logic_vector(3 downto 0); INTPUT2:in std_logic_vector(3 downto 0); INTPUT3:in std_logic_vector(3 downto 0); INTPUT4:in std_logic_vector(3 downto 0); INTPUT5:in std_logic_vector(3 downto 0); INTPUT6:in std_logic_vector(3 downto 0); a,b,c:in std_logic; y:out std_logic_vector(3 downto 0);end mux6;architecture rt1 of mux6 issignal sel:std_logic_vector(2 downto 0);beginsel=c&b&a;process(sel)beginif(sel=000)then y=INTPUT1;elsif(sel=001)theny=INTPUT2;elsif(sel=010)theny=INTPUT3;elsif(sel=011)theny=INTPUT4;elsif(sel=100)theny=INTPUT5;elsey=INTPUT6;end if;end process;end rt1;CNT6程序(扫描显示):Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_unsigned.all;Entity cnt6 isPort(clk,clr:in std_logic; qa,qb,qc:out std_logic); End cnt6;Archite
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年广东南华工商职业学院单招职业技能考试题库及答案解析(名师系列)
- 2026年浙江工商职业技术学院单招职业适应性测试题库带答案解析
- 2026年云南国土资源职业学院单招职业倾向性测试题库及答案解析(名师系列)
- 2026年太原旅游职业学院单招职业技能测试必刷测试卷带答案解析
- 2026年山东职业学院单招职业倾向性考试必刷测试卷及答案解析(夺冠系列)
- 房屋拆迁还原协议书
- 房屋提前置换协议书
- 房屋权利让渡协议书
- 房屋界限划分协议书
- 房屋竣工移交协议书
- 园区安全管理培训
- 2025年江西江铜华东铜箔有限公司招聘笔试参考题库含答案解析
- 2024年人教版四年级数学上册 第5单元《平行四边形和梯形》能力提升卷(含解析)
- 安踏集团零售管理培训手册
- 薄膜物理与技术-5薄膜的形成与生长
- 民居建筑-福建土楼课件
- 公司无贷户营销(兰云)
- 小学数学骨干教师专题讲座《如何有效培养小学生的数学阅读能力》
- DL∕T 2601-2023 火力发电厂尿素水解制氨系统调试导则
- DL∕T 1650-2016 小水电站并网运行规范
- 提高护理文书书写规范率PDCA
评论
0/150
提交评论