




免费预览已结束,剩余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;archi
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 文化产业管理考试知识要点及答案
- 卫生管理考试影响因素试题及答案
- 藏医技能考试试题及答案
- 育婴师学习环境考题及答案
- 光电工程师证书考试临考注意事项试题及答案
- 激光技术工程师行业改革带来的机会试题及答案
- 发电厂运行试题及答案
- 2025甘肃省安全员考试题库
- 育婴师的职业压力及应对策略试题及答案
- 药剂实践反馈与改进试题及答案
- 废气治理设施运行管理规程制度
- 西安庆华民用爆破器材股份有限公司百色分公司增雨防雹火箭弹生产线建设项目环评报告
- 泥石流灾害综合治理工程可行性研究报告
- 智能建造施工技术应用实施方案
- 机械设计说明书-多功能自动跑步机机械部分设计
- 英语小故事(中英文对照)课件
- 《古罗马人的数字》课件
- 2022-2023学年上海市徐汇区世界外国语中学八年级(下)期中物理试卷
- 注塑工艺培训-课件
- 钓鱼中各种氨基酸诱食剂说明书及使用方法
- 会计事务所内控审计所需资料清单
评论
0/150
提交评论