波形发生器EDA.docx

上传人:b****5 文档编号:7391400 上传时间:2023-01-23 格式:DOCX 页数:11 大小:974.15KB
下载 相关 举报
波形发生器EDA.docx_第1页
第1页 / 共11页
波形发生器EDA.docx_第2页
第2页 / 共11页
波形发生器EDA.docx_第3页
第3页 / 共11页
波形发生器EDA.docx_第4页
第4页 / 共11页
波形发生器EDA.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

波形发生器EDA.docx

《波形发生器EDA.docx》由会员分享,可在线阅读,更多相关《波形发生器EDA.docx(11页珍藏版)》请在冰豆网上搜索。

波形发生器EDA.docx

波形发生器EDA

目录

一题目要求1

1.1波形发生器1

1.1.1题目要求1

二方案论证1

2.1实验目的1

2.2设计思路1

2.2.1原理分析和讨论1

2.2.2程序流程图3

三结果分析5

3.1实验波形图及幅值显示5

3.2结果分析6

四总结与体会7

参考文献7

附录8

参考程序8

一题目要求

1.1波形发生器

1.1.1题目要求

用VHDL实现锯齿波,要求周期、幅度可调,并将幅值显示在数码管上。

二方案论证

2.1实验目的

(1)掌握MAX+plus

操作流程,熟练运用VHDL语言。

(2)掌握有关DAC0832芯片的相关功能

(3)熟练掌握数字示波器的使用。

2.2设计思路

2.2.1原理分析和讨论

图1结构图

本次课题的设计思路可分为5个部分,如图1所示,即启动DAC0832、波形的幅度调节、周期的调节、波形幅度值到BCD码转化以及显示幅度值。

启动DAC0832时需认真阅读有关实验箱的手册,以及DAC0832的引脚功能,由于DAC0832是由FPGA输出的信号wr、cs驱动、控制的,当reset为高电平时,DAC0832关闭[1],因此根据实验箱的操作手册,我们只需将开关的1、5、8位置“ON”,其他的打到“OFF”档,DAC0832的启动只需将cs、wr1设为‘0’即可。

对于波形的幅度调节,我们是通过两个按键up、down来实现的,按下up键,波形的幅值增大,按下down键则与之相反,该功能的实现主要是通过if语句来判断up、down键是否按下,并根据判断结果做出相应的操作。

对于波形的周期调节,我们是通过两个按键up0、down0来实现的,按下up0键,波形的周期增大,按下down0键则与之相反,该功能主要是通过改变变量的值间接实现周期的调节,另外通过按下up、down键也可改变波形的周期。

波形幅度值到BCD码的转化是本课题中比较重要的一部分,这部分的正确性对后面的幅度显示起决定性作用。

通过查阅资料我们得出DAC0832的参考电压时12V,根据公式Vout=Vref/256*D即可得出波形的输出电压值,得出输出电压值后,将该电压的每一位数值通过一定的方法取出来,再将其值送到相应位的数码管上显示即可完成。

2.2.2程序流程图

图2幅度调节

图3周期调节

三结果分析

3.1实验波形图及幅值显示

图4锯齿波波形

图5幅值显示(单位:

mv)

3.2结果分析

从上面的三幅图片中可明显地看出锯齿波的幅值有增大的趋势,该趋势是我们通过up键来体现的,按下down键,也可实现幅值减小,由此可知该锯齿波的幅度是可调的,周期也是如此,数码管上的幅值显示跟数字示波器上数据的差异是由实验电路的抖动产生的,此误差是不可避免的,将两种数据进行比较,我们可看出他们的差距不大,因此可认为数码管上的幅值就是锯齿波的幅值。

四总结与体会

参考文献

[1].张庆铃.用VHDL硬件描述语言设计波形发生器[J].西安航空技术高等专科学校学报,2002.(20).

[2].龙安国.基于VHDL的交通灯控制与实现[D].永州:

永州职业技术学院.2009.2

[3].赵凯.一种基于EDA的智能交通灯设计[D].湖北:

武汉工业学院.2008.2

 

附录

参考程序

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_arith.all;

useieee.std_logic_unsigned.all;

entitymine4is

port(clk,reset:

instd_logic;--时钟信号输入

up,down:

instd_logic;--波形特征的幅度调节

up0,down0:

instd_logic;--波形特征的周期调节

a:

bufferstd_logic_vector(7downto0);--波形、幅度数据输出

b:

bufferstd_logic_vector(7downto0);

shift:

outstd_logic_vector(3downto0);--位码输出

lcd:

outstd_logic_vector(7downto0);--显示输出

cs,wr:

outstd_logic);

endmine4;

architecturebehavofmine4is

signalamp:

std_logic_vector(7downto0);

signalcnter:

std_logic_vector(7downto0);

signaly:

integerrange0to9;

signalbcd00,bcd10,bcd20,bcd30:

integerrange0to9;

signalbcd0,bcd1,bcd2,bcd3:

integerrange0to9;

begin

----------启动DAC0832--------------------------------

process(clk)

begin

if(clk'eventandclk='1')then

if(reset='1')then

cs<='1';

wr<='1';

else

cs<='0';

wr<='0';

endif;

endif;

endprocess;

-------调节幅度--------------------------------------

process(clk,up,down)

variablex:

integer:

=50;

begin

if(reset='1')thenamp<="00000000";

elsif(clk'eventandclk='1')then

if(up='1')then

x:

=x+1;

if(amp

amp<=amp+1;

else

amp<="00000000";

endif;

elsif(up='0')then

if(amp

amp<=amp+1;

else

amp<="00000000";

endif;

endif;

if(down='1')then

x:

=x-1;

if(amp

amp<=amp+1;

else

amp<="00000000";

endif;

elsif(down='0')then

if(amp

amp<=amp+1;

else

amp<="00000000";

endif;

endif;

endif;

endprocess;

-------调节周期----------------------------------

process(clk,up0,down0)

variablec:

integer:

=100;

begin

if(reset='1')thena<="00000000";

elsif(clk'eventandclk='1')then

if(up0='1')then

c:

=c+2;

endif;

if(down0='1')then

c:

=c-2;

endif;

b<=conv_std_logic_vector(c,8);

if(cnter>=b)then

cnter<="00000000";

else

cnter<=cnter+1;

endif;

if(cnter

a<=amp;

else

a<="00000000";

endif;

endif;

endprocess;

-------------波形幅度值到BCD码转化,bcd00,bcd10,bcd20,bcd30是本进程的输出-------------

process(clk,amp)

variablecount:

integerrange0to5000422;

variablecount1:

integerrange0to4999999;

begin

ifrising_edge(clk)then

ifcount1=49999thencount1:

=0;

bcd0<=0;bcd1<=0;bcd2<=0;bcd3<=0;

count:

=(conv_integer(amp))*240000/256;

elsifcount1=49900thencount1:

=count1+1;

bcd00<=bcd0;bcd10<=bcd1;bcd20<=bcd2;bcd30<=bcd3;

elsecount1:

=count1+1;

ifcount>9999thencount:

=count-10000;bcd3<=bcd3+1;

elsifcount>999thencount:

=count-1000;bcd2<=bcd2+1;

elsifcount>99thencount:

=count-100;bcd1<=bcd1+1;

elsifcount>9thencount:

=count-10;bcd0<=bcd0+1;

elsenull;

endif;

endif;

endif;

endprocess;

----------波形幅度数据译码动态显示--------------------------

process(clk)

variablecount:

integerrange0to499999;

begin

ifrising_edge(clk)then

ifcount<12499theny<=bcd30;count:

=count+1;shift<="1000";

elsifcount<24999theny<=bcd20;count:

=count+1;shift<="0100";

elsifcount<37499theny<=bcd10;count:

=count+1;shift<="0010";

elsifcount<49999theny<=bcd00;count:

=count+1;shift<="0001";

elsifcount>=49999theny<=bcd00;count:

=0;shift<="0001";

endif;

endif;

endprocess;

lcd(7)<='0';

---------7段码译码----------------------------------

process(y)

begin

caseyis

when0=>lcd(6downto0)<="1111110";

when1=>lcd(6downto0)<="0110000";

when2=>lcd(6downto0)<="1101101";

when3=>lcd(6downto0)<="1111001";

when4=>lcd(6downto0)<="0110011";

when5=>lcd(6downto0)<="1011011";

when6=>lcd(6downto0)<="1011111";

when7=>lcd(6downto0)<="1110000";

when8=>lcd(6downto0)<="1111111";

when9=>lcd(6downto0)<="1111011";

whenothers=>lcd(6downto0)<="1000111";

endcase;

endprocess;

end;

 

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 教学研究 > 教学案例设计

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1