




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、數(shù)字電子電路綜合實(shí)驗(yàn)題目: LED點(diǎn)陣風(fēng)扇的設(shè)計(jì)與實(shí)現(xiàn)實(shí)驗(yàn)報(bào)告學(xué)號(hào): 姓名: 班級(jí): 專(zhuān)業(yè): 通信工程學(xué)院:信息與通信工程學(xué)院指導(dǎo)老師: 2015年11月7日LED點(diǎn)陣風(fēng)扇的設(shè)計(jì)與實(shí)現(xiàn)一、實(shí)驗(yàn)要求基本要求:1.用8×8點(diǎn)陣模擬風(fēng)扇轉(zhuǎn)動(dòng),并用雙色點(diǎn)陣顯示。2.風(fēng)扇轉(zhuǎn)動(dòng)方式包括四個(gè)點(diǎn)陣顯示狀態(tài),并按順序循環(huán)顯示。風(fēng)扇轉(zhuǎn)動(dòng)速度根據(jù)環(huán)境溫度分為4檔,其中1檔的四個(gè)顯示狀態(tài)之間的切換時(shí)間為2秒,2檔為1秒,3檔為0.5秒,4檔為靜止不動(dòng)。3.環(huán)境溫度通過(guò)2個(gè)BTN按鍵設(shè)置,一個(gè)用來(lái)增加,一個(gè)用來(lái)減少,溫度范圍可設(shè)置范圍為1040,溫度精度為1,并用兩個(gè)數(shù)碼管進(jìn)行溫度顯示,風(fēng)扇根據(jù)不同的溫度自動(dòng)
2、采用不同的轉(zhuǎn)動(dòng)速度,其中2024對(duì)應(yīng)1檔,2529對(duì)應(yīng)2檔,3040對(duì)應(yīng)3檔,1019對(duì)應(yīng)4檔,用一個(gè)數(shù)碼管顯示檔位。4.定時(shí)模式:在風(fēng)扇不同轉(zhuǎn)動(dòng)速度下,可以通過(guò)按鍵切換進(jìn)入定時(shí)模式。定時(shí)時(shí)間可設(shè)置范圍為2059秒,采用2個(gè)數(shù)碼管進(jìn)行倒計(jì)時(shí)顯示,當(dāng)?shù)褂?jì)時(shí)結(jié)束后,風(fēng)扇狀態(tài)保持靜止不動(dòng)。5.設(shè)置開(kāi)關(guān)鍵。風(fēng)扇開(kāi)機(jī)初始狀態(tài)為20、1檔,并有不小于5秒的開(kāi)機(jī)音樂(lè),關(guān)機(jī)狀態(tài)為點(diǎn)陣全滅。提高要求:1.設(shè)計(jì)LED 風(fēng)扇的其他工作模式。2.利用實(shí)驗(yàn)板上的溫度傳感器代替按鍵直接獲取溫度數(shù)據(jù),實(shí)現(xiàn)對(duì)LED 風(fēng)扇四檔轉(zhuǎn)速的自動(dòng)控制。3.用數(shù)碼管實(shí)時(shí)顯示溫度傳感器的溫度數(shù)據(jù),精度為0.1。4.自擬其他功能。二、系統(tǒng)設(shè)計(jì)
3、 1.設(shè)計(jì)思路 這次實(shí)驗(yàn)采用老師講過(guò)的自頂向下的設(shè)計(jì)方法來(lái)完成設(shè)計(jì)。為了實(shí)現(xiàn)電風(fēng)扇的功能,將系統(tǒng)分成多個(gè)模塊:控制器模塊:通過(guò)按鈕與開(kāi)關(guān)輸入開(kāi)關(guān)機(jī)、溫度、倒計(jì)時(shí)時(shí)間等信息,實(shí)現(xiàn)開(kāi)機(jī)音樂(lè)、溫度調(diào)整檔位切換功能、倒計(jì)時(shí)功能等。蜂鳴器模塊:通過(guò)蜂鳴器震動(dòng),使開(kāi)機(jī)時(shí)播放不少于5s的音樂(lè)。分頻器模塊:分頻模塊把晶振(1000Hz)分成了500Hz,1000Hz,2000Hz傳給控制器,供電風(fēng)扇以不同檔位工作。LED點(diǎn)陣模塊:雙色點(diǎn)陣部分按時(shí)鐘周期對(duì)紅燈、綠燈分別進(jìn)行行掃描,以顯示風(fēng)扇的四個(gè)工作狀態(tài),并在四個(gè)狀態(tài)間循環(huán)切換。倒計(jì)時(shí)模式切換模塊:用SW按鈕控制溫度與倒計(jì)時(shí)工作模式的切換。數(shù)碼管顯示模塊:通過(guò)
4、6個(gè)共陰極數(shù)碼管按時(shí)鐘周期持續(xù)掃描,一位顯示0,第二、三位顯示時(shí)間,第四位顯示檔位,第五、六位顯示溫度。防抖模塊:防止由于BTN按鈕本身原因1次輸入產(chǎn)生多個(gè)信號(hào)。 2.設(shè)計(jì)框圖點(diǎn)陣顯示分頻器控制器數(shù)碼管顯示三、波形圖1.蜂鳴器通過(guò)開(kāi)機(jī)鍵控制開(kāi)關(guān),開(kāi)機(jī)后蜂鳴器響5s。2.數(shù)碼管通過(guò)一定頻率不斷掃描,6個(gè)數(shù)碼管均可以良好顯示數(shù)字,第一位顯示0,第二、三位顯示時(shí)間,第四位顯示檔位,第五、六位顯示溫度。3.分頻器4.點(diǎn)陣顯示四、源程序1.防抖文件library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ie
5、ee.std_logic_arith.all;entity fangdou ISport(clk:in std_logic; reset:in std_logic;resetn: out std_logic);END fangdou;architecture behave of fangdou issignal clk_tmp : std_logic;signal cnt : integer range 0 to 199999;signal tmp1,tmp2: std_logic;beginprocess(clk)beginif (clk'event and clk='1
6、39;) thenif cnt=199999 thencnt<=0;clk_tmp<= not clk_tmp;elsecnt<=cnt+1;end if;end if;end process;process(clk_tmp)beginif (clk_tmp'event and clk_tmp='0') thentmp2<=tmp1;tmp1<=key_in;end if;end process;key_out<=clk_tmp and tmp1 and (not tmp2);end behave;2.電風(fēng)扇use ieee.std_
7、logic_1164.all;use ieee.std_logic_unsigned.all;entity dianfengshan is port ( clk: in std_logic;-時(shí)鐘輸入 clear: in std_logic;-電風(fēng)扇開(kāi)關(guān) colr,colg,row:buffer std_logic_vector(7 downto 0); -LED點(diǎn)陣顯示 shu:out std_logic_vector(7 downto 0);-數(shù)碼管 cat:out std_logic_vector(5 downto 0);-數(shù)碼管行掃描 b1,b2: in std_logic;-溫度增減
8、 b3,b4: in std_logic;-時(shí)間增減 ton: in std_logic;-時(shí)間模式開(kāi)/關(guān) feng: out std_logic-蜂鳴器 ); end dianfengshan;architecture behave of dianfengshan is signal clk1,clk2,clk3,clk4:std_logic ;-分頻后的時(shí)鐘信號(hào) signal tup:std_logic:='0'-tup為1表示倒計(jì)時(shí)結(jié)束 signal kind,dang:integer range 0 to 3;-kind為風(fēng)扇的四個(gè)狀態(tài),dang為模式 signal c
9、nt:integer range 0 to 7;-數(shù)碼管管位顯示 signal temp:integer range 10 to 40:=20;-溫度 signal a1,a2,a3,a4,a5:std_logic;-對(duì)應(yīng)b1,b2,b3,b4,ton防抖后的輸出 signal clock: std_logic;-電風(fēng)扇轉(zhuǎn)動(dòng)的時(shí)鐘 signal t:integer range 0 to 59:=20;-時(shí)間 signal op:std_logic;-open,時(shí)間模式開(kāi)關(guān) signal beep: std_logic;-蜂鳴器信號(hào)component fangdou is-引用防抖模塊port(
10、clk: in std_logic;reset: in std_logic;resetn:out std_logic);end component; begin uo_1:fangdou port map(clk,b1,a1) ;uo_2:fangdou port map(clk,b2,a2);uo_3:fangdou port map(clk,b3,a3);uo_4:fangdou port map(clk,b4,a4);uo_5:fangdou port map(clk,ton,a5); p1:process(clk,clear)-分頻器variable tmp1:integer rang
11、e 0 to 999;variable tmp2:integer range 0 to 749;variable tmp3:integer range 0 to 499;variable tmp4:integer range 0 to 499;begin if clear = '0' then tmp1:=0; tmp2:=0; tmp3:=0; tmp4:=0; elseif clk'event and clk = '1' then if tmp1=999 then tmp1:=0;clk1<= not clk1; else tmp1:=tmp1
12、+1; end if; -對(duì)clk進(jìn)行2000分頻 if tmp2=749 then tmp2:=0;clk2<=not clk2; else tmp2:=tmp2+1; end if; -對(duì)clk進(jìn)行1500分頻 if tmp3=499 then tmp3:=0;clk3<=not clk3; else tmp3:=tmp3+1; end if; -對(duì)clk進(jìn)行1000分頻 if tmp4=499 then tmp4:=0;clk4<=not clk4; else tmp4:=tmp4+1; end if; end if;end process;p2: process(cl
13、k)-控制LED點(diǎn)陣的行掃描beginif clear = '1' then-電風(fēng)扇開(kāi)關(guān)開(kāi)著的時(shí)候if clk'event and clk = '0' then if cnt = 7 then cnt<=0; else cnt<= cnt+1; end if;end if;case cnt iswhen 0=>row<="01111111"-行掃描when 1=>row<="10111111"when 2=>row<="11011111"when
14、3=>row<="11101111"when 4=>row<="11110111"when 5=>row<="11111011"when 6=>row<="11111101"when 7=>row<="11111110"end case;else row<="11111111"end if;end process;p3:process(clk)-led顯示beginif clear = '1'
15、thenif kind = 0 then -電風(fēng)扇工作第一種狀態(tài)case row is when "01111111"=>colr<="10000000"colg<="00000001"when "10111111"=>colr<="01000000"colg<="00000010"when "11011111"=>colr<="00100000"colg<="000001
16、00"when "11101111"=>colr<="00010000"colg<="00001000"when "11110111"=>colr<="00001000"colg<="00010000"when "11111011"=>colr<="00000100"colg<="00100000"when "11111101"=&g
17、t;colr<="00000010"colg<="01000000"when others =>colr<="00000001"colg<="10000000"end case;elsif kind = 1 then-電風(fēng)扇工作第二種狀態(tài)case row is when "01111111"=>colr<="00010000"colg<="00000000"when "10111111"=
18、>colr<="00010000"colg<="00000000"when "11011111"=>colr<="00010000"colg<="00000000"when "11101111"=>colr<="00010000"colg<="00001111"when "11110111"=>colr<="00001000"col
19、g<="11110000"when "11111011"=>colr<="00001000"colg<="00000000"when "11111101"=>colr<="00001000"colg<="00000000"when others =>colr<="00001000"colg<="00000000"end case;elsif kind =2
20、then-電風(fēng)扇工作第三種狀態(tài)case row is when "01111111"=>colg<="10000000"colr<="00000001"when "10111111"=>colg<="01000000"colr<="00000010"when "11011111"=>colg<="00100000"colr<="00000100"when &quo
21、t;11101111"=>colg<="00010000"colr<="00001000"when "11110111"=>colg<="00001000"colr<="00010000"when "11111011"=>colg<="00000100"colr<="00100000"when "11111101"=>colg<="
22、00000010"colr<="01000000"when others =>colg<="00000001"colr<="10000000"end case;else-電風(fēng)扇工作第四種狀態(tài)case row is when "01111111"=>colr<="00000000"colg<="00010000"when "10111111"=>colr<="00000000"
23、;colg<="00010000"when "11011111"=>colr<="00000000"colg<="00010000"when "11101111"=>colr<="00001111"colg<="00010000"when "11110111"=>colr<="11110000"colg<="00001000"when &
24、quot;11111011"=>colr<="00000000"colg<="00001000"when "11111101"=>colr<="00000000"colg<="00001000"when others =>colr<="00000000"colg<="00001000"end case;end if;end if;end process;p4:process(a1,a2,a3,
25、a4,a5,clk)-溫度控制模塊beginif clear = '1' thenif clk'event and clk= '0'thenif a1='1' then-b1按鍵控制溫度增加if temp<40 thentemp<=temp+1;end if;elsif a2 = '1' then-b2按鍵控制溫度減少if temp>10 thenend if;end if;if tup<='0' then-倒計(jì)時(shí)沒(méi)結(jié)束時(shí)if temp>9 and temp<20 the
26、n-第4檔dang<=3;clock<='0'elsif temp>19 and temp<25 then-第1檔dang<=0;clock<=clk1; elsif temp>24 and temp<30 then-第2檔dang<=1;clock<=clk2; elsif temp>29 and temp<41 then-第3檔, dang<=2;clock<=clk3; else temp<=temp;end if;elsif tup<='1' thencloc
27、k<='0'-clock置0,風(fēng)扇靜止end if;end if;else temp<=20;clock<=clk1;dang <= 0;end if;end process;p5:process(clock)-風(fēng)扇四種狀態(tài)的切換beginif clear = '1' thenif clock'event and clock='1' thenif kind = 3 then-kind在0到3之間循環(huán)切換kind<=0;elsekind <= kind +1;end if;end if;end if;en
28、d process;p6:process(temp,t)-數(shù)碼管顯示variable c1,c2,c3,c4,c5,shu1:integer range 0 to 9;variable tmp:integer range 0 to 5;beginif clear = '1' thenc1:=temp rem 10;-c1顯示溫度的個(gè)位數(shù)c2:=temp/10;-c2顯示溫度的十位數(shù)c3:=dang+1;-c3顯示檔位,即dang+1c4:=t rem 10;-c4顯示時(shí)間的個(gè)位數(shù)c5:=t/10; -c5顯示時(shí)間的十位數(shù)if clk'event and clk =
29、39;1' then-數(shù)碼管掃描if tmp = 5 thentmp := 0;else tmp:=tmp+1;end if;end if;case tmp is when 0=>cat<="111110"shu1:=c1; when 1=>cat<="111101"shu1:=c2;when 2=>cat<="111011"shu1:=c3;when 3=>cat<="110111"shu1:=c4;when 4=>cat<="1011
30、11"shu1:=c5;when 5=>cat<="011111"shu1:=0;end case;case shu1 is-數(shù)碼管對(duì)10個(gè)數(shù)的顯示when 0=>shu<="11111100"when 1=>shu<="01100000"when 2=>shu<="11011010"when 3=>shu<="11110010"when 4=>shu<="01100110"when 5=>
31、;shu<="10110110"when 6=>shu<="10111110"when 7=>shu<="11100000"when 8=>shu<="11111110"when 9=>shu<="11110110"end case;else cat<="111111"end if;end process;p7:process(a3,a4,clk4,op)-時(shí)間控制模塊variable tmp:integer ran
32、ge 0 to 999;beginif clear = '1' thenif clk'event and clk ='0' thenif op = '0' thenif a3='1' then-b3按鍵增加時(shí)間if t<59 then t<=t+1;end if;elsif a4='1' then -b4按鍵減少時(shí)間if t>20 thent<=t-1;end if;end if;elsif op = '1' then if tmp = 999 then tmp:=0
33、;if t>0 then t<= t-1;elsif t=0 thent<=0;tup<='1' -t=0,倒計(jì)時(shí)結(jié)束end if ;else tmp:=tmp + 1;end if;end if;end if;else t<= 20; -總開(kāi)關(guān)關(guān)閉后,對(duì)時(shí)間進(jìn)行重置end if;end process;p8:process(a5) -b5按鍵按下之后更改倒計(jì)時(shí)模式beginif clear = '1' then if a5'event and a5='1' thenop<=not op; end if
34、;else op <='0'end if;end process;p9:process(clk,clk4)-蜂鳴器模塊,開(kāi)機(jī)音樂(lè)variable f: integer range 0 to 999; variable a: integer range 0 to 5; -開(kāi)機(jī)音樂(lè)5秒鐘variable b:integer range 0 to 2;variable c:integer range 0 to 3;variable d: integer range 0 to 4;variable e: integer range 0 to 1; beginif clear =&
35、#39;1'thenif clk'event and clk = '1' thenif f = 999 then f:=0;if a = 5 then a:=5;else a:=a+1; end if;else f:=f+1;end if;if b = 2 then b:=0;else b:=b+1;end if;if c = 3 then c:=0;else c:=c+1;end if;if d = 4 then d:=0;else d:=d+1;end if;if e = 1 then e:=0;else e:=e+1;end if; if a = 5 then beep<= '0' -5秒后,
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026年外研版高考英語(yǔ)一輪復(fù)習(xí)考點(diǎn)梳理必修第三冊(cè)Unit6 Disaster and hope
- 2026年高考政治專(zhuān)項(xiàng)復(fù)習(xí):組合類(lèi)試題(解析版)
- 學(xué)校民主生活會(huì)工作計(jì)劃
- 2026年高考?xì)v史一輪復(fù)習(xí):必修中外歷史綱要(上)模塊測(cè)試卷(含答案解析)
- 2025年武漢市中考物理試卷(含答案及解析)
- 2026屆高考語(yǔ)文復(fù)習(xí):統(tǒng)編版教材必背古詩(shī)文理解性默寫(xiě)(解析版)
- 2025新仁愛(ài)科普版八年級(jí)英語(yǔ)上冊(cè) Unit1 Healthy Mind and Body分層作業(yè)設(shè)計(jì)【含答案解析】
- 2026年中考語(yǔ)文一輪復(fù)習(xí):天空 中考語(yǔ)文作文題導(dǎo)寫(xiě)講義
- 2025年蘇科版新九年級(jí)數(shù)學(xué)暑假提升講義:數(shù)據(jù)與概率復(fù)習(xí)與測(cè)試(原卷版+解析)
- 《資產(chǎn)階級(jí)民主革命的醞釀和爆發(fā)》參考教案
- 蘭州彤輝商貿(mào)有限公司肅南縣博懷溝一帶銅鐵礦礦產(chǎn)資源開(kāi)發(fā)與恢復(fù)治理方案專(zhuān)家組審查意見(jiàn)
- 天然氣管道輸送技術(shù)課件
- 物流員工健康管理制度
- 金屬拉伸試驗(yàn)題目及答案
- 血液透析通路狹窄機(jī)制-洞察及研究
- 發(fā)展對(duì)象培訓(xùn)考試題及答案
- 工程進(jìn)度工作報(bào)告
- 2025年磁性展示板項(xiàng)目市場(chǎng)調(diào)查研究報(bào)告
- 訂單合同轉(zhuǎn)讓協(xié)議書(shū)模板
- 招商項(xiàng)目轉(zhuǎn)讓協(xié)議書(shū)
評(píng)論
0/150
提交評(píng)論