⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ringup.vhd

📁 关于自动打铃器的程序设计。应该还是不错的哦!~
💻 VHD
字号:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity ringup is
  port( reset:      in    std_logic;
        alarm:      out   std_logic;
        hourhdis:   in    integer range 0 to 2;
        hourldis:   in    integer range 0 to 9;
        minhdis:    in    integer range 0 to 5;
        minldis:    in    integer range 0 to 9;
        sechdis:    in    integer range 0 to 5;
        secldis:    in    integer range 0 to 9);
end ringup;

architecture ruarchi of ringup is             --这块部分能够改进,增加功能。
   constant rt:     integer:=5;
   constant stop:   integer:=2;
  begin
    process(secldis)
     variable cnt: integer;
      begin
        cnt:=sechdis*10+secldis;
       if reset='1' then
          alarm<='0';
        elsif (hourhdis=0 and hourldis=6 and minhdis=0 and minldis=0 and sechdis<2) or
              (hourhdis=1 and hourldis=0 and minhdis=3 and minldis=0 and sechdis<2) then
                 if cnt<rt then                                    --第一次响铃
                     alarm<='1';
                  elsif cnt>=rt and cnt<rt+stop then
                         alarm<='0';
                   elsif cnt<2*rt+stop then                        --第二次响铃 
                          alarm<='1';
                	elsif cnt>=2*rt+stop	 then
  				       	 alarm<='0';

                	end if;
       end if;
     end process;
end ruarchi;
                   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -