|
先发个整体代码
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity sin is
Port ( CLK : in STD_LOGIC; ------50M开发板内部时钟
Q : out STD_LOGIC_VECTOR (7 downto 0));------8位正弦信号输出
end sin;
architecture Behavioral of sin is
component sin_generate ----------利用ISE中block memory IP核(ROM加入了64个数据)存放正弦信号数据
port (
clka: IN std_logic;
addra: IN std_logic_VECTOR(5 downto 0);
douta: OUT std_logic_VECTOR(7 downto 0));
end component;
signal q1:std_logic_VECTOR(5 downto 0);--------rom地址计数端
signal cnt:std_logic_vector(3 downto 0);-------分频计数子
signal clk5M:std_logic;------------------------实际使用时钟
begin
process(clk)------------------------分频进程
begin
if (clk'event and clk='1') then
if cnt=5 then clk5M<=not clk5M;
cnt<=(others=>'0');
else cnt<=cnt+1;
end if;
end if;
end process;
process(clk5M)-------------ROM地址产生进程
begin
if (clk5M'event and clk5M='1')
then q1 <= q1+1;
end if;
end process;
inst_sin_generate : sin_generate
port map (
clka => clk5M,
addra => q1,
douta => Q);
end Behavioral;
数模转换电路图ourdev_574399.doc(文件大小:46K) (原文件名:新建 Microsoft Word 文档.doc)
开发板输出端接数模转换模块,再到示波器。最终示波器上看到了正弦波形。但是问题是不管怎么改分频,在示波器上读出的频率总是5Khz。请问各位大牛这是怎么回事呀? |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|