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

x
x
查看: 5532|回復(fù): 2
打印 上一主題 下一主題

[提問] 求助:程序不受按鍵控制

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
發(fā)表于 2012-9-17 15:56:37 | 只看該作者 |只看大圖 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
關(guān)鍵詞: 按鍵 , 分頻
各位大俠,我遍了個(gè)程序,達(dá)到的目標(biāo)是:第一部分將輸入的1KHz分頻為1Hz;第二部分是通過按鍵按一下,將輸入的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,過一秒后變?yōu)?50Hz,再過一秒變?yōu)?25Hz.....就是說不受按鍵的控制。這是為什么?請(qǐng)各位大俠指點(diǎn)。謝謝!

tu.bmp (733.55 KB)

tu.bmp
沙發(fā)
發(fā)表于 2012-9-18 09:25:40 | 只看該作者
時(shí)鐘要取沿!
板凳
發(fā)表于 2012-9-29 21:05:51 | 只看該作者
頂一個(gè)

本版積分規(guī)則

關(guān)于我們  -  服務(wù)條款  -  使用指南  -  站點(diǎn)地圖  -  友情鏈接  -  聯(lián)系我們
電子工程網(wǎng) © 版權(quán)所有   京ICP備16069177號(hào) | 京公網(wǎng)安備11010502021702
快速回復(fù) 返回頂部 返回列表