实验五正弦信号发生器设计原理 信号发生器正弦波(5篇)
文件格式:DOCX
时间:2023-03-21 00:00:00    小编:热心网友小茜吖

实验五正弦信号发生器设计原理 信号发生器正弦波(5篇)

小编:热心网友小茜吖

无论是身处学校还是步入社会,大家都尝试过写作吧,借助写作也可以提高我们的语言组织能力。那么我们该如何写一篇较为完美的范文呢?这里我整理了一些优秀的范文,希望对大家有所帮助,下面我们就来了解一下吧。

实验五正弦信号发生器设计原理 信号发生器正弦波篇一

一、实验目的1.进一步熟悉quatus软件的使用方法;

2.掌握逻辑分析仪的使用方法;

3.掌握lpm-rom的使用方法;

二、实验内容

定制lpm-rom模块,并利用其设计一个简易的正弦信号发生器,该信号发生器由以下三部分组成:

(1)计数器或地址信号发生器;

(2)正弦信号数据存储器rom(6位地址线,8位数据线),含有128个8位波形数据(一个正弦波形周期)。

(3)vhdl顶层程序设计

注意:本实验中未给正弦信号波形接d/a转换器,因而采用逻辑分析仪进行观察,具体观察方法见教材208页。

本实验中待测信号为ar和q。时钟选择clk;时能信号为en,高电平触发。

三、实验记录

语言程序

2.仿真波形

3.逻辑分析仪观察结果。

四、问题讨论

1.总结宏功能模块的应用环境,可实现哪些设计?

2.设计一个方波生成器。

实验五正弦信号发生器设计原理 信号发生器正弦波篇二

vhdl实验四:函数信号发生器设计

设计要求:设计一个函数信号发生器,能产生方波,三角波,正弦波,阶梯波。设计概述:信号的输出实质上是指电压幅度随时间的变化。根据这个原理我们就可以设计函数信号发生器了。fpga里面产生的数据只能是数字信号,最终我们通过连接8bit的da转换器就能将数字信号转换成电压信号,从而实现了信号发生器的功能。

本设计有5个模块组成,其中有:方波发生器,三角波发生器,正弦波发生器,阶梯波发生器,4选1选择器。下面是我设计的整个过程: 方波发生器:实质上是一段时间输出0,一段时间输出255的数字信号,当然这有8位的通道输出。

程序设计如下:--工程名:方波发生器

--功能:产生方波,是通过交替送出全0和全1实现的,每32个时钟翻转一次--时间:2010-12-17 library ieee;use ;use ;use ;entity sqaure is port(clk,clr:in std_logic;

q:out integer range 0 to 255;end entity;architecture behav of sqaure is signal a:bit;begin process(clk,clr--计数分频 variable cnt:integer range 0 to 32;begin if(clr='0' then a<='0';elsif clk'event and clk='1' then if cnt<31 then--进行32分频 cnt:=cnt+1;else cnt:=0;a<=not a;end if;end if;

end process;process(clk,a--信号输出 begin if clk'event and clk='1' then if a='1' then q<=255;else q<=0;end if;end if;end process;end behav;三角波发生器:实质上是先输出直线递增的数字信号,随后按照同样的斜率输出递减的数字信号。这样就能实现三角波的发生了。

程序设计如下:--工程名:三角波信号发生器

--功能:产生的三角波以64个时钟为一个周期,输出q每次加减8。--时间:2010-12-17 library ieee;

use ;use ;use ;entity delta1 is port(clk:in std_logic;--时钟信号 rst:in std_logic;--复位信号

q:out std_logic_vector(7 downto 0;--输出信号 end entity;architecture behav of delta1 is begin variable tmp:std_logic_vector(7 downto 0;variable a:std_logic;begin if(rst='0' then tmp:=“00000000”;elsif clk'event and clk='1' then if(a='0' then if(tmp=“11111000” then--tmp=248 tmp:=“11111111”;

a:='1';--信号计数完成,下一次改成递减 else tmp:=tmp+8;--递增 end if;else if tmp=“00000111” then--tmp=7 tmp:=“00000000”;a:='0';--信号计数完成,下一次改成递增 else tmp:=tmp-8;--递减 end if;end if;end if;q<=tmp;--信号输出 end process;end behav;正弦波发生器:这里我设计了64个状态,就是将一个周期的正弦波分成64分,在然后一份份的数字信号输出就可以了。具体怎么取值,用excel计算就可以了。自己手动计算也可以的哦。

具体程序设计如下: library ieee;use ;use ;use ;entity sin1 is port(clk,clr:in std_logic;d:out integer range 0 to 255;end entity;architecture behav of sin1 is begin variable tmp:integer range 0 to 63;begin if clr='0' then d<=0;elsif clk'event and clk='1' then if tmp=63 then tmp:=0;else

tmp:=tmp+1;end if;case tmp is when 00=>d<=255;when 01=>d<=254;when 02=>d<=252;when 03=>d<=249;when 04=>d<=245;when 05=>d<=239;when 06=>d<=233;when 07=>d<=225;when 08=>d<=217;when 09=>d<=207;when 10=>d<=197;when 11=>d<=186;when 12=>d<=174;when 13=>d<=162;when 14=>d<=150;when 15=>d<=137;when 16=>d<=124;when 17=>d<=112;when 18=>d<=99;when 19=>d<=87;when 20=>d<=75;when 21=>d<=64;when 22=>d<=53;when 23=>d<=43;when 24=>d<=34;when 25=>d<=26;when 26=>d<=19;when 27=>d<=13;when 28=>d<=8;when 29=>d<=4;when 30=>d<=1;when 31=>d<=0;when 32=>d<=0;when 33=>d<=1;when 34=>d<=4;when 35=>d<=8;when 36=>d<=13;when 37=>d<=19;when 38=>d<=26;when 39=>d<=34;when 40=>d<=43;when 41=>d<=53;when 42=>d<=64;when 43=>d<=75;when 44=>d<=87;when 45=>d<=99;when 46=>d<=112;when 47=>d<=124;

when 48=>d<=137;when 49=>d<=150;when 50=>d<=162;when 51=>d<=174;when 52=>d<=186;when 53=>d<=197;when 54=>d<=207;when 55=>d<=217;when 56=>d<=225;when 57=>d<=233;when 58=>d<=239;when 59=>d<=245;when 60=>d<=249;when 61=>d<=252;when 62=>d<=252;when 63=>d<=255;when others=>null;end case;end if;end process;end behav;阶梯波发生器:实质上是一个直线递增的数字信号输出而已,和三角波发生没有什么差别。

--工程名:阶梯波信号发生器

--功能:改变该模块递增的常数,可以改变阶梯的个数--时间:2010-12-17 library ieee;use ;use ;

use ;entity ladder1 is port(clk:in std_logic;--时钟信号 rst:in std_logic;--复位信号

q:out std_logic_vector(7 downto 0;--输出信号 end entity;architecture behav of ladder1 is begin process(clk,rst variable tmp:std_logic_vector(7 downto 0;variable a:std_logic;begin if(rst='0' then--复位 tmp:=“00000000”;elsif clk'event and clk='1' then if a='0' then if tmp=“11111111” then tmp:=“00000000”;a:='1';

else tmp:=tmp+16;--以常数递增 a:='1';end if;else a:='0';end if;end if;q<=tmp;--信号输出 end process;end behav;4选1模块

最后我们要将模块进行整合,就需要设计一个选通模块,进行选择。

具体程序设计如下:--工程名:4 选 1 模块选择器--功能:选通模块作用--时间:2010-12-17 library ieee;use ;use ;use ;entity select4_1 is port(sel:in std_logic_vector(1 downto 0;--选择信号 d0,d1,d2,d3:in std_logic_vector(7 downto 0;--4 个信号发生器通道 q:out std_logic_vector(7 downto 0;--输出通道 end entity;architecture behav of select4_1 is begin process(sel begin case sel is--选择 when“00”=> q<=d0;when“01”=> q<=d1;when“10”=> q<=d2;when“11”=> q<=d3;end case;end process;end behav;最后将所有模块就连接起来进行图形化设计; 进行仿真。最后进行硬件调试,通过 da 将 8

位的数字信号转化成电压信号就能完成了整个 系统的设计了。总结:通过设计这个简单的数字信号发生器,我彻底的了解了如何设计一个函数 发生器。一直以来都想设计这个一个东西,所以今天终于完成了我一直以来的心 愿了。但是这仅仅是开始,要设计一个很好信号发生器,需要使用 dds 的技术,因此希望我以后更加再接再厉,慢慢稳健的成长起来。

实验五正弦信号发生器设计原理 信号发生器正弦波篇三

顶层文件 library ieee;use ;use ;entity dds is

port(k:in std_logic_vector(9 downto 0);

en:in std_logic;

reset:in std_logic;

clk:in std_logic;

q:out std_logic_vector(8 downto 0));end entity dds;architecture behave of dds is

component sum99 is

port(k:in std_logic_vector(9 downto 0);

en:in std_logic;

reset:in std_logic;

clk:in std_logic;

out1:out std_logic_vector(9 downto 0));

end component sum99;

component reg1 is

port(d:in std_logic_vector(9 downto 0);

clk:in std_logic;

q:out std_logic_vector(9 downto 0));

end component reg1;

component rom is

port(clk:in std_logic;

addr:in std_logic_vector(9 downto 0);

outp:out std_logic_vector(8 downto 0));

end component rom;

component reg2 is

port(d:in std_logic_vector(8 downto 0);

clk:in std_logic;

q:out std_logic_vector(8 downto 0));

end component reg2;

signal s1:std_logic_vector(9 downto 0);

signal s2:std_logic_vector(9 downto 0);

signal s3:std_logic_vector(8 downto 0);

begin

u0:sum99

port map(k=>k,en=>en,reset=>reset,clk=>clk,out1=>s1);

u1:reg1 port map(d=>s1,clk=>clk,q=>s1);

u2:rom port map(addr=>s2,clk=>clk,outp=>s3);

u3:reg2 port map(d=>s3,clk=>clk,q=>q);end architecture behave;

正弦查找表 library ieee;use ;use ;use ;entity rom is port(addr:in std_logic_vector(6 downto 0);clk:in std_logic;outp:out signed(7 downto 0));end entity rom;architecture art of rom is begin process(clk)is begin if(clk'event and clk='1')then case addr is when “0000000”=>outp<=“00000000”;when “0000001”=>outp<=“00000010”;when “0000010”=>outp<=“00000011”;when “0000011”=>outp<=“00000101”;when “0000100”=>outp<=“00000110”;

when “0000101”=>outp<=“00001000”;when “0000110”=>outp<=“00001001”;when “0000111”=>outp<=“00001011”;when “0001000”=>outp<=”00001101“;when ”0001001“=>outp<=”00001110“;when ”0001010“=>outp<=”00010000“;when ”0001011“=>outp<=”00010001“;when ”0001100“=>outp<=”00010011“;when ”0001101“=>outp<=”00010100“;when ”0001110“=>outp<=”00010110“;when ”0001111“=>outp<=”00010111“;when ”0010000“=>outp<=”00011001“;when ”0010001“=>outp<=”00011011“;

when ”0010010“=>outp<=”00011100“;when ”0010011“=>outp<=”00011110“;when ”0010100“=>outp<=”00011111“;when ”0010101“=>outp<=”00100001“;when ”0010110“=>outp<=”00100010“;when ”0010111“=>outp<=”00100100“;when ”0011000“=>outp<=”00100101“;when ”0011001“=>outp<=”00100111“;

when ”0011010“=>outp<=”00101001“;when ”0011011“=>outp<=”00101010“;when ”0011100“=>outp<=”00101100“;when ”0011101“=>outp<=”00101101“;when ”0011110“=>outp<=”00101111“;when ”0011111“=>outp<=”00110000“;when ”0100000“=>outp<=”00110010“;when ”0100001“=>outp<=”00110011“;when ”0100010“=>outp<=”00110101“;when ”0100011“=>outp<=”00110110“;when ”0100100“=>outp<=”00111000“;when ”0100101“=>outp<=”00111001“;when ”0100110“=>outp<=”00111011“;when ”0100111“=>outp<=”00111100“;when ”0101000“=>outp<=”00111110“;when ”0101001“=>outp<=”00111111“;when ”0101010“=>outp<=”01000001“;when ”0101011“=>outp<=”01000011“;when ”0101100“=>outp<=”01000100“;when ”0101101“=>outp<=”01000110“;when ”0101110“=>outp<=”01000111“;when ”0101111“=>outp<=”01001001“;

when ”0110000“=>outp<=”01001010“;when ”0110001“=>outp<=”01001100“;when ”0110010“=>outp<=”01001101“;when ”0110011“=>outp<=”01001111“;when ”0110100“=>outp<=”01010000“;when ”0110101“=>outp<=”01010001“;when ”0110110“=>outp<=”01010011“;when ”0110111“=>outp<=”01010100“;when ”0111000“=>outp<=”01010110“;when ”0111001“=>outp<=”01010111“;when ”0111010“=>outp<=”01011001“;when ”0111011“=>outp<=”01011010“;when ”0111100“=>outp<=”01011100“;when ”0111101“=>outp<=”01011101“;when ”0111110“=>outp<=”01011111“;when ”0111111“=>outp<=”01100000“;when ”1000000“=>outp<=”01100010“;when ”1000001“=>outp<=”01100011“;when ”1000010“=>outp<=”01100100“;when ”1000011“=>outp<=”01100110“;when ”1000100“=>outp<=”01100111“;when ”1000101“=>outp<=”01101001“;

when ”1000110“=>outp<=”01101010“;when ”1000111“=>outp<=”01101100“;when ”1001000“=>outp<=”01101101“;when ”1001001“=>outp<=”01101110“;when ”1001010“=>outp<=”01110000“;when ”1001011“=>outp<=”01110001“;when ”1001100“=>outp<=”01110011“;when ”1001101“=>outp<=”01110100“;when ”1001110“=>outp<=”01110101“;when ”1001111“=>outp<=”01110111“;when ”1010000“=>outp<=”01111000“;when ”1010001“=>outp<=”01111010“;when ”1010010“=>outp<=”01111011“;when ”1010011“=>outp<=”01111100“;when ”1010100“=>outp<=”01111110“;when ”1010101“=>outp<=”01111111“;when ”1010110“=>outp<=”10000000”;when “1010111”=>outp<=“10000010”;when “1011000”=>outp<=“10000011”;when “1011001”=>outp<=“10000100”;when “1011010”=>outp<=“10000110”;when “1011011”=>outp<=“10000111”;

when “1011100”=>outp<=“10001000”;when “1011101”=>outp<=“10001010”;when “1011110”=>outp<=“10001011”;when “1011111”=>outp<=“10001100”;when “1100000”=>outp<=“10001110”;when “1100001”=>outp<=“10001111”;when “1100010”=>outp<=“10010000”;when “1100011”=>outp<=“10010010”;when “1100100”=>outp<=“10010011”;when “1100101”=>outp<=“10010100”;when “00001100110”=>outp<=“10010101”;when “1100111”=>outp<=“10010111”;when “1101000”=>outp<=“10011000”;when “1101001”=>outp<=“10011001”;when “1101010”=>outp<=“10011010”;when “1101011”=>outp<=“10011100”;when “1101100”=>outp<=“10011101”;when “1101101”=>outp<=“10011110”;when “1101110”=>outp<=“10011111”;when “1101111”=>outp<=“10100001”;when “1110000”=>outp<=“10100010” when “1110001”=>outp<=“10100011”;

when “1110010”=>outp<=“10100100”;when “1110011”=>outp<=“10100101”;when “1110100”=>outp<=“10100111”;when “1110101”=>outp<=“10101000”;when “1110110”=>outp<=“10101001”;when “1110111”=>outp<=“10101010”;when “1111000”=>outp<=“10101011”;when “1111001”=>outp<=“10101100”;when “1111010”=>outp<=“10101110”;when “1111011”=>outp<=“10101111”;when “1111100”=>outp<=“10110000”;when “1111101”=>outp<=“10110001”;when “1111110”=>outp<=“10110010”;when “1111111”=>outp<=“10110011”;when others=>outp<=“ 00000000”;

end case;

end if;end process;end architecture art;

dac 0832的vhdl程序 library ieee;use ;use ;use ;entity dac0832 is port(clk:in std_logic;

rst:in std_logic;

ile:out std_logic;

cont:out std_logic;data_out:out std_logic_vector(7 downto 0));end entity;architecture behave of dac0832 is signal q:integer range 0 to 63;signal data:std_logic_vector(7 downto 0);begin

process(clk)

begin

if rst='1'then q<=0;elsif clk'event and clk='1'then

if data=“11111111”then data<=“00000000”;

else data<=data+1;

end if;

else q<=q+1;

end if;

end process;ile<='1';cont<='0';data_out<=data;end architecture behave;

频率控制字 library ieee;use ;use ;entity reg0 is

port(clk:in std_logic;

lock:in std_logic;

q:out std_logic_vector(9 downto 0));end entity reg0;architecture art of reg0 is begin

process(clk)

begin

if(clk'event and clk='1')then

if lock='1'then

q<=“0000011111”;

end if;

end if;

end process;end architecture art;

相位寄存器 library ieee;use ;entity reg1 is

port(d:in std_logic_vector(9 downto 0);

clk:in std_logic;

q:out std_logic_vector(9 downto 0));end entity reg1;architecture behave of reg1 is begin

process(clk)is

begin

if(clk'event and clk='1')then

q<=d;

end if;

end process;end architecture behave;

输出数据寄存器 library ieee;use ;entity reg2 is port(d:in std_logic_vector(8 downto 0);

clk:in std_logic;

q:out std_logic_vector(8 downto 0));end entity reg2;architecture behave of reg2 is begin

process(clk)is

begin

if(clk'event and clk='1')then

q<=d;

end if;

end process;end architecture behave;

相位累加器 library ieee;use ;use ;entity sum99 is

port(k:in std_logic_vector(9 downto 0);

clk:in std_logic;

en:in std_logic;

reset:in std_logic:

out1:out std_logic_vector(9 downto 0));end entity sum99;architecture behave of sum99 is

signal temp:std_logic_vector(9 downto 0);begin

process(clk,en,reset)is

begin

if reset='1'then

temp<=“0000000000”;

else

if clk'event and clk='1'then

if en='1'then

temp<=temp+k;

end if;

end if;

end if;

out1<=temp;

end process;end architecture behave;

图1.顶层电路原理图

波形仿真图

波形仿真图

图4.相位寄存器reg1仿真波形图

图5.寄存器reg2的波形仿真

图6.相位累加器仿真波形图

图7.优化过程及对比波形(a——h)

图a

图b

图c

图d

图e 23

图f

图g

图h

实验五正弦信号发生器设计原理 信号发生器正弦波篇四

模拟课程设计题

信号发生器设计

设计一个能够输出正弦波、三角波和矩形波的信号源电路,电路形式自行选择。输出信号的频率可通过开关进行设定,具体要求如下:

(1)输出信号的频率范围为100~800hz,步进为100hz。(60分)

(2)要求输出信号无明显失真,特别是正弦波信号。(30分)

评分标准:

(1)范围满足设计要求得满分,否则酌情扣分。

(2)输出信号无明显失真可满分,有明显失真酌情扣分。

发挥部分(附加10分):

进一步扩大输出信号范围和减小步进频率。

实验五正弦信号发生器设计原理 信号发生器正弦波篇五

实验五正弦信号发生器设计

一、实验目的1.熟悉利用quartusii及其lpm_rom与fpga硬件资源的使用方法;

2.掌握lpm模块的重要功能;

3.熟悉megawizard plug-in manager的使用方法。

二、实验设备

计算机,quartusii 6.0 版软件,jtag下载线,eda实验挂箱(ep1c6q240c8)。

三、实验原理

设计一8位宽、1024点的正弦信号发生器。

正弦信号发生器的结构由四个部分组成:

1.计数器或地址发生器(10位地址线);

2.正弦信号数据rom(存放正弦波的采样数据,采样频率20mhz:8位数据线、10位地址线);

顶层设计;

4.d/a转换器(8位)。

四、实验步骤和内容

1.在quartusii上利用megawizard plug-in manager功能,调用lpm_rom函数定制8位宽、1024点rom,并进行初始化。然后对设计实体进行编辑、编译、综合、适配、仿真。

2.利用quartusii文本编辑器设计10位二进制计数器,做为地址发生器,对设计实体进行编辑、编译、综合、适配、仿真。

3.利用层次化设计方法设计一8位宽、1024点的正弦信号发生器。

4.d/a转换器采用试验箱配备的dac0832。

5.引脚锁定和硬件下载测试。引脚锁定后进行编译、下载和硬件测试实验。将实验过程和实验结果写进实验报告。

6.使用signaltap ii对设计的正弦信号发生器进行实测。采样时钟使用系统时钟20mhz。

7.使用在系统存储器数据读写编辑器对设计的正弦信号发生器进行实测,观测结果;

8.实验报告。将实验原理、设计过程、编译仿真波形和分析结果、硬件测试实验结果写进实验报告。

五、思考题

如何实现对输出正弦信号的频率和相位可调?

猜你喜欢 网友关注 本周热点
精选文章
基于你的浏览为你整理资料合集
实验五正弦信号发生器设计原理 信号发生器正弦波(5篇) 文件夹
复制