色偷偷偷久久伊人大杳蕉,色爽交视频免费观看,欧美扒开腿做爽爽爽a片,欧美孕交alscan巨交xxx,日日碰狠狠躁久久躁蜜桃

電子工程網(wǎng)

標(biāo)題: 求助:程序不受按鍵控制 [打印本頁(yè)]

作者: zhangjin1986    時(shí)間: 2012-9-17 15:56
標(biāo)題: 求助:程序不受按鍵控制
各位大俠,我遍了個(gè)程序,達(dá)到的目標(biāo)是:第一部分將輸入的1KHz分頻為1Hz;第二部分是通過(guò)按鍵按一下,將輸入的1KHz變?yōu)?50Hz,再按下,變?yōu)?25Hz。
Library IEEE;
Use IEEE.Std_logic_1164.all;
Use IEEE.Std_logic_unsigned.all;
Entity yh is
  Port(xh: in std_logic;
      clk:out std_logic);
End yh;
Architecture fun of yh is
  Signal clk_1s: Std_logic;
Begin
  process(xh)
    variable count:Std_logic_vector(9 downto 0);
  Begin
      wait on xh until xh='1';
      count:=count+1;
      clk_1s<=count(9);
   end process;()
clk<=clk_1s;
end fun;(這是第一部分)

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
Entity fp is
   port( xh:in std_logic;
         ds:in std_logic;
         clk:in std_logic;
         sc:out std_logic);
End fp;
Architecture fenpin of fp is
  Signal data:std_logic_vector(2 downto 0);
  Signal cnt:integer range 0 to 2;
  Signal zhja:std_logic;
  begin
    zhja<=NOT((ds or clk));
    yi:process(xh)
      begin
        if(xh'event and xh='1') then
          data<=data+1;
        end if;
     end process;
   er:process(zhja)
     begin
       if(zhja='1') then
         if(cnt=2) then cnt<=0;
         else  cnt<=cnt+1;
         end if;
       end if;
     end process;
  san:process(cnt,data)
     begin
       case cnt is
       when 0=>sc<=data(1);
       when 1=>sc<=data(2);
       when others=>NULL;
       end case;
     end process;
end fenpin;(這是第二部分)
.gcf文件上傳至附件中。第一部分與第二部分中的xh是同一個(gè)輸入信號(hào)1KHz,第二部分中輸入clk就是第一部分中輸出clk,第二部分中ds就是按鍵(不按高電平,按下低電平)。程序運(yùn)行后,sc輸出125Hz,過(guò)一秒后變?yōu)?50Hz,再過(guò)一秒變?yōu)?25Hz.....就是說(shuō)不受按鍵的控制。這是為什么?請(qǐng)各位大俠指點(diǎn)。謝謝!

tu.bmp (733.55 KB)

tu.bmp

作者: asyou    時(shí)間: 2012-9-18 09:25
時(shí)鐘要取沿!
作者: ty1932    時(shí)間: 2012-9-29 21:05
頂一個(gè)




歡迎光臨 電子工程網(wǎng) (http://m.54549.cn/) Powered by Discuz! X3.4