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

📄 qita.vhd

📁 本源码设计了自动电子琴
💻 VHD
字号:
if count11=16383 then
        count11:=tone1;
        fullspks<='1';  
      else count11:=count11+1;fullspks<='0'; 
      end if; 



case index is  
when "11111110" => tone0<=4917;code<="1001111";high<='0';
when "11111101" => tone0<=6168;code<="0010010";high<='0';
when "11111011" => tone0<=7283;code<="0000110";high<='0';
when "11110111" => tone0<=7794;code<="1001100";high<='0';

when "11101111" => tone0<=8731;code<="0100100"; high<='0';
when "11011111" => tone0<=9566;code<="0100000";high<='0';
when "10111111" => tone0<=10310;code<="0001111";high<='0';
when "01111111" => tone0<=10651;code<="0000000"; high<='1';
 
when   others   => tone0<=16383;code<="0000001";high<='0';
--pulse0:process(clk,Auto)          
    --variable count:integer range 0 to 8000000; 
--begin 
--if Auto='1' then count:=0;clk2<='0';
--   elsif clk'event and clk='1' then  
 --    count:=count+1; 
 --       if count=4000000 then clk2<='1';               
--       elsif count=8000000 then clk2<='0';count:=0; 
--       end if;  
 --       end if; 
--end process; 
--pulse1:process(clk1)                               
                                       --此进程对系统时钟进行 4 分频 
--variable count:integer range 0 to 8; 
--begin 
     --if clk1'event and clk1='1' then count:=count+1; 
    --  if count=2 then preclk<='1';  --8MHZ 信号 
    --  elsif count=4 then preclk<='0';count:=0; 
    --  end if;  
   --end if; 
--end process pulse1; 
--此进程按照 tone1 输入的 
--分频系数 28KHz 的脉冲再次分频,得到所需要的音符频率 
--低频程序段
--when "11111110" => tone0<=30;code<="1001111";high<='1';--约 10.349khz 
--when "11111101" => tone0<=35;code<="0010010";high<='1';--8.772 
--when "11111011" => tone0<=42;code<="0000110";high<='1';--7.722 
--when "11110111" => tone0<=49;code<="1001100";high<='1';--7.168 
--when "11101111" => tone0<=52;code<="0100100";high<='1';--6.683 
--when "11011111" => tone0<=58;code<="0100000";high<='0';--6.202 
--when "10111111" => tone0<=68;code<="0001111";high<='0';--5.831 
--when "01111111" => tone0<=78;code<="0000000";high<='0';--5.674k 
--&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
--高频程序段 

⌨️ 快捷键说明

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