【正文】
end sin_arc。end if。when others=null。 when 62=d=254。when 60=d=249。 when 58=d=239。when 56=d=225。when54=d=207。when 52=d=186。 when 50=d=162。when 48=d=137。 when 46=d=112。when 44=d=87。when 42=d=64。 when 39=d=34when 40=d=43。 when 37=d=19。 when 35=d=8。 when 33=d=1。 when 31=d=0。 when 29=d=4。 when 27=d=13。 when 25=d=26。 when 23=d=43。 when 21=d=64。 when 19=d=87。 when 17=d=112。 when 15=d=137。 when 13=d=162。 when 11=d=186。 when 09=d=207。 when 07=d=225。 when 05=d=239。 when 03=d=249。 when 01=d=254。end if。thenif tmp=63 then tmp:=0。event and clk=39。then d=0。begin if clr=39。end sin。entity sin isport (clk ,clr:in std_logic。use 。END。3E:FE。3C:F9。3A:EF。38:E1。36:CF。34:BA。32:A2。30:89。2E: 70。2C: 57。2A: 40。28:2B。26:1A。24:0D。22:04。20:00。1E:01。1C:08。1A: 13。18:22。16:35。14:4B。12:63。10:7C。0E:96。0C:AE。0A:C5。08:D9。06:E9。04:F5。02:FC。CONTENT BEGIN00:FF。ADDRESS_RADIX=HEX。WIDTH=8。end leijia_arc。out1=t。 end if。139。139。 elsif (clk39。039。architecture leijia_arc of leijia is begin process (clk,en,reset)variablet : std_logic_vector(9 downto 0)。out1:out std_logic_vector(9 downto 0))。entity leijia isport( clk,en,reset:in std_logic。use 。end dds_arc。 acc=msbs。 end loop。select1:process(acc8),variable i:integer。begin add1:lam_add_subgeneric map(lpm_width=width, lpm_representation=signed, lpm_direction=add, lpm_pipeline=0)port map(dataa=m,datab=acc8,result=s)。architecture dds_arc of dds issignal s,acc8:std_logic_vector(width:1 downto 0)。 clk:in std_logic)。(m:in std_logic_vector(width:1 downto 0)。use 。DDS功能模塊library ieee。end fenp_arc。q=d。 end if。 else c:=c1。039。139。thenc:=a1。thenif b=39。event and clk=39。variable c:integer range 0 to 1024。end fenp。 clk:in std_logic。use 。FENP模塊將CHUZHI模塊送來的初值對時鐘進(jìn)行分頻,得到不同的工作頻率,從而調(diào)節(jié)波形頻率。end process。when others=null。when 1001=q=35。when 0111=q=45。when 0101=q=63。when 0011=q=104。architecture chu_arc of chuzhi isbegin process(a)begin case a iswhen 0001=q=313。 q:out interge range 0 to 312)。use 。附錄3CHUZHI模塊提供初值,供下一個模塊FENP分頻時用。datout2=latch_out2。end process。139。039。end process。 thenlatch_in1=datain1。event and latch1=39。end process。 寄存器中的數(shù)據(jù)讀入P0口 else p0=ZZZZZZZZ。039。139。end process。thenlatch_out2=p0。event and wr_enable2=39。end process。139。process( p2,latch_addres ) WR寫信號譯碼過程2begin if (latch_addres=11110011) and (p2=00011111) thenwr_enable2=wr。end if。139。process( wr_enable1 ) 數(shù)據(jù)寫入寄存器1beginif wr_enable139。 寫禁止end if。 寫允許else wr_enable1=39。end process。thenlatch_addres = p0。event and ale =39。signal wr_enable2 : std_logic。signal latch_in1 : std_logic_vector(7 downto 0)。signal latch_out1 : std_logic_vector(7 downto 0)。 鎖存輸出數(shù)據(jù)2end mcs51。 讀回鎖存信號datout1: out std_logic_vector(7 downto 0)。 A/D器件片選信號datain1: in std_logic_vector(7 downto 0)。 地址鎖存ready: in std_logic。 高8位地址線rd,wr : in std_logic。entity mcs51 isport( 與MCS51接口的各端口定義 p0 : inout std_logic_vector(7 downto 0)。參考文獻(xiàn)[1] 鄭鳳濤,2003,38(1):25~30[2] 徐志軍,徐光輝. CPLD/FPGA的開發(fā)與應(yīng)用. 北京:電子工業(yè)出版社,2002: 192~272[3] 黃正謹(jǐn),徐堅,:電子工業(yè)出版社,2002:93~209[4] 韓素敏,2003,19(4):8~10 [5] 陳新原,2005,(2):24~26 [6] 畢紅軍,(DDS).現(xiàn)代電子技術(shù),2002,(11):91~93 [7] 姜萍,王建新,28(5):43~47 [8] 邵正途,2005,(1): 82~84[9] 譚建軍,楊慶. EWB與電子技術(shù)基礎(chǔ)課程設(shè)計. 北京:中央民族大學(xué)出版社,2002:228~236[10周正干,李和平,2000(1):9~11 [11]周峻峰,2003,(1):4~6 [12]宋躍,周明輝,2002,(1):29~31[13]陳輝,2001(12):24~27[14]AD公司.A Technical Tutorial On Digital Signal Synthesis,1999:2~8[15]IEEE Direct_Digital synthesizer with Improved spectral performance. on munication,1991,39(7):16~20[16]傅玉朋,李明浩, 2004,6(3):46~47 [17](2001).北京:北京理工大學(xué)出版社,2003:1~40[18],2004,(5): 42~43 [19] III analysis of the output spectrum of Direct Digital Frequency Synthesizers in the presence of phase accumulator truncation,IEEE AFCS,1999:495~502[20]:清華大學(xué)出版社,2003:50~220[21]Vankka reduction techniques in sine output direct digital synthesis,IEEE AFCS,2001:951~959[22] Altera corporation, 2001:24~31[23]鄒軼才,2005, (2):79~80[24]賈方亮,趙泳,郝立果,2004,14(2):23~25 [25]王皓,劉克剛,2004(9):22~25附錄 1鍵盤與顯示電路圖附錄2FPGA與MCS_51系列單片機(jī)(8051)總線方式接口的VHDL電路設(shè)計:8051與FPGA總線方式接口邏輯外部引腳library ieee。他們給我提供了一個寫作、實驗的良好環(huán)境,并提出了許多寶貴意見使我的論文得以順利完成。在論文的寫作期間,黃老師在百忙之中抽出時間指導(dǎo)我的論文寫作,在很多關(guān)鍵的知識點上進(jìn)行了講解疏通,給我論文寫作的宏觀框架提出了寶貴的意見,特別是由于我今年忙完其他事情后,論文寫作的時間比較倉儲,為了能夠順利完成論文的寫作,黃慶老師特別為我們安排了實驗室作為論文的寫作平臺。特別是在信息技術(shù)飛速發(fā)展的今天,各種電子產(chǎn)品層出不窮,各種技術(shù)與方法也在不斷地改善,因此對電子技術(shù)知識的學(xué)習(xí)也應(yīng)不斷地充實和更新,以適應(yīng)工作與社會的需要。經(jīng)系統(tǒng)仿真表明,本設(shè)計可達(dá)到預(yù)定要求,應(yīng)用方便靈活。設(shè)計采用直接數(shù)字頻率合成技術(shù)設(shè)計了雙通道相位關(guān)系可調(diào)的信號發(fā)生器,輸出信號頻率范圍為0~20KHz,頻率分辨率高于20Hz,相位調(diào)節(jié)步進(jìn)1176。設(shè)計以FPGA為核心,詳細(xì)闡述了FPGA內(nèi)部實現(xiàn)的功能及VHDL程序設(shè)計仿真,但由于軟件版本的限制,部分模塊無法實現(xiàn)仿真。通過對單片機(jī)、FPGA芯片的使用及對VHDL硬件描述語言學(xué)習(xí),讓我感到了VHDL硬件描述語言及單片機(jī)的方便性和靈活性,可以使編程技能快速提高,并且認(rèn)識到很多新的設(shè)計思想。在本設(shè)計中,波形編輯的第一步就是進(jìn)行CPU頻率選擇,選擇最高頻和最低頻作為粗調(diào),在用鍵盤和中斷進(jìn)行微調(diào),以便達(dá)到所需的頻率、相位及其幅值。默認(rèn)的fc、。而DDS系統(tǒng)及其與單片機(jī)的接口部分用VHDL語言寫。而FPGA的使用使單片機(jī)的程序大大簡化。DDFS中的分頻、。波形存儲器設(shè)計主要考慮的問題是其容量的大小,利用波形幅值的奇、偶對稱特性,可以節(jié)省3/4的資源,這是非??捎^的。相位累加器調(diào)用lmp_add_sub加減法器模塊,相位累加器設(shè)計的好壞將直接影響到整個系統(tǒng)的速度,采用流水線技術(shù)能大幅度地提升速度。它以DAC0832的輸出接到D/A轉(zhuǎn)換的參考電壓(Vref)輸入端作為基準(zhǔn)電壓源輸入[25],其輸出波形的幅度為:V= Vref。 頻率分辨率定義為: Δf=fc/=20HZ 由于FPGA的工作電壓為5V,所以幅度分辨率為:Adiv=5/2=,故都能達(dá)到指標(biāo)要求。要達(dá)到相位調(diào)節(jié)步進(jìn)1176。所以,其相位差調(diào)節(jié)分辨率為:360176。給相位累加器預(yù)置的累加初值K(加在相位累加器的高A位),兩路輸出信號的相位差與累加初值 K的關(guān)系為:θ=(K/2)/360176。且的取值受到D/A轉(zhuǎn)換速率的限制,因D/A轉(zhuǎn)換器AD7521的轉(zhuǎn)換速率為500ns,即頻率為2MHZ。又因為相位增量寄存器為10位,則由()式得最高輸出頻率為:=最低輸