library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
use ieee.std_logic_signed.all;
use ieee.numeric_std.all;
entity kecelikalem is
port( clk: in STD_LOGIC;
reset : in STD_LOGIC;
din:out std_logic;
ldac:out std_logic:='1';
cs :out std_logic:='1';
sclk :out std_logic:='1');
end kecelikalem;
architecture Behavioral of kecelikalem is
signal a:integer range 0 to 3:=0;
signal i : integer range 0 to 18:=0;
type veri is array (2 downto 0) of std_logic_vector(15 downto 0);
signal sine :veri:=("1100000000100000","0000000000001111","1100000000000000");
--signal sine :std_logic_vector(15 downto 0):="1100000000000011";
signal data :std_logic_vector(15 downto 0);
signal temporal: STD_LOGIC;
signal counter : integer range 0 to 124999 := 0;
begin
frequency_divider: process (reset, clk) begin
if (reset = '1') then
temporal <= '0';
counter <= 0;
elsif rising_edge(clk) then
if (counter = 124999) then
temporal <= NOT(temporal);
counter <= 0;
else
counter <= counter + 1;
end if;
end if;
end process;
sclk <= temporal;
process (temporal)
begin
if falling_edge(temporal) then
if(a=3) then
a<=0;
else
data<=sine(a);
if (i=18) then
a<=a+1;
ldac<='1';
i<=0;
else
if (i=17) then
ldac <='0';
else
if (i=16) then
cs<='1';
ldac <='1';
else
cs<='0';
din<=data(i);
--din<=sine(i);
ldac <='1';
end if ;
end if;
end if ;
i<=i+1;
end if;
end if;
end process;
end Behavioral;
Question
guneryunus
i want to generate sine wave on dac (pmodda3)(http://www.analog.com/media/en/technical-documentation/data-sheets/AD5541A.pdf)and i am using spartan3e but there ara several warnings ,How can i fix the warnings? i loaded code and picture. help me please
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
use ieee.std_logic_signed.all;
use ieee.numeric_std.all;
entity kecelikalem is
port( clk: in STD_LOGIC;
reset : in STD_LOGIC;
din:out std_logic;
ldac:out std_logic:='1';
cs :out std_logic:='1';
sclk :out std_logic:='1');
end kecelikalem;
architecture Behavioral of kecelikalem is
signal a:integer range 0 to 3:=0;
signal i : integer range 0 to 18:=0;
type veri is array (2 downto 0) of std_logic_vector(15 downto 0);
signal sine :veri:=("1100000000100000","0000000000001111","1100000000000000");
--signal sine :std_logic_vector(15 downto 0):="1100000000000011";
signal data :std_logic_vector(15 downto 0);
signal temporal: STD_LOGIC;
signal counter : integer range 0 to 124999 := 0;
begin
frequency_divider: process (reset, clk) begin
if (reset = '1') then
temporal <= '0';
counter <= 0;
elsif rising_edge(clk) then
if (counter = 124999) then
temporal <= NOT(temporal);
counter <= 0;
else
counter <= counter + 1;
end if;
end if;
end process;
sclk <= temporal;
process (temporal)
begin
if falling_edge(temporal) then
if(a=3) then
a<=0;
else
data<=sine(a);
if (i=18) then
a<=a+1;
ldac<='1';
i<=0;
else
if (i=17) then
ldac <='0';
else
if (i=16) then
cs<='1';
ldac <='1';
else
cs<='0';
din<=data(i);
--din<=sine(i);
ldac <='1';
end if ;
end if;
end if ;
i<=i+1;
end if;
end if;
end process;
end Behavioral;
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.