fsk_decode.vhd
来自「使用DDS技术」· VHDL 代码 · 共 39 行
VHD
39 行
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
ENTITY fsk_decode IS --解调程序
PORT ( CLK : IN STD_LOGIC;
receive : in STD_LOGIC_VECTOR(7 DOWNTO 0) ;
s:out std_logic);
END;
architecture behave of fsk_decode is
signal q:std_logic_vector(7 downto 0):=(others=>'0');
signal m:STD_LOGIC_VECTOR(4 DOWNTO 0):="00000"; --过零检测的计数器
signal reg:STD_LOGIC_VECTOR(7 DOWNTO 0); --暂存接收到的dds信号
begin
process(clk)
begin
if clk 'event and clk='1' then
q<=q+1;reg<=receive;
end if;
end process;
process(q(7))
begin
if q(7) 'event and q(7)='0' then
if m<13 then s<='0'; --根据判断的次数,解调出信号
else s<='1';
end if;
end if;
end process;
process(clk)
begin
if clk 'event and clk='1' then
if q<"00000010" then m<="00000";
elsif reg>"01111000" and reg<"10001000" then m<=m+1;
--对接收到的信号,检测通过一定范围的次数
end if;
end if;
end process;
end behave;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?