跪求VHDL的二位10进制频率计程序..最好有quarters9.1的原理图吧.我没什么分了,不过真的是急用,谢谢大家了
1个回答
展开全部
二位10进制频率计是不是就是一个计数器可以从0计数到99啊。如果是的话,那下面的代码Maybe可以满足你的要求:
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
Entity counter99 is
port ( clk,clr:in std_logic;
bcd1n :out std_logic_vector(3 downto 0);
bcd10n :out std_logic_vector(3 downto 0);
co :out std_logic:='0'
);
END counter99;
Architecture behave of counter99 is
Signal bcd1ns,bcd10ns:std_logic_vector(3 downto 0);
begin
bcd1n <= bcd1ns;
bcd10n <= bcd10ns;
Process(clk,clr)
Begin
if(clr='1')then
bcd1ns<="0000";
bcd10ns<="0000";
elsif(clk'EVENT and clk='1')then
if(bcd10ns="1001" and bcd1ns="1001")then
co<='1';
bcd1ns<="0000";
bcd10ns<="0000";
else
co<='0';
if(bcd1ns="1001")then
bcd10ns<=bcd10ns+1;
bcd1ns<="0000";
else
bcd1ns<=bcd1ns+1;
end if;
end if;
end if;
end process;
End behave;
Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
Entity counter99 is
port ( clk,clr:in std_logic;
bcd1n :out std_logic_vector(3 downto 0);
bcd10n :out std_logic_vector(3 downto 0);
co :out std_logic:='0'
);
END counter99;
Architecture behave of counter99 is
Signal bcd1ns,bcd10ns:std_logic_vector(3 downto 0);
begin
bcd1n <= bcd1ns;
bcd10n <= bcd10ns;
Process(clk,clr)
Begin
if(clr='1')then
bcd1ns<="0000";
bcd10ns<="0000";
elsif(clk'EVENT and clk='1')then
if(bcd10ns="1001" and bcd1ns="1001")then
co<='1';
bcd1ns<="0000";
bcd10ns<="0000";
else
co<='0';
if(bcd1ns="1001")then
bcd10ns<=bcd10ns+1;
bcd1ns<="0000";
else
bcd1ns<=bcd1ns+1;
end if;
end if;
end if;
end process;
End behave;
追问
不是计数器啊,频率计是用于测量被测信号的频率的。。。
追答
那你看看这个吧,应该是你要找的。
http://wenku.baidu.com/view/81d948c4bb4cf7ec4afed0ee.html
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询