串行口數(shù)據(jù)傳輸?shù)姆抡婕坝布?shí)現(xiàn).docx_第1頁
串行口數(shù)據(jù)傳輸?shù)姆抡婕坝布?shí)現(xiàn).docx_第2頁
串行口數(shù)據(jù)傳輸?shù)姆抡婕坝布?shí)現(xiàn).docx_第3頁
串行口數(shù)據(jù)傳輸?shù)姆抡婕坝布?shí)現(xiàn).docx_第4頁
串行口數(shù)據(jù)傳輸?shù)姆抡婕坝布?shí)現(xiàn).docx_第5頁
已閱讀5頁,還剩15頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、串行口數(shù)據(jù)傳輸?shù)姆抡婕坝布?shí)現(xiàn)學(xué)院:信息與通信工程學(xué)院專業(yè):通信工程班級:2008211110姓名:潘東陽、王澎濤序號(hào):12一、 總體方案框圖電路總體分為7個(gè)模塊:時(shí)鐘電路模塊、字符發(fā)生器模塊、串/并轉(zhuǎn)換模塊、字符檢測電路模塊、控制電路模塊、鎖存顯示模塊和顯示電路模塊。各模塊間的輸入輸出數(shù)據(jù)流如圖所示。二、 各部分電路的數(shù)字邏輯設(shè)計(jì)過程和結(jié)果1 時(shí)鐘電路模塊:實(shí)驗(yàn)室所提供的晶振的時(shí)鐘頻率為1MHz,若直接使用人眼將無法正常觀測出實(shí)驗(yàn)結(jié)果。所以需要設(shè)計(jì)分頻模塊,將1MHz的時(shí)鐘頻率通過分頻器降低到約2Hz,這樣才可以正確顯示結(jié)果。本次實(shí)驗(yàn)使用74LS163四位同步計(jì)數(shù)器級聯(lián)實(shí)現(xiàn)分頻功能。每個(gè)74

2、LS163最多為24=16分頻。為了實(shí)現(xiàn)本實(shí)驗(yàn)分頻的要求,分頻系數(shù)應(yīng)該達(dá)到:106÷2=5×105219。所以需要5塊74LS163芯片級聯(lián)實(shí)現(xiàn)分頻,所得頻率為1MHz/219=1.9Hz具體電路圖如下:2 字符發(fā)生器模塊:本次試驗(yàn)要求發(fā)送端產(chǎn)生信息碼為111100010011010這個(gè)15位循環(huán)碼。字符發(fā)生模塊使用由D觸發(fā)器構(gòu)成移位寄存器的序列信號(hào)發(fā)生器。由于循環(huán)碼為15位,23<15<24,故至少應(yīng)該使用4位D觸發(fā)器。經(jīng)檢查,此序列所構(gòu)成的15個(gè)4位的序列不重復(fù),剛好可以用4為D觸發(fā)器來做次序列發(fā)生器,D觸發(fā)器選用74LS175四D觸發(fā)器。狀態(tài)轉(zhuǎn)移表:Q4Q

3、3Q2Q1D111101110011000100010001000100010011001100110011011101010101010111011101111卡諾圖:由卡諾圖得:D= Q4Q3,但經(jīng)過檢查,通過此反饋是無法自啟動(dòng)的。通過增加自由項(xiàng),得D= Q4Q3+Q4Q2 Q1。經(jīng)過檢查,此此反饋可以自啟動(dòng)。電路圖如下:3 串/并轉(zhuǎn)換模塊:串并轉(zhuǎn)化的實(shí)現(xiàn)可以通過移位寄存器來實(shí)現(xiàn),因?yàn)樾枰?位并行輸出,所以需要兩塊移位寄存器74LS194級聯(lián)構(gòu)成。電路圖如下:4 并行字符檢測電路模塊:相比于串行字符檢測電路,并行字符檢測電路相對容易。并行字符檢測電路只需要15位數(shù)據(jù)比較器即可,而該比較器可

4、以由兩個(gè)數(shù)據(jù)比較器74LS85級聯(lián)得到。具體電路圖如下:當(dāng)檢測到字符1111000時(shí),輸出一個(gè)高電平,作為控制電路的時(shí)鐘信號(hào)。5 控制電路模塊:控制電路完成的功能比較復(fù)雜。首先,控制電路要保證在檢測到同步碼之前,鎖存器關(guān)閉,沒有任何輸出;其次,在檢測到同步碼之后,字符檢測電路不能對后級有任何影響,而是由控制電路控制每個(gè)7位輸出一次。對于第一個(gè)功能可以使用一塊D觸發(fā)器74LS74接受字符檢測電路的信號(hào),再通過組合邏輯電路使接收到同步碼產(chǎn)生的高電平后此部分電路輸出恒定,對鎖存電路沒有影響;對于第二個(gè)功能,可以由一個(gè)7進(jìn)制計(jì)數(shù)器實(shí)現(xiàn),這里選用同步置位的計(jì)數(shù)器74LS163。具體 如下:6 鎖存顯示模

5、塊:鎖存電路比較簡單,只需要一塊74LS273鎖存芯片就可以。只要把數(shù)據(jù)的七個(gè)輸入端分別連到串并轉(zhuǎn)換的并行輸出端,在把控制電路輸出的控制電路接到時(shí)鐘輸入端即可。具體電路圖如下:7 顯示電路模塊:只要把鎖存器的七個(gè)輸出端接到數(shù)碼管相對應(yīng)的ag管腳就可以。8 串行字符檢測模塊:串行字符檢測需要一位一位檢測,然后每位都符合才輸出信號(hào)。若每位都檢測,將會(huì)使用較多觸發(fā)器,使電路復(fù)雜化。經(jīng)過觀察,同步碼1111000中后四位1000在整個(gè)序列111100010011010中是唯一的,所以檢測1000四位即可。當(dāng)連續(xù)有4位與1000相應(yīng)匹配時(shí),則輸出信號(hào)。狀態(tài)轉(zhuǎn)移圖如下:對A、B、C、D分別編碼為00、01

6、、11、10,則狀態(tài)轉(zhuǎn)移表為:D=0D=1000001011101111000100000輸出為:ZD=0D=10000010011001010卡諾圖分別如下:所以,由卡諾圖可得:D2=Q2n+1=Q1DD1=Q1n+1=Q2 D+Q2 Q1Z=Q2Q1 D由此可得到電路圖:9 糾錯(cuò)模塊:糾錯(cuò)模塊應(yīng)該包含錯(cuò)碼發(fā)生器、檢錯(cuò)模塊和糾錯(cuò)模塊。實(shí)驗(yàn)中錯(cuò)碼發(fā)生器產(chǎn)生的錯(cuò)碼為:111100000011010,通過類似序列發(fā)生器設(shè)計(jì)中的方法可以設(shè)計(jì)出其電路,此處使用同步計(jì)數(shù)器與數(shù)據(jù)選擇器構(gòu)成的信號(hào)發(fā)生器。檢錯(cuò)模塊通過D觸發(fā)器加邏輯門電路可以檢測出是否有錯(cuò)碼,若有,則輸出1。糾錯(cuò)部分接收到檢測部分輸出的1后,

7、與原信號(hào)同一位進(jìn)行異或運(yùn)算,可以將其改為正確碼。此部分電路的難點(diǎn)是同步問題。由于各部分之間的延時(shí)不一定相同,所以最終修改的碼的位置不一定就是錯(cuò)碼的位置。這種問題只能在具體連接電路時(shí)通過加門電路來不斷嘗試來取得同步。具體電路原理圖如下:三、 總體電路原理圖四、 用坐標(biāo)紙畫出下列波形(見坐標(biāo)紙)五、 VHDL程序代碼及注釋串行檢測:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity chuan isport( vcc,clk:in std_logic; output:out std_logi

8、c_vector(6 downto 0);end chuan;architecture tao of chuan is signal signalout: std_logic; signal signalcomposer :integer range 0 to 14; signal signalaccept :std_logic_vector(6 downto 0); signal tmp:integer range 0 to 4999999; signal signaltest: std_logic; signal os: std_logic; signal testout:std_logi

9、c; signal controlcout:std_logic; signal finalout :std_logic_vector(6 downto 0); type state_type is (s0,s1,s2,s3,s4); signal state: state_type; - signal test: std_logic_vector(6 downto 0);beginp0:process(clk) begin if clk'event and clk='1' then if tmp=4999999 then tmp<=0; else tmp<=

10、tmp+1; end if; end if;end process p0;p7:process(tmp)begin if tmp=4999999 then os<='1' else os<='0' end if;end process p7;-p0 and p7 shi fenpin mokuai p1:process(os)begin if os'event and os='1' then if signalcomposer=14 then signalcomposer<=0; else signalcomposer&

11、lt;=signalcomposer+1; end if; end if; case signalcomposer is when 4|5|6|8|9|12|14=>signalout<='0' when others=>signalout<='1' end case;end process p1;-you jishiqi shixian de xulie fashengqip2:process(signalout) begin if os'event and os='1' then signalaccept(6)

12、<=signalaccept(5); signalaccept(5)<=signalaccept(4); signalaccept(4)<=signalaccept(3); signalaccept(3)<=signalaccept(2); signalaccept(2)<=signalaccept(1); signalaccept(1)<=signalaccept(0); signalaccept(0)<=signalout; end if;end process p2;-yicunqi shixian chuanbing zhuanhuanp3:p

13、rocess(signalaccept) begin -if clk'event and clk='1' then finalout<=signalaccept; -end if;end process p3;-shuchup4:process(signalaccept)begin if testout='1' then signaltest<=vcc; controlcout<=vcc; end if;end process p4;-kongzhi shuchup6 :process(os) begin if (os'even

14、t and os='1' )then case state is when s0=>if(signalout='1') then state<=s1; else state<=s0; end if; testout<='0' when s1=>if(signalout='1') then state<=s2; else state<=s0; end if; testout<='0' when s2=>if(signalout='0') then

15、state<=s3; else state<=s2; end if; testout<='0' when s3=>if(signalout='0') then state<=s4; else state<=s2; end if; testout<='0' when s4=>if(signalout='0') then state<=s0; else state<=s2; end if; testout<='1' end case; end if; e

16、nd process p6;-chuanxin jiance 11000p5 :process(signaltest,signalaccept)begin if(signaltest='1') then output<=not signalaccept; end if; end process p5;-jiucuo-p6:process(signalaccept)-begin - case signalaccept is - when "1111000"=>testout<='1' - when others =>te

17、stout<='0' - end case;-end process p6; end tao;并行檢測:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity bing isport( vcc,clk:in std_logic; -clear:in std_logic; - signalout: out std_logic; -testout: out std_logic; - signaltest: out std_logic; - testout,controlco

18、ut :out std_logic; -finalout:out std_logic_vector(6 downto 0); output:out std_logic_vector(6 downto 0);end bing;architecture pan of bing is signal signalout: std_logic; signal signalcomposer :integer range 0 to 14; signal signalaccept :std_logic_vector(6 downto 0); signal tmp:integer range 0 to 5499

19、999; signal signaltest: std_logic; signal os: std_logic; signal testout:std_logic; signal controlcout:std_logic; signal finalout :std_logic_vector(6 downto 0); type state_type is (s0,s1,s2,s3,s4); signal state: state_type; - signal test: std_logic_vector(6 downto 0);begin p0:process(clk) begin if cl

20、k'event and clk='1' then if tmp=5499999 then tmp<=0; else tmp<=tmp+1; end if; end if;end process p0;p7:process(tmp)begin if tmp=5499999 then os<='1' else os<='0' end if;end process p7;-fenpin mokuai p1:process(os)begin if os'event and os='1' then i

21、f signalcomposer=14 then signalcomposer<=0; else signalcomposer<=signalcomposer+1; end if; end if; case signalcomposer is when 4|5|6|8|9|12|14=>signalout<='0' when others=>signalout<='1' end case;end process p1;-xulie fashengqip2:process(signalout) begin if os'e

22、vent and os='1' then signalaccept(6)<=signalaccept(5); signalaccept(5)<=signalaccept(4); signalaccept(4)<=signalaccept(3); signalaccept(3)<=signalaccept(2); signalaccept(2)<=signalaccept(1); signalaccept(1)<=signalaccept(0); signalaccept(0)<=signalout; end if;end process

23、 p2;-yicunqi shixian chuanbing zhuanhuanp3:process(signalaccept) begin -if clk'event and clk='1' then finalout<=signalaccept; -end if;end process p3;-outputp5:process(signalaccept)begin case signalaccept is when "1111000"=>testout<='1' when others =>testout<='0' end case;end process p5;-bingxinjiancetongbuma p4:process(testout)begin if testout='

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論