I摘要在信号发生器的设计中,传统的用分立元件或通用数字电路元件设计电子线路的方法设计周期长,花费大,可移植性差。本设计是利用EDA技术设计的电路,该信号发生器输出信号的频率范围为20Hz~20KHz,幅度的峰-峰值为0.3V~5V两路信号之间可实现0°~359°的相位差。侧重叙述了用FPGA来完成直接数字频率合成器(DDS)的设计,DDS由相位累加器和正弦ROM查找表两个功能块组成,其中ROM查找表由兆功能模块LPM_ROM来实现。而通过设定不同的累加器初值(K1)和初始相位值(K2),可以调节两路相同频率正弦信号之间的相位差,从而产生两路数字式的频率、相位和幅值可调的正弦波信号,最后通过MAX+plusII演示仿真结果。与传统的频率合成方法相比,DDS合成信号具有频率切换时间短、频率分辨率高、相位变化连续等诸多优点。使用单片机灵活的控制能力与FPGA器件的高性能、高集成度相结合,可以克服传统DDS设计中的不足,从而设计开发出性能优良的DDS系统。关键词:单片机,现场可编程逻辑门阵列,直接数字频率合成,正弦信号发生器,硬件描述语言IIAbstractInthedesigningofthesignalgenerator,thetraditionalmethod,whichdesignselectroniccircuitsusingdiscretecomponentsorgeneraldigitalcircuitscomponents,takesalongtimewithhighcost,what’smore,thetransplantingabilityofitisunsatisfactory.Inthisdesign,thecircuitisdesignedbymeansofEDA.Itsoutputfrequencyrangeis20Hzto20KHzwithanoutputamplituderangeof0.3Vto5V(P-P),andthephasedifferencebetweentwooutputsofthetwosinesignalscanbemodulatedfrom0°to359°.ThethesisemphasizingdiscussesthedesigningofDDSbasingonFPGA.DDSismadeupofthephraseaccumulatorandsineROMlooking-uptable,whichisrealizedbyfunctionalEABchip.Andthroughsettingdifferentinitialaccumulatorvalue(K1)andinitialphrasevalue(K2),thedifferenceofphrasebetweenthetwosinesignalscanbechanged.Asaresult,twoserialsofsinesignalswithchangeabledigitalfrequency,phraseandmagnitudeareproduced.Atlast,wecanshowthetotalcourseandresultwithMAX+plusII.Comparedwithtraditionalmethodsoffrequencysynthesizing,directdigitalfrequencysynthesizing(DDS)haslotsofadvantages,suchasshorttimeofquickfrequencyexchanging,highfrequencyresolution,continuousphasechanging,etc.Micro-controlunithasischaracterizedby.ManydrawbackscanbeovercomeandagoodDDSsystemwithgoodperformancecanbedevelopedaftercombiningtheflexiblecontrolcapabilityofmicro-controlunitwithhighperformanceandintegrationoftheFPGAdevicesinthesamesystem.Keywords:MCU,FPGA,DDS,ROMsinewavegenerator,VHDLIII目录摘要.....................................................................IAbstract................................................................II1绪言1.1课题背景...............................................................11.2课题研究的目的和意义...................................................11.3国内外概况.............................................................21.4课题的主要研究工作.....................................................32系统设计方案的研究2.1系统的性能要求.........................................................42.2系统实现的原理.........................................................42.2.1DDS的基本原理........................................................52.2.2FPGA实现的直接数字频率合成器........................................62.2.3移相原理.............................................................62.3系统实现方案分析与比较.................................................82.3.1频率合成器方案.......................................................82.3.2移相方案............................................................102.3.3存储器方案..........................................................102.3.4存储器寻址方案......................................................113总体设计3.1FPGA设计DDS电路的具体实现...........................................123.1.1相位累加器部分......................................................123.1.2相位/幅度转换电路...................................................123.1.3波形表生成..........................................................133.1.4D/A转换电路.........................................................133.1.5系统控制电路........................................................133.2单片机与FPGA的接口设计...............................................133.3现场可编程逻辑器件(FPGA)的选择......................................153.4其他电路设计..........................................................163.4.1晶体振荡电路........................................................163.4.2地址计数脉冲产生电路................................................173.4.3幅度控制电路........................................................173.4.4单片机外扩展存储器电路..............................................183.4.5滤波、缓冲输出电路..................................................183.4.6键盘和显示控制电路..................................................194系统的实现4.1系统的计算与仿真......................................................204.1.1系统频率、相位和幅度的计算..........................................204.1.2系统仿真............................................................214.2单片机的编程实现......................................................225总结与展望.............................................................23IV致谢....................................................................25参考文献................................................................26附录1..................................................................28附录2...................................................................29附录3...................................................................3211绪言1.1课题背景在一些电子设备的电路板故障检测仪中,往往需要频率、幅度都能由计算机自动调节的信号源。采用诸如MAX038信号发生器芯片外加电阻及切换开关等器件虽然也能调节频率和幅度,但这种调节是离散的,且电路复杂,使用不方便[1]。而采用直接数字合成芯片DDS及外加D/A转换芯片构成的可控信号源,可产生正弦波、调频波、调幅波及方波等,并且其信号的频率和幅度可由微机来精确控制,调节非常方便。另外随着21世纪的到来,人类正在跨入信息时代。现代通信系统的发展方向是功能更强,体积更小,速度更快,功耗更低。而大规模可编程器件CPLD/FPGA在集成度、功能和速度上的优势正好满足通信系统的这些要求。所以今天无论是民用的移动电话、程控交换机、集群电台、广