EDA数字秒表的设计程序_第1页
EDA数字秒表的设计程序_第2页
EDA数字秒表的设计程序_第3页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、EDA数字秒表的设计程序     程序说明:1。此程序包括分频,计数控制,显示控制部分。2。开机显示00。00。00,用户课随时计时,暂停,清零,最大计时可到59 分59。99秒。3。技术时钟为100HZ4。采用时分复用的方法控制4个数码管的显示,可节省资源。程序如下:Library ieee;Use ieee.std_logic_1164.all;Use ieee.std_logic_arith.all; Use ieee.std_logic_unsigned.all;Entity watch isPort(sel: out std_logi

2、c_vector(6 downto 1) ;seg:out std_logic_vector(7 downto 0);Beginstop:in std_logic;Reset:in std_logic;Cp2:in std_logic);End watch;Architecture behave of watch isSignal num1: std_logic_vector(3 downto 0);Signal num2: std_logic_vector(3 downto 0);Signal num3: std_logic_vector(3 downto 0);Signal num4: s

3、td_logic_vector(3 downto 0);Signal num5: std_logic_vector(3 downto 0);Signal num6: std_logic_vector(3 downto 0);Signal num: std_logic_vector(3 downto 0);Signal numlet: std_logic_vector(2 downto 0);Signal count: std_logic_vector(17 downto 1);Signal selsig: std_logic_vector(6 downto 1);Signal segsig:

4、std_logic_vector(7 downto 0 );Signal cp1: std_logic;Signal cp3: std_logic;BeginProcess(cp2) - 分频。Begin If (cp2' event and cp2='1') then if (Count="1100011010011111")thencount<="00000000000000000" cp1<=not cp1;else count<=count 1;end if;end if;cp3<=count(10

5、);end process;process(cp1)begin if reset ='1' then num1(3 downto 0) <="0000"num2(3 downto 0) <="0000"num3(3 downto 0) <="0000"num4(3 downto 0) <="0000"num5(3 downto 0) <="0000"num6(3 downto 0) <="0000"else if cp1&#

6、39; event and cp1='1' then if beginstop='1' then num1<=num1 1;if num1 (3 downto 0)="1001" then num1 (3 downto 0)<="0000" num2<= num2 1;if num2 (3 downto 0)="1001" then num2 (3 downto 0)<="0000" num3<= num3 1;if num3 (3 downto 0)=

7、"1001" then num3 (3 downto 0)<="0000" num4<= num4 1;if num4 (3 downto 0)="0101" then num4 (3 downto 0)<="0000" num5<= num5 1;if num5 (3 downto 0)="1001" then num5 (3 downto 0)<="0000" num6<= num6 1;if num6 (3 downto 0)=&qu

8、ot;0101" then num6(3 downto 0)<="0000"end if; end if; end if; end if; end if; end if; end if;end if; end if;end process;process (cp3) begin if (cp3' event and cp3='1')then if(numlet(2 downto 0)="000") thennum<=num1;selsig(6 downto 1)<="111110"

9、end if;if(numlet(2 downto 0)="001") thennum<=num2;selsig(6 downto 1)<="111101" end if;if(numlet(2 downto 0)="010") thennum<=num3;selsig(6 downto 1)<="111011" end if;if(numlet(2 downto 0)="011") thennum<=num4;selsig(6 downto 1)<=&quo

10、t;110111" end if;if(numlet(2 downto 0)="100") thennum<=num5;selsig(6 downto 1)<="101111" end if;numlet(2 downto 0)<=numlet(2 downto 0) 1;if(numlet(2 downto 0)="101") thennumlet(2 downto 0)<="011111" end if;end if;if (num (3 downto 0)="000

11、0")then segsig(7 downto 0)<="01111111" end if;if (num (3 downto 0)="0001")then segsig(7 downto 0)<="00001101" end if;if (num (3 downto 0)="0010")then segsig(7 downto 0)<="10110111" end if;if (num (3 downto 0)="0011")then segsi

12、g(7 downto 0)<="10011111" end if;if (num (3 downto 0)="0100")then segsig(7 downto 0)<="11001101" end if;if (num (3 downto 0)="0101")then segsig(7 downto 0)<="11011011" end if;if (num (3 downto 0)="0110")then segsig(7 downto 0)<="11111011" end if;if (num (3 downto 0)="0111")then segsig(7 downto 0)<="00001111" end if;if (num (3 downto 0)="1000")then segsig(7 downto 0)<="11111111" end if;if (num (3 downto 0)="1001")then segsig(7 downto 0)<="1101111

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论