




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、20132014學(xué)年第三學(xué)期數(shù)字電子技術(shù)課程設(shè)計任務(wù)書(適用專業(yè):電氣12級、自動化12級、勘查(卓越)12級) 專業(yè)班級 姓 名 學(xué) 號 開課系室 設(shè)計日期 一、設(shè)計任務(wù)及要求1、設(shè)計任務(wù)及原理:交通燈的顯示有很多方式,如十字路口、丁字路口等,而對于同一個路口又有很多不同的顯示要求,比如十字路口,車輛如果只要東西和南北方向通行就很簡單,而如果車子可以左右轉(zhuǎn)彎的通行就比較復(fù)雜。要完成本實(shí)驗,首先必須了解交通路燈的燃滅規(guī)律。本實(shí)驗需要用到實(shí)驗箱上交通燈模塊中的發(fā)光二極管,即紅、黃、綠各四個。依人們的交通常規(guī),“紅燈停,綠燈行,黃燈提醒”。其交通燈的燃滅規(guī)律為:東西路口的綠燈亮,南北路口的紅燈亮,
2、東西方向通車,延時一段時間后,東西路口綠燈閃爍,紅燈亮(表示左轉(zhuǎn)彎),再延時一段時間后,黃燈開始閃爍。閃爍若干次后,東西路口紅燈亮,而同時南北路口的綠燈亮,南北方向開始通車,延時一段時間后,南北路口的綠燈閃爍,紅燈亮(表示左轉(zhuǎn)彎),再延時一段時間后,黃燈開始閃爍。閃爍若干次后,再切換到東西路口方向,重復(fù)上述過程。在實(shí)驗中使用4個七段碼管中的任意兩個數(shù)碼管顯示時間。東西路和南北路的通車時間均設(shè)定為20s(其中,綠燈亮?xí)r間為10s,綠燈閃爍時間為5s,黃燈閃爍時間為5s)。數(shù)碼管的時間總是顯示為20、19、18、172、1、0、20、19、18。在顯示時間小于等于5秒的時候,通車方向的黃燈閃爍。在
3、東西向綠燈期間,點(diǎn)陣顯示自己的姓名;在南北向綠燈期間,點(diǎn)陣顯示自己的學(xué)號后3位。2、擴(kuò)展要求:a.利用一個開關(guān)將0-20s擴(kuò)展為0-30s(30-10s之間綠燈亮,其他與基本要求相同);b.增加交警控制模塊:用一個開關(guān)切換自動模式(上述情況屬于自動模式)和人工模式(交警控制模式):用4個開關(guān)分別實(shí)現(xiàn)東西向通行(東西向綠燈亮,南北向紅燈亮,沒有時間限制),實(shí)現(xiàn)南北向通行(南北向綠燈亮,東西向紅燈亮,沒有時間限制),實(shí)現(xiàn)東西向左轉(zhuǎn)彎(東西向綠燈閃爍,東西向紅燈亮,南北向紅燈亮,沒有時間限制),實(shí)現(xiàn)南北向通行(南北向綠燈閃爍,南北向紅燈亮,東西向紅燈亮,沒有時間限制)。3、具體要求:本實(shí)驗要完成任務(wù)
4、就是設(shè)計一個簡單的交通燈控制器,交通燈顯示用實(shí)驗箱的交通燈模塊和七段碼管中的任意兩個來顯示。系統(tǒng)時鐘選擇時鐘模塊的50MHz時鐘,黃燈和綠燈閃爍時鐘要求為2Hz,七段碼管的時間顯示為1Hz脈沖,即每1s中遞減一次。在東西向綠燈期間,點(diǎn)陣顯示自己的姓名;在南北向綠燈期間,點(diǎn)陣顯示自己的學(xué)號后3位。顯示方式:1秒顯示一個漢字或者一個數(shù)字(漢字和數(shù)字均靜止不動,即不循環(huán)),然后全暗1秒,然后再顯示一個漢字或者一個數(shù)字,以此類推。二、輸入輸出資源說明:1、外部輸入脈沖信號時鐘源CP(50MHz),經(jīng)適當(dāng)分頻后供計數(shù)器使用。2、輸出2組顯示譯碼信號(每組7個輸出端),分別接到外部的兩個七段數(shù)碼管M1、M
5、2上,M1和M2分別顯示倒計時的十位和個位。3、輸出6個高低電平信號,分別接到外部的6個指示縱向、橫向的LED燈。(輸出高電平時,對應(yīng)的LED燈亮)其具體框圖如下:1Hz縱向指示燈LED1控制器計數(shù)器(倒計時;通車時間倒計時)七段LED數(shù)碼管顯示(2個)50MHz縱向指示燈LED3橫停指示燈LED6縱向指示燈LED2橫向指示燈LED5橫向指示燈LED4CLK顯示姓名或者學(xué)號圖1 交通燈控制電路結(jié)構(gòu)框圖根據(jù)如上說明,本設(shè)計的主要任務(wù)和設(shè)計要求是:1、按照現(xiàn)代數(shù)字系統(tǒng)的Top-Down模塊化設(shè)計方法,提出交通燈控制電路設(shè)計系統(tǒng)的整體設(shè)計方案,并進(jìn)行正確的功能劃分,分別提出并實(shí)現(xiàn)控制器、計數(shù)器、輸出
6、譯碼、點(diǎn)陣顯示等模塊化子系統(tǒng)的設(shè)計方案。2、在Quartus的EDA設(shè)計環(huán)境中,完成系統(tǒng)的頂層設(shè)計、各子系統(tǒng)的模塊化設(shè)計。分別完成各個基于Verilog語言實(shí)現(xiàn)的子模塊(包括控制器電路、計數(shù)器電路、輸出譯碼電路、點(diǎn)陣顯示電路)的邏輯功能仿真。最后對頂層設(shè)計進(jìn)行功能仿真。 3、在2步的基礎(chǔ)上,用下載電纜通過JTAG口將對應(yīng)的sof文件加載到FPGA中。觀察實(shí)驗結(jié)果是否與自己的編程思想一致。三、電路子模塊的設(shè)計與仿真 根據(jù)設(shè)計要求及原理,我所設(shè)計的交通燈控制電路主要包含四個子模塊,分別是:分頻器、倒計時計數(shù)器、點(diǎn)陣顯示器、控制器。1、分頻器1)Verilog 源文件module fenpinqi(
7、clk,clk1,clk2,clk1000);input clk;output clk1,clk2,clk1000;reg 31:0cnt1,cnt2,cnt3;reg clk1,clk2,clk1000;initialbegin clk1=0; clk2=0; clk1000=0; cnt1=0; cnt2=0; cnt3=0;endalways(posedge clk) begin if(cnt1=24999999)beginclk1<=clk1;cnt1<=0;endelse begin cnt1<=cnt1+1; endif(cnt2=12499999)begincl
8、k2<=clk2;cnt2<=0;endelse begin cnt2<=cnt2+1; endif(cnt3=24999)beginclk1000<=clk1000;cnt3<=0;endelse begin cnt3<=cnt3+1; endendendmodule2)仿真文件3)功能仿真波形1hz和2hz的頻率過低,無法仿真。2、倒計時計數(shù)器1)Verilog 源文件module daojishi(clk1,k,seq1,seq2,ji,out);/ji記錄循環(huán)次數(shù),out輸出二進(jìn)制秒數(shù)input clk1,k;output6:0 seq1,seq2;
9、output ji;output4:0out;reg6:0 seq1,seq2;reg ji;reg4:0out;parameter Num1=20;parameter Num2=30;integer cnt;initial cnt=0;integer cnt1;initial cnt1=0;always(posedge clk1)begin if(k=0) begin if(cnt=0) begin cnt<=20; cnt1=cnt1+1; end else begin cnt=cnt-1; end end else if(cnt=0) begin cnt<=30; cnt1=
10、cnt1+1; end else begincnt=cnt-1; endendalways(cnt)begincase(cnt%10)0:seq1=7'b0000001;1:seq1=7'b1001111;2:seq1=7'b0010010;3:seq1=7'b0000110;4:seq1=7'b1001100;5:seq1=7'b0100100;6:seq1=7'b0100000;7:seq1=7'b0001111;8:seq1=7'b0000000;9:seq1=7'b0000100;endcaseendalw
11、ays(cnt)begincase(cnt-(cnt%10)/10)0:seq2=7'b0000001;1:seq2=7'b1001111;2:seq2=7'b0010010;3:seq2=7'b0000110;4:seq2=7'b1001100;5:seq2=7'b0100100;6:seq2=7'b0100000;7:seq2=7'b0001111;8:seq2=7'b0000000;9:seq2=7'b0000100;endcaseendalways(cnt)beginout=cnt;/shuendalway
12、s(cnt1)begincase(cnt1%2)0:ji=0;/oushu1:ji=1;/jishuendcaseendendmodule2)仿真文件3)功能仿真波形3、點(diǎn)陣顯示器1)Verilog源文件input clk1000,we,ns,k;input4:0shu;output 15:0 r,c;reg15:0 r,c;integer cnt1;initial cnt1=0;always(posedge clk1000)begincnt1=cnt1+1;if(k=0)beginif(we=0)beginif(shu=20|shu=14)/史beginif (cnt1%16=0)begin
13、c=16'b0000000100000000; r=16'b0111111111111111;end else if(cnt1%16=1) beginc=16'b0000000100000000;r=16'b1011111111111111; endelse if(cnt1%16=2) beginc=16'b0011111111111000;r=16'b1101111111111111;endelse if(cnt1%16=3)beginc=16'b0010000100001000;r=16'b1110111111111111;e
14、ndelse if(cnt1%16=4)beginc=16'b0010000100001000;r=16'b1111011111111111;endelse if(cnt1%16=5)beginc=16'b0010000100001000;r=16'b1111101111111111;end else if(cnt1%16=6)beginc=16'b0010000100001000;r=16'b1111110111111111;end else if(cnt1%16=7)beginc=16'b0011111111111000;r=16
15、39;b1111111011111111;endelse if(cnt1%16=8)beginc=16'b0000000100000000;r=16'b1111111101111111;endelse if(cnt1%16=9)beginc=16'b0001000100000000;r=16'b1111111110111111;end else if(cnt1%16=10)beginc=16'b0000101000000000;r=16'b1111111111011111;end else if(cnt1%16=11)beginc=16'
16、b0000011000000000;r=16'b1111111111101111;end else if(cnt1%16=12)beginc=16'b0000100110000000;r=16'b1111111111110111;endelse if(cnt1%16=13)beginc=16'b0001000001100000;r=16'b1111111111111011;endelse if(cnt1%16=14)beginc=16'b0010000000011000;r=16'b1111111111111101;endelsebegi
17、nc=16'b1100000000000111;r=16'b1111111111111110; end endelse if(shu=18|shu=12)/育beginif (cnt1%16=0) beginc=16'b0000000100000000;r=16'b011111111111111111; endelse if(cnt1%16=1)beginc=16'b0000000010000000;r=16'b1011111111111111;endelse if(cnt1%16=2)beginc=16'b011111111111111
18、1;r=16'b1101111111111111;endelse if(cnt1%16=3)begin module xianshi(shu,clk1000,we,ns,k,r,c);c=16'b0000010000000000;r=16'b1110111111111111;endelse if(cnt1%16=4)beginc=16'b0000100000001000;r=16'b1111011111111111;endelse if(cnt1%16=5)beginc=16'b0001111111111100;r=16'b1111101
19、111111111;endelse if(cnt1%16=6)beginc=16'b0000000000000100;r=16'b1111110111111111;endelse if(cnt1%16=7)beginc=16'b0000111111111000;r=16'b1111111011111111;endelse if(cnt1%16=8)beginc=16'b0000100000001000;r=16'b1111111101111111;endelse if(cnt1%16=9)beginc=16'b00001111111110
20、00;r=16'b1111111110111111;endelse if(cnt1%16=10)beginc=16'b0000100000001000;r=16'b1111111111011111;endelse if(cnt1%16=11)beginc=16'b0000111111111000;r=16'b1111111111101111;endelse if(cnt1%16=12)beginc=16'b0000100000001000;r=16'b1111111111110111;endelse if(cnt1%16=13)begin
21、c=16'b0000100000001000;r=16'b1111111111111011;endelse if(cnt1%16=14)beginc=16'b0000100000101000;r=16'b1111111111111101;endelse beginc=16'b0000100000010000;r=16'b1111111111111110;endendelse if(shu=16)/銘beginif (cnt1%16=0)beginc=16'b0000100000100000;r=16'b01111111111111
22、11; endelse if(cnt1%16=1)beginc=16'b0000100000100000;r=16'b1011111111111111;endelse if(cnt1%16=2)beginc=16'b0001111001111110;r=16'b1101111111111111;endelse if(cnt1%16=3)beginc=16'b0001000010000010;r=16'b1110111111111111;endelse if(cnt1%16=4)beginc=16'b0010000101000100;r=1
23、6'b1111011111111111;endelse if(cnt1%16=5)beginc=16'b0101111000101000;r=16'b1111101111111111;endelse if(cnt1%16=6)beginc=16'b0000100000010000;r=16'b1111110111111111;endelse if(cnt1%16=7)beginc=16'b0000100000100000;r=16'b1111111011111111;endelse if(cnt1%16=8)beginc=16'b
24、0111111001000000;r=16'b1111111101111111;endelse if(cnt1%16=9)beginc=16'b0000100011111110;r=16'b1111111110111111;endelse if(cnt1%16=10)beginc=16'b0000100101000010;r=16'b1111111111011111;endelse if(cnt1%16=11)beginc=16'b0000100001000010;r=16'b1111111111101111;endelse if(cnt
25、1%16=12)beginc=16'b0000101001000010;r=16'b1111111111110111;endelse if(cnt1%16=13)beginc=16'b0000110001000010;r=16'b1111111111111011;endelse if(cnt1%16=14)beginc=16'b0000100001111110;r=16'b1111111111111101;endelsebeginc=16'b0000000001000010;r=16'b1111111111111110;end e
26、nd else/暗 beginc=16'b0000000000000000;r=16'b1111111111111111;endendendif(ns=1)beginif(shu=20|shu=14)/4beginif (cnt1%16=0)beginc=16'b0000000001100000;r=16'b0111111111111111;endelseif(cnt1%16=1)beginc=16'b0000000011100000;r=16'b1011111111111111;endelse if(cnt1%16=2)beginc=16
27、9;b0000000110110000;r=16'b1101111111111111;endelse if(cnt1%16=3)beginc=16'b0000001100110000;r=16'b1110111111111111;endelse if(cnt1%16=4)beginc=16'b0000011000110000;r=16'b1111011111111111;endelse if(cnt1%16=5)beginc=16'b0000011000110000;r=16'b1111101111111111;endelse if(cn
28、t1%16=6)beginc=16'b0000110000110000;r=16'b1111110111111111;endelse if(cnt1%16=7)beginc=16'b0001100000110000;r=16'b1111111011111111;endelse if(cnt1%16=8)beginc=16'b0011100000110000;r=16'b1111111101111111;endelse if(cnt1%16=9)beginc=16'b0011000000110000;r=16'b1111111110
29、111111;endelse if(cnt1%16=10)beginc=16'b0110000000110000;r=16'b1111111111011111;endelse if(cnt1%16=11)beginc=16'b0111111111111110;r=16'b1111111111101111;endelse if(cnt1%16=12)beginc=16'b0111111111111110;r=16'b1111111111110111;endelseif(cnt1%16=13)beginc=16'b00000000001100
30、00;r=16'b1111111111111011;endelse if(cnt1%16=14)beginc=16'b0000000000110000;r=16'b1111111111111101;endelsebeginc=16'b0000000011111000;r=16'b1111111111111110;endendelse if(shu=18|shu=12)/'0beginif (cnt1%16=0)beginc=16'b0000001111100000;r=16'b0111111111111111;endelse if
31、(cnt1%16=1)beginc=16'b0000011111110000;r=16'b1011111111111111;endelse if(cnt1%16=2)beginc=16'b0000110000011000;r=16'b1101111111111111;endelse if(cnt1%16=3)beginc=16'b0001100000001100;r=16'b1110111111111111;endelse if(cnt1%16=4)beginc=16'b0001100000001100;r=16'b1111011
32、111111111;endelse if(cnt1%16=5)beginc=16'b0001100000001100;r=16'b1111101111111111;endelse if(cnt1%16=6)beginc=16'b0001100000001100;r=16'b1111110111111111;endelse if(cnt1%16=7)beginc=16'b0001100000001100;r=16'b1111111011111111;endelse if(cnt1%16=8)beginc=16'b00011000000011
33、00;r=16'b1111111101111111;endelse if(cnt1%16=9)beginc=16'b0001100000001100;r=16'b1111111110111111;endelse if(cnt1%16=10)beginc=16'b0001100000001100;r=16'b1111111111011111;endelse if(cnt1%16=11)beginc=16'b0001100000001100;r=16'b1111111111101111;endelse if(cnt1%16=12)beginc
34、=16'b0001100000001100;r=16'b1111111111110111;endelse if(cnt1%16=13)beginc=16'b0000110000011000;r=16'b1111111111111011;endelse if(cnt1%16=14)beginc=16'b0000011111110000;r=16'b1111111111111101;endelsebeginc=16'b0000001111100000;r=16'b1111111111111110;endendelse if(shu=1
35、6)/4beginif (cnt1%16=0)beginc=16'b0000000001100000;r=16'b0111111111111111;endelseif(cnt1%16=1)beginc=16'b0000000011100000;r=16'b1011111111111111;endelse if(cnt1%16=2)beginc=16'b0000000110110000;r=16'b1101111111111111;endelse if(cnt1%16=3)beginc=16'b0000001100110000;r=16
36、39;b1110111111111111;endelse if(cnt1%16=4)beginc=16'b0000011000110000;r=16'b1111011111111111;endelse if(cnt1%16=5)beginc=16'b0000011000110000;r=16'b1111101111111111;endelse if(cnt1%16=6)beginc=16'b0000110000110000;r=16'b1111110111111111;endelse if(cnt1%16=7)beginc=16'b000
37、1100000110000;r=16'b1111111011111111;endelse if(cnt1%16=8)beginc=16'b0011100000110000;r=16'b1111111101111111;endelse if(cnt1%16=9)beginc=16'b0011000000110000;r=16'b1111111110111111;endelse if(cnt1%16=10)beginc=16'b0110000000110000;r=16'b1111111111011111;endelse if(cnt1%16
38、=11)beginc=16'b0111111111111110;r=16'b1111111111101111;endelse if(cnt1%16=12)beginc=16'b0111111111111110;r=16'b1111111111110111;endelseif(cnt1%16=13)beginc=16'b0000000000110000;r=16'b1111111111111011;endelse if(cnt1%16=14)beginc=16'b0000000000110000;r=16'b111111111111
39、1101;endelsebeginc=16'b0000000011111000;r=16'b1111111111111110;endendelse/暗beginc=16'b000000000000000;r=16'b1111111111111111;endendendendmodule2)仿真文件3)功能仿真波形由于仿真波形較長,只截取了其中一部分,可以看出這部分顯示的是我的學(xué)號404中的44、控制器1)Verilog源文件module kongzhiqi(clk,k,k1,k2,k3,k4,k5,shu,y1,y2,r1,r2,g1,g2,gs1,gs2);i
40、nput clk,k,k1,k2,k3,k4,k5;input4:0shu;output y1,y2,r1,r2,g1,g2,gs1,gs2;reg y1,y2,r1,r2,g1,g2,gs1,gs2;nitial beginr1<=1;r2<=1;y1<=0;y2<=0;g1<=0;g2<=0;gs1<=0;gs2<=0;endalways(posedge clk)beginif(k1=0)/k1=0是自動控制模式beginif(k=0)/東西向begin if(shu>10)/東西方向通車beging1<=1;g2<=0;r1<=0;r2<=1;y1<=0;y2<=0;gs1<=0;gs2<=0;endelse if(shu<=10&a
溫馨提示
- 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 醫(yī)療用品行業(yè)市場準(zhǔn)入政策考核試卷
- 光纜行業(yè)供應(yīng)鏈管理考核試卷
- 成人高等教育材料力學(xué)與工程應(yīng)用考核試卷
- 壓力敏感合成材料制造技術(shù)與應(yīng)用考核試卷
- 機(jī)織服裝國際貿(mào)易法規(guī)與慣例考核試卷
- 數(shù)字內(nèi)容版權(quán)監(jiān)測與維權(quán)策略考核試卷
- 青島沃爾沃購車合同范本
- 中介渠道合作合同范本
- 藝人標(biāo)準(zhǔn)解約合同范本
- 酒店訂制家具合同范本
- GB/T 1346-2024水泥標(biāo)準(zhǔn)稠度用水量、凝結(jié)時間與安定性檢驗方法
- 2025年江蘇信息職業(yè)技術(shù)學(xué)院高職單招職業(yè)適應(yīng)性測試近5年??及鎱⒖碱}庫含答案解析
- 易制毒化學(xué)品理論考試試題及答案
- 2024年煙臺汽車工程職業(yè)學(xué)院高職單招職業(yè)適應(yīng)性測試歷年參考題庫含答案解析
- 2024年江西旅游商貿(mào)職業(yè)學(xué)院高職單招語文歷年參考題庫含答案解析
- IIT臨床醫(yī)學(xué)項目管理
- 藥品網(wǎng)絡(luò)交易服務(wù)三方平臺質(zhì)量管理體系文件-B2B平臺(完整版)
- 《森林調(diào)查技術(shù)》課件(上)
- 環(huán)衛(wèi)車輛操作及維護(hù)培訓(xùn)方案
- 醫(yī)療器械質(zhì)量負(fù)責(zé)人崗位職責(zé)
- 湘陰縣易聚餐飲有限公司部門備用金業(yè)務(wù)財務(wù)融合流程設(shè)計
評論
0/150
提交評論