数字电路课程设计——函数信号发生器
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
目录
第一部分:要求 (4)
1.1 技术要求 (4)
1.2 功能要求 (4)
1.3 本人任务 (4)
第二部分设计 (5)
2.1 软件电路方案设计 (5)
2.2 原理框图 (5)
第三部分单元模块设计,仿真结果及分析 (5)
3.1 分频器模块 (5)
3.2 频率选择 (6)
3.3 幅度选择 (7)
3.4 六种波形设计 (8)
3.5 输出模块 (19)
第四部分顶层模块 (21)
4.1 顶层模块设计 (21)
4.2 仿真结果及分析 (19)
第五部分硬件电路设计及安装图 (21)
5.1 连线图 (24)
5.2 输入、输出信号说明 (24)
5.3 设计中需要注意的问题 (25)
第六部分调试结果说明及分析 (26)
6.1 实体图 (26)
6.2 输出实物波形 (26)
6.3 设计中需要注意的问题 (32)
第七部分收获体会 (30)
1.1 技术要求
1).生成方波、三角波、正弦波;
2).可以进行简单的频率选择或相幅调节;
3).在完成前三种波形的情况下可以进行波形类别的扩展;
4).用VHDL语言设计符合上述功能要求的函数发生器,并用层次化设计方法设计该电路;
5).对各个模块的功能进行仿真,并掌握数字信号发生器电路的设计及其调试方法。
1.2 功能要求
实现基于FPGA的简易多功能信号发生器,产生稳定的方波、三角波、正弦波、锯齿波、阶梯波、梯形波输出,并用数码管输出相应数字,且频率、幅值可调。
具体要求如下:
通过拨动开关S3、S2、S1实现波形的选择:共六种,同时数码管显示“1”到“6”;
通过拨动开关A2、A1实现波形幅度的选择:共计四种;
通过拨动开关F2、F1实现波形频率的选择:共计四种;
下载并测试电路的功能,用示波器观察DAC0832输出波形。
1.3 本人任务
进行基于vhdl的软件设计,包括顶层模块设计,配合硬件进行硬件仿真和测试。
第三部分 单元模块设计,仿真结果及分析
3.1 分频器模块
实体框图
程序清单:
library ieee;
use ieee.std_logic_1164.all;
entity fana is
port(a:in integer RANGE 0 TO 312; --a 为频率输入的初始值
clk:in std_logic;
q:out std_logic); --q 为输出的脉冲频率
end;
architecture fana_arc of fana is
begin
process(clk)
variable b,d:std_logic;
variable c:integer RANGE 0 TO 312;
2.1 软件电路方案设计
对六个波形模块和三个选择模块进行单独编写,最后设计顶层模块输出。
在确定课题的第一天,我和我的组员查找资料,初步确定了电路的设计方案。
2.2 原理框图
信号输出
波形选择 频率选择 幅度选择 输出模块
begin
if clk'event and clk='1' then
if b='0' then --检测b
c:=a-1; --b为低电平则将a-1送到c
b:='1'; --且令b=1
else
if c=1 then --b为1时检测c b:='0'; --c=1时使b=0
d:=not d; --d取反
else c:=c-1; --c不等于1时c-1
end if;
end if;
end if;
q<=d; --将d作为频率输出
end process;
end;
分析:这一部分主要实现对fpga内部时钟的初始分频。
波形如上,当输入a
为256时,每256个clk脉冲后q发生一个脉冲。
3.2 频率选择
实体框图
程序清单:
library ieee;
use ieee.std_logic_1164.all;
entity chuzhi is
port(f0:in std_logic_vector(1 downto 0); --f0初始频率选择开关
q:out integer RANGE 0 TO 312);
end;
architecture chu_arc of chuzhi is
begin
with f0 select --四种不同的初值
q<=312 when"00",
201 when"01",
101 when"10",
10 when"11",
NULL when others;
end;
分析:这部分程序实现脉冲频率的选择,当f0为00、01、10、11时,频率分别为312、201、101、10;将此输出作为分频器的输入。
3.3 幅度选择
实体框图
程序清单:
library ieee;
use ieee.std_logic_1164.all;
entity fudu is
port(f1:in std_logic_vector(1 downto 0); --f0初始频率选择开关q:out integer RANGE 0 TO 255);
end;
architecture fudu_arc of fudu is
begin
with f1 select --四种不同的初值q<=255 when"00",
207 when"01",
167 when"10",
119 when"11",
NULL when others;
end;
分析:此程序为幅度选择,当f1为00、01、10、11时,幅度分别为255、207、167、169。
3.4 六种波形设计
a、方波
实体框图
程序清单:
library ieee;
use ieee.std_logic_1164.all;
entity square is
port(clk,clr:in std_logic;
k:in integer range 0 to 255; --幅度选择信号
q:out integer range 0 to 255); --方波输出
end;
architecture sq_arc of square is
signal a:bit;
begin
process(clr,clk)
variable cnt:integer;
begin
if clr='0' then
a<='0';
elsif clk'event and clk='1' then --时钟上升沿
if cnt<31 then cnt:=cnt+1; --cnt未到31时加1
else cnt:=0; --cnt到31时清零
a<=not a; --并将a取反
end if;
end if;
end process;
process(clk,a)
begin
if clk'event and clk='1' then
if a='1' then --每个时钟上升沿检测a
q<=k; --a为1则q为最大值,即高电平
else
q<=0; --a为0时取反,q为最小值
end if;
end if;
end process;
end;
分析:64个上升沿脉冲形成一个周期,半个周期为高电平255,半个周期低电平0。
b、三角波
实体框图
程序清单:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity delta is
port(clk,clr:in std_logic;
k:in integer range 0 to 255; --k幅度选择信号
q:out integer range 0 to 255);
end delta;
architecture a of delta is
begin
process(clk,clr)
variable num:integer range 0 to 255;
variable ff:std_logic;--上升沿/下降沿判断标志,为0时上升,为1时下降
begin
if clr='0' then --异步复位端
num:=0;
elsif clk'event and clk='1' then --上升沿
if ff='0' then
if num=k-7 then
num:=k;
ff:='1';
else
num:=num+8; --ff=0,每个上升沿脉冲加8 end if;
else
if num=7 then
num:=0;
ff:='0';
else
num:=num-8; --ff=1,下降沿,每个脉冲减8 end if;
end if;
end if;
q<=num;
end process;
end a;
分析:每个脉冲上升8个点,点连成线形成三角的上升和下降曲线。
由上图可知当幅度输入为207时,当上升到207个点时下降。
c、正弦波
实体框图
程序清单:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity sin is
port(clk,clr:in std_logic;
k:in integer range 0 to 255; --幅度选择信号
d:out integer range 0 to 255);
end;
architecture sin_arc of sin is
begin
process(clk,clr,k)
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=63则清零
tmp:=0;
else
tmp:=tmp+1; --否则tmp+1
end if;
if k=255 then
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 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<=254; when 63=>d<=255; --完成一个周期
when others=>NULL;
end case;
elsif k=207 then
case tmp is
when 00=>d<=207; when 01=>d<=206; when 02=>d<=205; --上升曲线
when 03=>d<=202; when 04=>d<=199; when 05=>d<=195; when 06=>d<=190; when 07=>d<=183; when 08=>d<=177; when 09=>d<=169; when 10=>d<=160; when 11=>d<=152; when 12=>d<=142; when 13=>d<=132; when 14=>d<=123; when 15=>d<=111; when 16=>d<=100; when 17=>d<=91; when 18=>d<=80; when 19=>d<=70; when 20=>d<=61;
when 21=>d<=52; when 22=>d<=43; when 23=>d<=35;
when 24=>d<=28; when 25=>d<=21; when 26=>d<=15;
when 27=>d<=10; when 28=>d<=6; when 29=>d<=3;
when 30=>d<=1; when 31=>d<=0; when 32=>d<=0; --下降曲线
when 33=>d<=1; when 34=>d<=3; when 35=>d<=6;
when 36=>d<=10; when 37=>d<=15; when 38=>d<=21;
when 39=>d<=28; when 40=>d<=35; when 41=>d<=43;
when 42=>d<=52; when 43=>d<=61; when 44=>d<=70;
when 45=>d<=80; when 46=>d<=91; when 47=>d<=100; when 48=>d<=111; when 49=>d<=123; when 50=>d<=132; when 51=>d<=142; when 52=>d<=152; when 53=>d<=160; when 54=>d<=169; when 55=>d<=177; when 56=>d<=183; when 57=>d<=190; when 58=>d<=195; when 59=>d<=199; when 60=>d<=202; when 61=>d<=205; when 62=>d<=206; when 63=>d<=207; --完成一个周期
when others=>NULL;
end case;
elsif k=167 then
case tmp is
when 00=>d<=167; when 01=>d<=166; when 02=>d<=165; --上升曲线
when 03=>d<=163; when 04=>d<=162; when 05=>d<=155; when 06=>d<=151; when 07=>d<=146; when 08=>d<=141;
when 12=>d<=113; when 13=>d<=105; when 14=>d<=97; when 15=>d<=89; when 16=>d<=81; when 17=>d<=73;
when 18=>d<=64; when 19=>d<=56; when 20=>d<=49;
when 21=>d<=42; when 22=>d<=34; when 23=>d<=28;
when 24=>d<=22; when 25=>d<=17; when 26=>d<=12;
when 27=>d<=8; when 28=>d<=5; when 29=>d<=3;
when 30=>d<=1; when 31=>d<=0; when 32=>d<=0; --下降曲线
when 33=>d<=1; when 34=>d<=3; when 35=>d<=5;
when 36=>d<=8; when 37=>d<=12; when 38=>d<=17;
when 39=>d<=22; when 40=>d<=28; when 41=>d<=34;
when 42=>d<=42; when 43=>d<=49; when 44=>d<=56;
when 45=>d<=64; when 46=>d<=73; when 47=>d<=81;
when 48=>d<=89; when 49=>d<=97; when 50=>d<=105;
when 51=>d<=113; when 52=>d<=121; when 53=>d<=128; when 54=>d<=134; when 55=>d<=141; when 56=>d<=146; when 57=>d<=151; when 58=>d<=155; when 59=>d<=162; when 60=>d<=163; when 61=>d<=165; when 62=>d<=166;
when 63=>d<=167; --完成一个周期
when others=>NULL;
end case;
elsif k=119 then
case tmp is
when 00=>d<=119; when 01=>d<=118; when 02=>d<=117; --上升曲线
when 03=>d<=116; when 04=>d<=114; when 05=>d<=112; when 06=>d<=109; when 07=>d<=105; when 08=>d<=101; when 09=>d<=97; when 10=>d<=92; when 11=>d<=87;
when 12=>d<=81; when 13=>d<=76; when 14=>d<=70;
when 15=>d<=64; when 16=>d<=58; when 17=>d<=52;
when 18=>d<=46; when 19=>d<=41; when 20=>d<=35;
when 21=>d<=30; when 22=>d<=25; when 23=>d<=20;
when 24=>d<=16; when 25=>d<=12; when 26=>d<=9;
when 27=>d<=6; when 28=>d<=4; when 29=>d<=2;
when 30=>d<=1; when 31=>d<=0; when 32=>d<=0;--下降曲线
when 33=>d<=1; when 34=>d<=2; when 35=>d<=4;
when 36=>d<=6; when 37=>d<=9; when 38=>d<=12;
when 39=>d<=16; when 40=>d<=20; when 41=>d<=25;
when 45=>d<=46; when 46=>d<=52; when 47=>d<=58;
when 48=>d<=64; when 49=>d<=70; when 50=>d<=76;
when 51=>d<=81; when 52=>d<=87; when 53=>d<=92; when 54=>d<=97; when 55=>d<=101; when 56=>d<=105; when 57=>d<=109; when 58=>d<=112; when 59=>d<=114; when 60=>d<=116; when 61=>d<=117; when 62=>d<=118; when 63=>d<=119; --完成一个周期
when others=>NULL;
end case;
end if;
end if;
end process;
end;
分析:与三角波一样,正弦波也是采用点连成曲线的方法完成的。
d、锯齿波
实体框图
程序清单:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity juchi is
port(clk,clr:in std_logic;
k:in integer range 0 to 255; --幅度选择信号
q:out integer range 0 to 255);
end juchi;
architecture juchi_arc of juchi is
begin
process(clk,clr)
variable num:integer range 0 to 255;
variable ff:std_logic; --上升沿/下降沿判断标志,为0时上升,为1时下降
begin
if clr='0' then --异步复位端
num:=0;
elsif clk'event and clk='1' then --上升沿
if ff='0' then --ff=0,上升沿,直线 num:=k;
ff:='1';
else if num=7 then
num:=0;
ff:='0';
else
num:=num-8; --ff=1,下降沿,每个脉冲减8
end if;
end if;
end if;
q<=num;
end process;
end juchi_arc;
分析:锯齿波建立在三角波的基础上,但在下降时用一条直线表示,周期是三角波的两倍。
e、阶梯波
实体框图
程序清单:library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity jieti is
port(clk,clr:in std_logic;
k:in integer range 0 to 255; --幅度选择信号
y:out integer range 0 to 255);
end;
architecture jieti_arc of jieti is
signal d,tmp:integer range 0 to 255;
begin
process(clk,clr,k,tmp)
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;
if k=255 then
case tmp is
when 00=>d<=255; --每八个脉冲一个台阶; when 07=>d<=191;
when 15=>d<=127;
when 23=>d<=63;
when 31=>d<=0;
when 39=>d<=63;
when 47=>d<=127;
when 55=>d<=191;
when 63=>d<=255;
when others=>d<=d;
end case;
elsif k=207 then
case tmp is
when 00=>d<=207;
when 07=>d<=155;
when 15=>d<=103;
when 23=>d<=51;
when 31=>d<=0;
when 39=>d<=51;
when 47=>d<=103;
when 55=>d<=155;
when 63=>d<=207; --完成一个周期
when others=>d<=d;
end case;
elsif k=167 then
case tmp is
when 00=>d<=167; --每八个脉冲一个台阶; when 07=>d<=125;
when 15=>d<=83;
when 23=>d<=41;
when 31=>d<=0;
when 39=>d<=41;
when 47=>d<=83;
when 55=>d<=125;
when 63=>d<=167;
when others=>d<=d;
end case;
elsif k=119 then
case tmp is
when 00=>d<=119; --每八个脉冲一个台阶;
when 07=>d<=89;
when 15=>d<=59;
when 23=>d<=29;
when 31=>d<=0;
when 39=>d<=29;
when 47=>d<=59;
when 55=>d<=89;
when 63=>d<=119;
when others=>d<=d;
end case;
end if;
end if;
end process;
y<=d;
end;
分析:阶梯波每八个脉冲上升十个点。
f、梯形波
实体框图
程序清单:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity tixing is
port(clk,clr:in std_logic;
k:in integer range 0 to 255; --幅度选择信号
q:out integer range 0 to 255);
end tixing;
architecture a of tixing is
begin
process(clk,clr)
variable num,n:integer range 0 to 255; --n计数
variable ff:integer range 0 to 2; --ff上升沿/下降沿判断标志,为0时上升,为1时上底边,为2时下降
begin
if clr='0' then --异步复位端
num:=0;
elsif clk'event and clk='1' then --上升沿
if ff=0 then
if num=k-7 then
num:=k;
ff:=1;
else
num:=num+8;n:=n+1; --ff=0,每个上升沿脉冲加8
end if;
elsif ff=1 then
if n=0 then
ff:=2;
else num:=num;
n:=n-1;
end if;
else
if num=7 then
num:=0;
ff:=0;
else
num:=num-8; --ff=2,下降沿,每个脉冲减8
end if;
end if;
end if;
q<=num;
end process;
end a;
分析:当输入幅度为255时,梯形波在前三分之一个周期在上升,中间三分之一保持高电平直线,后三分之一下降。
仿真波形如上。
3.5 输出模块
实体框图
程序清单:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity shuchu is
port(sel2,sel1,sel0:in std_logic; --方波,三角波,正弦波,锯齿波,阶梯波选择信号
sqra,dlta,sina,juchia,jietia,tixinga:in integer range 0 to 255;--方波,三角波,正弦波,锯齿波,阶梯波输入信号
q:out std_logic_vector(7 downto 0); --q为输出信号
ql:out std_logic_vector(7 downto 0)); --ql为数码显示
end;
architecture shuchu_arc of shuchu is
signal tmp:std_logic_vector(2 downto 0);
begin
tmp<=sel2&sel1&sel0;
with tmp select
q<=conv_std_logic_vector(sqra,8) when "001", --001,方波输出conv_std_logic_vector(dlta,8) when "010", --010,三角波输出
conv_std_logic_vector(sina,8) when "011", --011,正弦波输出
conv_std_logic_vector(juchia,8) when "100", --100,锯齿波输出
conv_std_logic_vector(jietia,8) when "101", --101,阶梯波输出
conv_std_logic_vector(tixinga,8) when "110", --110,梯形波输出
"00000000" when others;
with tmp select
ql<="00110000" when "001", --001,方波输出,数码管显示1 "01101101" when "010", --010,三角波输出,显示2
"01111001" when "011", --011,正弦波输出,显示3
"00110010" when "100", --100,锯齿波输出,显示4
"01011011" when "101", --101,阶梯波输出,显示5
"01011111" when "110", --110,梯形波输出,显示6
"10000000" when others; --不显示
end;
分析:输出模块将波形选择信号和六种波形信号作为输入信号,由选择信号s2s1s0进行波形选择,将所选波形作为输出。
第四部分顶层模块4.1 顶层模块设计
程序清单:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity hanshu is
port( clk1:in std_logic;
rst1:in std_logic;
F2,A1:in std_logic_vector(1 downto 0);
sel:in std_logic_vector(2 downto 0);
q1,ql1:out std_logic_vector(7 downto 0));
end hanshu;
architecture hanshu_arc of hanshu is
component chuzhi is --频率选择,初值port(f0:in std_logic_vector(1 downto 0);
q:out integer RANGE 0 TO 312);
end component ;
component fana is --频率输入的初始值
port(a:in integer RANGE 0 TO 312;
clk:in std_logic;
q:out std_logic);
end component ;
component fudu is --幅度选择
port(f1:in std_logic_vector(1 downto 0);
q:out integer RANGE 0 TO 255);
end component ;
component square is --方波
port(clk,clr:in std_logic;
k:in integer range 0 to 255;
q:out integer range 0 to 255);
end component;
component delta is --三角波
port(clk,clr:in std_logic;
k:in integer range 0 to 255;
q:out integer range 0 to 255);
end component;
component sin is --正弦波
port(clk,clr:in std_logic;
k:in integer range 0 to 255;
d:out integer range 0 to 255);
end component;
component juchi is --锯齿波
port(clk,clr:in std_logic;
k:in integer range 0 to 255;
q:out integer range 0 to 255);
end component ;
component jieti is --阶梯波
port(clk,clr:in std_logic;
k:in integer range 0 to 255;
y:out integer range 0 to 255);
end component ;
component tixing is --梯形波
port(clk,clr:in std_logic;
k:in integer range 0 to 255;
q:out integer range 0 to 255);
end component;
component shuchu is
port(sel2,sel1,sel0:in std_logic; --输出sqra,dlta,sina,juchia,jietia,tixinga:in integer range 0 to 255;
q:out std_logic_vector(7 downto 0);
ql:out std_logic_vector(7 downto 0));
end component;
signal aa:integer RANGE 0 TO 312;
signal b,c0,c1,c2,c3,c4,c5:integer RANGE 0 TO 255;
signal i:std_logic;
begin
u1:chuzhi port map(f0=>F2,q=>aa);
u2:fana port map(a=>aa,clk=>clk1,q=>i);
u3:fudu port map(f1=>A1,q=>b);
u4:square port map(clk=>i,clr=>rst1,k=>b,q=>c0);
u5:delta port map(clk=>i,clr=>rst1,k=>b,q=>c1);
u6:sin port map(clk=>i,clr=>rst1,k=>b,d=>c2);
u7:juchi port map(clk=>i,clr=>rst1,k=>b,q=>c3);
u8:jieti port map(clk=>i,clr=>rst1,k=>b,y=>c4);
u9:tixing port map(clk=>i,clr=>rst1,k=>b,q=>c5);
u10:shuchu port map(sel2=>sel(2),sel1=>sel(1),sel0=>sel(0), sqra=>c0,dlta=>c1,sina=>c2,juchia=>c3,jietia=>c4,tixinga=>c5, q=>q1,ql=>ql1);
end ;
4.2 仿真结果及分析
当rst=0时,清零,无输出。
Sel为波形选择信号,同时输出相应的数字,ql1为数码显示。
当波形选择信号sel=1时,输出方波。
此时幅度选择信号A1=00最大幅度处;频率选择信号F2=00,周期最大处。
第五部分硬件电路设计及安装图
5.1 连线图
5.2 输入、输出信号说明
通过拨动开关S3、S2、S1实现波形的选择:
(1)拨动开关S3S2S1=000时,产生方波信号,同时数码管显示“1”;
(2)拨动开关S3S2S1=001时,产生三角波信号,同时数码管显示“2”;
(3)拨动开关S3S2S1=010时,产生正弦波信号,同时数码管显示“3”;
(4)拨动开关S3S2S1=011时,产生锯齿波信号,同时数码管显示“4”;
(5)拨动开关S3S2S1=100时,产生阶梯波信号,同时数码管显示“5”;
(6)拨动开关S3S2S1=101时,产生梯形波信号,同时数码管显示“6”。
通过拨动开关A2、A1实现波形幅度的选择:
(1)拨动开关A2A1=00时,幅度最大;
(2)拨动开关A2A1=01时,幅度为原来的0.8;
(3)拨动开关A2A1=10时,幅度为原来的0.65;
(4)拨动开关A2A1=11时,幅度为原来的0.47。
通过拨动开关F2、F1实现波形频率的选择:
(1)拨动开关F2F1=00时,频率最小,约为160kHz;
(2)拨动开关F2F1=01时,频率约为249kHz;
(3)拨动开关F2F1=10时,频率约为495kHz;
(4)拨动开关F2F1=11时,频率约为5MHz。
5.3 设计中需要注意的问题
在下载程序测试前,先用实验箱上的资源测试一下各部分是否正确。
第六部分调试结果说明及分析6.1 实物图
6.2 输出实物波形
1)、方波,数码显示“1”
2)、三角波,数码显示“2”
3)、正弦波,数码显示“3”
4)、锯齿波,数码显示“4”
5)、阶梯波,数码显示“5”
6)、梯形波,数码显示“6”
6.3 设计中需要注意的问题
注意检查电路的连接是否与引脚锁定时一致。
第七部分收获体会
在这次实验中我们遇到很多问题,刚拿到课题是几乎觉得无从下手。
然后我们在图书馆查了一天资料,又上网搜索有关资源,终于了解了该怎么设计函数发生器。
站在前人的肩膀上,我们的工作轻松了很多,于是我们又去创新。
在完成基本要求之后,又增加了锯齿波、阶梯波、和梯形波,并让这六种波形可以通过数码管显示出具体数值,同时使频率和幅度都能够实现四种选择。
我们的设计并不是一次性成功的,一开始总是不能输出任何东西。
然后我们就去检查fpga芯片是否正常。
我设计了一个基本与门测试,没发现芯片有问题,但是就是不能我们设计输出波形。
经检查得并不是每一个I/O脚都可以用,于是我们换了一块芯片重新试验。
在反复的调试后,终于得出了期望的波形!
附录一:硬件部分使用的元件清单:
200欧姆电阻若干,1.1K电阻若干,5.1k电阻一个,47k变阻器一个;
D/A转换0832一个;
共阴极数码管42039一个;
运放OP07一个;
开关若干;
插针若干;
管脚插座若干;
杜邦线若干;
导线若干;
焊接所需工具:
电烙铁,烙铁架,焊锡丝,万用表(用于检测是否虚焊),小铁钳等工具;
附录二:参考文献
【1】潘松黄继业 EDA技术与VHDL 清华大学出版社 2009,9;
【2】梁勇,王留奎。
EDA技术教程,人民邮电出版社,2010,5;
【3】李莉,陆而红。
电子设计自动化(EDA)课程设计与项目实例,中国电力出版社,2009,10;。