




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
-9--1-EDA實(shí)驗(yàn)報告交通燈設(shè)計(jì)姓名:張惠洋班級:020915學(xué)號:02091463
EDA實(shí)驗(yàn)報告—交通燈的控制一實(shí)驗(yàn)要求:分兩個方向(1、2),每個方向各有紅(R)、綠(G)、黃(Y)三個交通燈。有自動、手動兩種控制方式。在自動方式下,控制器的狀態(tài)轉(zhuǎn)移表為:狀態(tài) 亮燈 停留時間S0 R1,G2 2秒S1 R1,Y2 1秒S2 G1,R2 2秒S3 Y1,R2 1秒在手動方式下,按下按鈕K0~K3時直接進(jìn)入對應(yīng)序號的狀態(tài),隨后即轉(zhuǎn)入自動方式。交通燈、按鈕分別利用實(shí)驗(yàn)板上的發(fā)光二極管、按鈕。二實(shí)驗(yàn)器材: PC機(jī)一臺、FPGA教學(xué)實(shí)驗(yàn)板一塊三實(shí)驗(yàn)原理與內(nèi)容:1原理 (1)本題中交通燈的狀態(tài)可用有限狀態(tài)機(jī)模型描述。根據(jù)輸出與輸入之間的關(guān)系,有限狀態(tài)機(jī)可以分為兩種類型:Moore和Mealy型。這兩種狀態(tài)機(jī)的區(qū)別在于:Mealy型狀態(tài)機(jī)的輸出由狀態(tài)機(jī)的輸入和狀態(tài)機(jī)的狀態(tài)共同決定;Moore型狀態(tài)機(jī)的輸出僅與狀態(tài)機(jī)的狀態(tài)有關(guān),而與狀態(tài)機(jī)的輸入無關(guān)。本題中的輸出由六個發(fā)光二級光顯示,其狀態(tài)僅與當(dāng)前狀態(tài)機(jī)的狀態(tài)有關(guān),故該題為Moore模型的狀態(tài)機(jī)。下圖為狀態(tài)機(jī)的狀態(tài)表:狀態(tài)表當(dāng)前狀態(tài)下一狀態(tài)輸出K0=0K1=0K2=0K3=0時間未到時間到S0S0S1S2S3S0S1011101S1S0S1S2S3S1S2011110S2S0S1S2S3S2S3101011S3S0S1S2S3S3S0110011狀態(tài)轉(zhuǎn)移圖:S0/011101S2/101011S3/110011S1/011110K3=0/時間未到 K3=0/時間未到S0/011101S2/101011S3/110011S1/011110 K0=0K1=0/時間到 K0=0 K3=0 K0=0/時間到 K2=0/時間到 K3=0 K1=0K3=0/時間未到 k1=0 k2=0/時間未到 K2=0K3=0/時間到K2=0(2)本題中所用到的FPGA芯片為CYCLONEEP1C6Q240C8,時鐘為4M。故用到一個4M的時鐘分頻器。2.程序設(shè)計(jì)組件一:實(shí)體jiaotongdeng的程序libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityjiaotongdengisport( clk:instd_logic; k0 :instd_logic; k1 :instd_logic; k2 :instd_logic; k3 :instd_logic; r1,g1,y1,r2,g2,y2 :outstd_logic );endjiaotongdeng;architecturebehaviorofjiaotongdengis typestate_typeis(s0,s1,s2,s3);——用枚舉類型進(jìn)行狀態(tài)定義 signalcurrent_state,next_state:state_type;——狀態(tài)信號的定義 signalcounter:std_logic_vector(6downto0);begin synch:process——同步單元 begin waituntilclk'eventandclk='1'; counter<=counter; ifcounter<5then counter<=counter+1; else counter<=(others=>'0'); endif; endprocess; process begin waituntilclk'eventandclk='1'; current_state<=next_state; endprocess; state_trans:process(current_state,k0,k1,k2,k3) ——描述每種狀態(tài)下電路表現(xiàn) begin casecurrent_stateis whens0=> ifk0='0'then next_state<=s0; else ifk1='0'then next_state<=s1; else ifk2='0'then next_state<=s2; else ifk3='0'then next_state<=s3; else ifcounter<1then next_state<=s0; else next_state<=s1; endif; endif; endif; endif; endif; whens1=> ifk0='0'then next_state<=s0; else ifk1='0'then next_state<=s1; else ifk2='0'then next_state<=s2; else ifk3='0'then next_state<=s3; else ifcounter<2then next_state<=s1; else next_state<=s2; endif; endif; endif; endif; endif; whens2=> ifk0='0'then next_state<=s0; else ifk1='0'then next_state<=s1; else ifk2='0'then next_state<=s2; else ifk3='0'then next_state<=s3; else ifcounter<4then next_state<=s2; else next_state<=s3; endif; endif; endif; endif; endif; whens3=> ifk0='0'then next_state<=s0; else ifk1='0'then next_state<=s1; else ifk2='0'then next_state<=s2; else ifk3='0'then next_state<=s3; else ifcounter<5then next_state<=s3; else next_state<=s0; endif; endif; endif; endif; endif; endcase; endprocess;ouput:process(current_state) begin——顯示程序 casecurrent_stateis whens0=> r1<='0'; g1<='1'; y1<='1'; r2<='1'; g2<='0'; y2<='1'; whens1=> r1<='0'; g1<='1'; y1<='1'; r2<='1'; g2<='1'; y2<='0'; whens2=> r1<='1'; g1<='0'; y1<='1'; r2<='0'; g2<='1'; y2<='1'; whens3=> r1<='1'; g1<='1'; y1<='0'; r2<='0'; g2<='1'; y2<='1'; endcase; endprocess; endbehavior;組件二:分頻器實(shí)體devide的程序libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitydevideisport(clk:instd_logic;clk_out:outstd_logic);enddevide;architecturearc_devideofdevideissignalcount:std_logic_vector(21downto0);begin process begin waituntilclk'eventandclk='1'; if(count<3999999)then count<=count+1; clk_out<='0'; else count<=(others=>'0'); clk_out<='1'; endif; endprocess; endarchitecturearc_devide;3.實(shí)驗(yàn)連接圖如上圖所示,該交通燈控制系統(tǒng)由兩個實(shí)體組成。實(shí)體clk為4M的時鐘分頻器,clk是輸入口,接的是FPGA產(chǎn)生的時鐘信號,clk_out是輸出口,輸出分頻后的時鐘脈沖。主實(shí)體jiaotongdeng則實(shí)現(xiàn)狀態(tài)機(jī)的狀態(tài)轉(zhuǎn)換邏輯控制。其k0~k3口是輸入口,為手動方式的控制按鈕,r1,r2,g1,g2,y1,y2為六個輸出,控制六個發(fā)光二極管的亮滅。六個發(fā)光二級管的亮滅代表六個狀態(tài)機(jī)的狀態(tài),從而實(shí)現(xiàn)交通燈控制的功能。4.時序波形分析(k0,k1,k2,k3=0)上圖為4個狀態(tài)進(jìn)行轉(zhuǎn)換的時序波形??梢姡╮1,g1,y1,r2,g2,y2)的狀態(tài)轉(zhuǎn)換符合011101》011110》101011》110011》011101》……的順序循環(huán)。(k0=0)上圖為k0=0時的輸出狀態(tài)s0,輸出恒為011101。即亮燈為R1,G2。保持時間2S。
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 中國曲柄銷項(xiàng)目投資可行性研究報告
- 中國切紙鼓輪市場運(yùn)行動態(tài)及行業(yè)投資潛力預(yù)測報告
- 花岡巖石材行業(yè)行業(yè)發(fā)展趨勢及投資戰(zhàn)略研究分析報告
- 2019-2025年中國轉(zhuǎn)移印花行業(yè)市場深度分析及發(fā)展前景預(yù)測報告
- 2025年公路安全設(shè)施制作行業(yè)深度研究分析報告
- 中國麻醉藥行業(yè)市場發(fā)展監(jiān)測及投資戰(zhàn)略咨詢報告
- 2025年獸用制品項(xiàng)目投資可行性研究分析報告
- 年產(chǎn)5000件皮帶輪建設(shè)可行性研究報告申請備案立項(xiàng)
- 2025-2030年中國交通運(yùn)輸備用蓬布行業(yè)深度研究分析報告
- 實(shí)驗(yàn)報告總結(jié)范文5
- 日常零星項(xiàng)目維修項(xiàng)目清單
- 心臟解剖演示文稿
- GB∕T 28575-2020 YE3系列(IP55)三相異步電動機(jī)技術(shù)條件(機(jī)座號63~355)
- 2022醫(yī)院設(shè)備科工作制度
- 【23精品】蘇少小學(xué)美術(shù)三下教案全冊
- 房屋租賃(出租)家私清單
- 倉儲貨架ppt課件
- 《保健按摩師》(五級)理論知識鑒定要素細(xì)目表
- 陳日新腧穴熱敏化艾灸新療法上篇
- PID烙鐵恒溫控制器設(shè)計(jì)與制作_圖文
- wincc全套腳本總結(jié)
評論
0/150
提交評論