【正文】
=xstart。 t16:=0。 txds=39。 t16:=0。 else t16:=t16+1。 bitt:=bitt+1。 end if。 end behavior。beginprocess(clk_in)variable count:integer range 0 to 99。)thenif(count=99)then count:=0。039。end if。仿真采用嵌入在軟件中的SignalTap II。并通過(guò)仿真來(lái)驗(yàn)證我們?cè)诘谌?jié)所設(shè)計(jì)模塊的正確性。由此我們可以判斷,通道選擇控制模塊設(shè)計(jì)成功。第二個(gè)上升沿時(shí)ALE和START變?yōu)榈碗娖剑藭r(shí)ADC0809開(kāi)始模數(shù)轉(zhuǎn)換,同時(shí)檢測(cè)EOC的狀態(tài),當(dāng)其為高電平時(shí)表示轉(zhuǎn)換結(jié)束,所以在第三次和第四次上升沿OE均輸出高電平,第四個(gè)上升沿時(shí)ADC0809將轉(zhuǎn)換好的數(shù)據(jù)傳給fpga,因此我們看到這時(shí)DOUT為71H。由通信協(xié)議我們知道:下位機(jī)頻率與上位機(jī)波特率要對(duì)應(yīng)。最后我們將設(shè)計(jì)好的頂層綜合編譯,通過(guò)下載器下載到目標(biāo)板上,經(jīng)測(cè)試表明,本次設(shè)計(jì)所設(shè)定的要求基本得以實(shí)現(xiàn)。經(jīng)過(guò)幾次調(diào)試后修改,終于得到了讓我們比較滿意的結(jié)果。在做計(jì)算機(jī)課程設(shè)計(jì)的過(guò)程中,必須做到有一個(gè)大綱,做到各個(gè)模塊的功能的實(shí)現(xiàn),這樣才容易實(shí)現(xiàn)整個(gè)的功能的實(shí)現(xiàn)。但是依然要感謝我的指導(dǎo)老師柴老師,組員以及各位同學(xué)的幫助。還有吳青云同學(xué),他是一個(gè)虛心接受別人建議的組員,我們合作很愉快,希望以后還有一起做課程設(shè)計(jì)或?qū)W習(xí)的機(jī)會(huì)。use 。 發(fā)送十六進(jìn)制代碼 bclk:in std_logic。 發(fā)送端end transfer。 signal tx_reg:std_logic_vector(9 downto 0)。 txbuf amp。 process(bclk,reset,w_en,txbuf) variable t16:integer range 0 to 3:=0。 then state=xidle。139。 when xstart = if t16=2 then 計(jì)數(shù)器到16就狀態(tài)跳轉(zhuǎn)到輸出狀態(tài) state=xshift。 end if。 bitt:=0。 t16 :=0。 when xshift= txds=tx_reg(bitt)。 end case。 輸出數(shù)據(jù) end process。entity fenpin500 isport( clk_in:in std_logic。beginprocess(clk_in)variable count:integer range 0 to 1249。)thenif(count=1249)then count:=0。039。end if。use 。architecture one of fenpin100 is after fen pin ,the period is 2us(500khz) constant m:integer:=50。139。if(countm)thenclk_out=39。end if。library ieee。end fenpin。event and clk_in=39。end if。139。end one。entity address is port( clk:in std_logic。 begin if clk39。 else q:=q+1。end process。USE 。 DOUT:OUT STD_LOGIC_VECTOR(7 DOWNTO 0))。 SIGNAL LOCK:STD_LOGIC。039。139。 WHEN st1=ALE=39。LOCK=39。next_state=st2。039。039。 ELSE next_state=st2。START=39。OE=39。039。139。 WHEN OTHERS=next_state=st0。EVENT AND CLK=39。END PROCESS REG。EVENT THEN DOUT=REG_0。20。END PROCESS LATCH1。139。) THEN current_state=next_state。END PROCESS COM。139。039。next_state=st4。LOCK=39。 WHEN st3=ALE=39。139。039。039。OE=39。START=39。039。039。 BEGIN REG_0=D。 ARCHITECTURE behav OF AD_CTRL IS TYPE states is (st0,st1,st2,st3,st4)。 D:IN STD_LOGIC_VECTOR(7 DOWNTO 0)。LIBRARY IEEE。 end if。139。end 。use 。end if。039。)thenif(count=9999)then count:=0。beginprocess(clk_in)variable count:integer range 0 to 9999。entity fenpin isport( clk_in:in std_logic。end process。elseclk_out=39。elsecount:=count+1。if system clock is 20MHz,then 20000 fenpinbeginif(clk_in39。 clk_out:out std_logic )。end one。139。end if。event and clk_in=39。end fenpin500。library ieee。 end if。 輸出數(shù)據(jù)位的序號(hào)自動(dòng)加1 state=xwait。 state=xwait。 else state=xshift。039。 else t16:=t16+1。 跳轉(zhuǎn)到發(fā)送初始位狀態(tài) else state=xidle。139。 控制發(fā)送位數(shù) begin if rising_edge(bclk) then if reset=39。039。139。 狀態(tài)機(jī) signal state : state_type:=xidle。 復(fù)位 w_e