下载

1下载券

加入VIP
  • 专属下载券
  • 上传内容扩展
  • 资料优先审核
  • 免费资料无限下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 第8章程序部分8.23 波形发生程序

第8章程序部分8.23 波形发生程序.doc

第8章程序部分8.23 波形发生程序

。CYSTE,M
2018-09-08 0人阅读 举报 0 0 0 暂无简介

简介:本文档为《第8章程序部分8.23 波形发生程序doc》,可适用于工程科技领域

多功能波形发生器VHDL程序与仿真文件名:minevhd。功能:实现种常见波形正弦、三角、锯齿、方波(A、B)的频率、幅度可控输出(方波A的占空比也是可控的)可以存储任意波形特征数据并能重现该波形还可完成各种波形的线形叠加输出。说明:SSS(前三位)和SW信号控制种常见波形种哪种波形输出。种波形的频率、幅度(基准幅度A)的调节均是通过up、down、set按键和个BCD码置入器以及一个置入档位控制信号(ss)完成的(AMP的调节范围是~V调节量阶为V)。其中方波的幅度还可通过u、d调节输出数据的归一化幅值(AMP)进行进一步细调(调节量阶为(*)V)。方波A的占空比通过zu、zp按键调节(调节量阶*T)。系统采用内部存储器RAM实现任意输入波形的存储程序只支持键盘式波形特征参数置入存储posting为进入任意波置入(set)、清除(clr)状态控制信号SSS控制存储波形的输出。P为预留端口最后修改日期:。libraryieeeuseieeestdlogicalluseieeestdlogicarithalluseieeestdlogicunsignedallentitymineisport(clk:instdlogic时钟信号输入set,clr,up,down,zu,zd:instdlogic各个波形特征的调节触发信号posting:instdlogic任意波键盘置入信号u,d,sw:instdlogic方波A、B的切换sw和方波B的幅度调节按键ss:instdlogicvector(downto)档位选择信号sss:instdlogicvector(downto)波形选择信号Data,Data,Data,Data:instdlogicvector(downto)BCD码输入p:outstdlogic预留接口lcd:outstdlogicvector(downto)显示输出shift:outstdlogicvector(downto)位码输出dd,a:outstdlogicvector(downto))波形、幅度数据输出endminearchitecturebehavofmineissubtypewordisstdlogicvector(downto)typeunitisarray(downto)ofwordsignalram:unitsignalqqq:integerrangetosignalqq:integerrangetosignaltmp:integerrangetosignalcoun:integerrangetosignalcoun:integerrangetosignalb:integerrangetosignalc:integerrangetosignalz,con:integerrangetosignalf:stdlogicvector(downto)signalamp,amp,d:stdlogicvector(downto)signalbcd,bcd,bcd,bcd:integerrangetosignalbcd,bcd,bcd,bcd:integerrangetosignalbcd,bcd,bcd,bcd:integerrangetosignaly:integerrangetosignaladdr:integerrangetobeginqq<=whenss=""elsewhenss=""elsewhenss=""elseqq信号对应SW=时的档位选择信号SS实现方波A和其他三种波形的频率预置qqq<=whenss=""elsewhenss=""elsewhenss=""elseqqq信号对应SW=时的档位选择信号SS实现方波B的频率预置process(clk)此进程分别描述了各种波形的频率、幅度(方波A的占空比)调节以及各种波形的任意线形叠加等。variablecount:integerrangetovariablecount:integerrangetovariablecount:integerrangetovariablecount:integerrangetovariablecount:integerrangetovariableddd:stdlogicvector(downto)variabledd,dd,dd,dd,dd:integerrangetovariableadr:integerrangetobeginifrisingedge(clk)thenifposting=''thenifcount=thencount:=adr:=convinteger(Data)*convinteger(Data)存储单位地址ifadr<thenifset=''thenram(adr)<=convstdlogicvector((convinteger(Data)*convinteger(Data))*,)对置入的任意波形数据进行储存elsifclr=''thenadr:=存储器所有单元清零foriintoloopram(i)<=(others=>'')endloopendifendifelsecount:=countendifelseifset=''thencoun<=b<=coun<=c<=z<=amp<=""addr<=tmp<=convinteger(Data)*convinteger(Data)*convinteger(Data)*convinteger(Data)频率数据amp<=""幅值elseiftmp>thenifsw=''thenifcoun<qqthencoun<=countmpb<=b频率到采样点间隔脉冲数转换elseifcount=bthencount:=iff=thenf<=""elsef<=fendififsss=""then方波Aifcon<=zthendd<=ampcon<=conelsifcon=thencon<=dd<=""elsecon<=condd<=""endifelsifsss=""thendd<=d正弦波elsifsss=""thendd<=f(downto)""锯齿波elsifsss=""then三角波iff>thendd<=(""f(downto))""elsedd<=f(downto)""endifelsifsss=""then任意波ifaddr<thendd<=ram(addr)addr<=addrelsifaddr=thendd<=ram()addr<=endifelse完成种波形的线形叠加ifsss()=''thenifcon<=zthencon<=condd:=convinteger(amp)方波波形数据ddelsecon<=condd:=endifendififsss()=''thendd:=convinteger(d)正弦波波形数据ddendififsss()=''thendd:=convinteger(f(downto)"")锯齿波波形数据ddendififsss()=''theniff>thendd:=convinteger((""f(downto))"")elsedd:=convinteger(f(downto)"")三角波波形数据ddendifendififsss()=''thenifaddr<thendd:=convinteger(ram(addr))addr<=addrelsifaddr=thendd:=convinteger(ram())addr<=endif任意波波形数据ddendifddd:=convstdlogicvector((dddddddddd),)波形线形叠加输出dd<=ddd(downto)endifelsecount:=countendifendifelseifcoun<qqqthencoun<=countmpc<=celseifcount<=cthencount:=countdd<=ampelsifcount=cthencount:=dd<=""elsecount:=countdd<=""endifendifendifendififcount=thencount:=调方波A的占空比ifzu=''thenifz<thenz<=zelsez<=endifelsifzd=''thenifz>thenz<=zelsez<=endifendifelsecount:=countendififcount=thencount:=up、down对种波形幅度调节u、d进一步对方波进行幅度调节ifu=''thenifamp<""thenamp<=ampelseamp<=""endifelsifd=''thenifamp>""thenamp<=ampelseamp<=""endifelsifup=''thenifamp<""thenamp<=ampelseamp<=""endifelsifdown=''thenifamp>""thenamp<=ampelseamp<=""endifendifelsecount:=countendifendifendifendifendprocessa<=amp将幅值输出。cova:process(clk,amp,amp)主要实现各波形幅度值到BCD码的转化由于方波和其他三种波形的幅度调节方式、精度不同因此对幅度的处理方式分两种:“sss=""orsw=''”是判断输出波形是否为方波(A或B)bcd,bcd,bcd,bcd是本进程的输出。variablecount:integerrangetovariablecounter:integerrangetovariablecount,count:integerrangetobeginifrisingedge(clk)thenifsss=""orsw=''thencount:=方波ifcount=thencount:=bcd<=bcd<=bcd<=bcd<=count:=(convinteger(amp))*(convinteger(amp))*幅值运算elsifcount=thencount:=countbcd<=bcdbcd<=bcdbcd<=bcdbcd<=bcd数据输出elsecount:=count二进制码到BCD码的数据转换ifcount>thencount:=countbcd<=bcdelsifcount>thencount:=countbcd<=bcdelsifcount>thencount:=countbcd<=bcdelsifcount>thencount:=countbcd<=bcdelseendifendifelsecount:=正弦波、三角波、锯齿波ifcount=thencounter:=convinteger(amp)*count:=bcd<=bcd<=bcd<=bcd<=elsifcount=thenbcd<=bcdbcd<=bcdbcd<=bcdbcd<=bcdcount:=countelsecount:=countifcounter>thencounter:=counterbcd<=bcdelsifcounter>thencounter:=counterbcd<=bcdelsifcounter>thencounter:=counterbcd<=bcdelsifcounter>thencounter:=counterbcd<=bcdelseendifendifendifendifendprocessprocess(clk)输出波形幅度(峰峰值)数据译码动态显示variablecount:integerrangetobeginifrisingedge(clk)thenifcount<=theny<=bcdcount:=countshift<=""lcd()<=''elsifcount<=theny<=bcdcount:=countshift<=""lcd()<=''elsifcount<=theny<=bcdcount:=countshift<=""lcd()<=''elsifcount<theny<=bcdcount:=countshift<=""lcd()<=''elsifcount=theny<=bcdcount:=shift<=""lcd()<=''endifendifcaseyis段码译码when=>lcd(downto)<=""when=>lcd(downto)<=""when=>lcd(downto)<=""when=>lcd(downto)<=""when=>lcd(downto)<=""when=>lcd(downto)<=""when=>lcd(downto)<=""when=>lcd(downto)<=""when=>lcd(downto)<=""when=>lcd(downto)<=""whenothers=>lcd(downto)<=""endcaseendprocessym:process(clk)正弦波在一个周期内时域上的个采样点的波形数据beginifrisingedge(clk)thencasefiswhen""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""when""=>d<=""whenothers=>endcaseendifendprocessp<=''endbehav

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

评分:

/7

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利