




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、石家莊經(jīng)濟(jì)學(xué)院華信學(xué)院數(shù)字邏輯課程設(shè)計(jì)報(bào)告題 目 洗衣機(jī)控制器 姓 名 學(xué) 號(hào) 班 號(hào) 指導(dǎo)老師 成 績 2014年6月目 錄1. 課程設(shè)計(jì)目的2. 開發(fā)工具選擇3. 設(shè)計(jì)方案 4 模塊描述5. VHDL實(shí)現(xiàn)6. 調(diào)試仿真7. 課程設(shè)計(jì)回顧總結(jié) 參 考 文 獻(xiàn) 附錄 1課程設(shè)計(jì)目的設(shè)計(jì)一個(gè)洗衣機(jī)控制器,控制洗衣機(jī)的電機(jī)按照下圖要求運(yùn)轉(zhuǎn)。用兩位數(shù)碼管預(yù)置洗滌時(shí)間(分鐘數(shù)),洗滌過程在送入預(yù)置時(shí)間后開始運(yùn)轉(zhuǎn),洗滌中按倒計(jì)時(shí)方式對洗滌過程作計(jì)時(shí)顯示,用LED表示電動(dòng)機(jī)的正、反轉(zhuǎn),如果定時(shí)時(shí)間到,則停機(jī)并發(fā)出音響信號(hào)。 2開發(fā)工具選擇(1) 硬件描述語言洗衣機(jī)控制器的設(shè)計(jì)采用了功能強(qiáng)大的VHDL語言,
2、它具有很強(qiáng)的行為能力描述,設(shè)計(jì)方法靈活,可以支持庫和模塊設(shè)計(jì)方法。 (2) QuartusII軟件開發(fā)工具 本設(shè)計(jì)采用的軟件開發(fā)工具是美國的Altera公司的QuartusII,它支持多種設(shè)計(jì)輸入方法,包括原理圖輸入、文本輸入。 (3) EDA實(shí)驗(yàn)開發(fā)系統(tǒng) 本設(shè)計(jì)采用的EDA實(shí)驗(yàn)開發(fā)系統(tǒng),主要用于提供可編程邏輯器件的下載電路及EDA實(shí)驗(yàn)開發(fā)的外圍資源,供硬件驗(yàn)證用。3設(shè)計(jì)方案總體思路:洗衣機(jī)啟動(dòng)后,將依次經(jīng)過正轉(zhuǎn)15s、暫停5秒、反轉(zhuǎn)15秒、暫停5秒四個(gè)步驟(狀態(tài))。在實(shí)例中,假設(shè)定時(shí)時(shí)間為40秒,故經(jīng)過這四個(gè)狀態(tài)后時(shí)間到,停止。具體實(shí)現(xiàn):此設(shè)計(jì)問題可分為洗滌預(yù)置時(shí)間編碼寄存電路模塊、十進(jìn)制減
3、法計(jì)數(shù)器模塊、時(shí)序電路模塊、譯碼驅(qū)動(dòng)模塊四大部分。 設(shè)置預(yù)置信號(hào)LD,LD有效后,可以對洗滌時(shí)間計(jì)數(shù)器進(jìn)行預(yù)置數(shù),用數(shù)據(jù)開關(guān)K1-K10分別代表數(shù)字1,2,9,0,用編碼器對數(shù)據(jù)開關(guān)K1-K10的電平信號(hào)進(jìn)行編碼,編碼器真值表如下表所示,編碼后的數(shù)據(jù)寄存。 設(shè)置洗滌開始信號(hào)start,start有效,則洗滌時(shí)間計(jì)數(shù)器進(jìn)行倒計(jì)數(shù),并用數(shù)碼管顯示,同時(shí)啟動(dòng)時(shí)序電路工作。 時(shí)序電路中含有15s定時(shí)信號(hào),5s定時(shí)信號(hào),設(shè)為A、B,A、B為“0”表示定時(shí)時(shí)間未到,為“1”表示定時(shí)時(shí)間到。 設(shè)置電動(dòng)機(jī)正轉(zhuǎn)信號(hào)run、反轉(zhuǎn)信號(hào)rev、暫停信號(hào)Pause,由時(shí)序電路的輸出Q2Q1經(jīng)譯碼驅(qū)動(dòng)模塊,可使顯示信號(hào)正
4、確反映電路的工作狀態(tài)。直到洗滌計(jì)時(shí)時(shí)間到,時(shí)序電路異步復(fù)位。 流程圖如下: 4模塊描述(1) 模塊一:預(yù)設(shè)時(shí)間和編碼電路(yuzhitime)接受用戶通過按鈕預(yù)置的時(shí)間信息,編碼成八位之后轉(zhuǎn)給減法計(jì)數(shù)器。(2) 模塊二:減法計(jì)數(shù)器電路(counter) 接收編碼之后的預(yù)置時(shí)間信息,向電機(jī)運(yùn)轉(zhuǎn)控制電路傳遞運(yùn)行信號(hào),并將預(yù)置時(shí)間信息和剩余時(shí)間信息發(fā)給數(shù)碼管顯示電路進(jìn)行實(shí)時(shí)顯示。(3) 模塊三:數(shù)碼管顯示電路(showtime)接收減法計(jì)數(shù)器電路傳來的時(shí)間信息,進(jìn)行實(shí)時(shí)譯碼顯示(4) 模塊四:電機(jī)運(yùn)轉(zhuǎn)時(shí)序控制電路(shixu)接收運(yùn)行起止信號(hào),安排電機(jī)運(yùn)行狀態(tài)并編碼輸出。(5) 模塊五:譯碼器(mo
5、ve)接收電機(jī)運(yùn)行狀態(tài)信號(hào),譯碼后實(shí)時(shí)控制電機(jī)的正傳、反轉(zhuǎn)和暫停。5 VHDL實(shí)現(xiàn)模塊一:預(yù)設(shè)時(shí)間和編碼電路(yuzhitime)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity yuzhitime isport(load,clk:in std_logic; time_input:in std_logic_vector(3 downto 0); time_set:out std_logic_vector(7 downto 0);end yuzhitime;architecture yu
6、zhitime of yuzhitime is signal p1:std_logic_vector(7 downto 0);begin process(time_input)is begin case time_input is when "0000"=>p1<="00000000" when "0001"=>p1<="00000001" when "0010"=>p1<="00000010" when "0011"=
7、>p1<="00000011" when "0100"=>p1<="00000100" when "0101"=>p1<="00000101" when "0110"=>p1<="00000110" when "0111"=>p1<="00000111" when "1000"=>p1<="00001000"
8、; when "1001"=>p1<="00001001" when "1010"=>p1<="00001010" when others=>p1<="00000000" end case; end process; time_set<=p1;end yuzhitime;其中,time_input為通過開發(fā)板上按鈕輸入的信號(hào),load為輸入確認(rèn)信號(hào)。本模塊將輸入的四位時(shí)間信息編碼輸出到減法計(jì)數(shù)器電路。模塊二:減法計(jì)數(shù)器電路(counter)library
9、 ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity counter is port ( clk,start:in std_logic; time_set:in std_logic_vector(7 downto 0); time_remain:buffer std_logic_vector(7 downto 0); time_over:buffer std_logic );end counter;architecture counter of counter is begin process(clk)
10、 variable time_second:integer range 0 to 59:=59; begin if(clk'event and clk='1') then if(start='0') then if(time_remain(7 downto 0)=0) then time_remain<=time_set; else time_remain(7 downto 4)<=time_remain(3 downto 0); time_remain(3 downto 0)<=time_set(3 downto 0); end if
11、; time_second:=59; time_over<='1' else if(time_over='1') then if(time_second=0 and time_remain(7 downto 0)=0) then time_over<='0' else if(time_second=0) then if (time_remain(3 downto 0)=0) then time_remain(7 downto 4)<=time_remain(7 downto 4)-1; time_remain(3 downto
12、0)<="1001" time_second:=59; else time_remain(7 downto 4)<=time_remain(7 downto 4); time_remain(3 downto 0)<=time_remain(3 downto 0)-1; time_second:=59; end if; else time_second:=time_second-1; end if; end if; end if; end if; end if; end process;end counter;本模塊中clk為系統(tǒng)時(shí)序脈沖信號(hào),start為系
13、統(tǒng)開始運(yùn)行的信號(hào),time_set為從預(yù)置時(shí)間模塊接收到的時(shí)間編碼信號(hào),time_remain為輸出到數(shù)碼管顯示電路的時(shí)間信號(hào),time_is_up為系統(tǒng)運(yùn)行結(jié)束信號(hào)。在系統(tǒng)運(yùn)行的開始時(shí)期,用戶第一次輸入的預(yù)置時(shí)間會(huì)被賦給個(gè)位,第二次輸入的時(shí)間會(huì)被賦給十位,可以進(jìn)行多次輸入,以前的會(huì)被覆蓋。模塊三:數(shù)碼管顯示電路(showtime)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity showtime is port ( time_remain:in std_logic_vector(7
14、downto 0); clk:in std_logic; minute,second:out std_logic; a,b,c,d,e,f,g: out std_logic );end showtime;architecture showtime of showtime is signal temp:std_logic_vector(6 downto 0); signal bcd:std_logic_vector(3 downto 0); signal choose:std_logic; begin process(clk) begin if(clk'event and clk=
15、9;1') then choose<=not choose; if(choose='1') then minute<='0'second<='1' bcd<=time_remain(7 downto 4); else minute<='1'second<='0' bcd<=time_remain(3 downto 0); end if; end if; end process; process(bcd) begin case bcd is when "00
16、00"=>temp<="1111110" ; when "0001"=>temp<="0110000" ; when "0010"=>temp<="1101101" ; when "0011"=>temp<="1111001" ; when "0100"=>temp<="0110011" ; when "0101"=>te
17、mp<="1011011" ; when "0110"=>temp<="1011111" ; when "0111"=>temp<="1110000" ; when "1000"=>temp<="1111111" ; when "1001"=>temp<="1111011" ; when others=>temp<="1111011"
18、; ; end case; a<=temp(6);b<=temp(5);c<=temp(4);d<=temp(3);e<=temp(2);f<=temp(1);g<=temp(0); end process;end showtime;接收減法計(jì)數(shù)器電路傳來的時(shí)間信息,進(jìn)行實(shí)時(shí)譯碼顯示,由于我們的實(shí)際是可以進(jìn)行兩位的時(shí)間顯示的,所以開始的時(shí)候是用的兩個(gè)數(shù)碼管,后來見到硬件芯片上是只有一個(gè),又修改成了一個(gè),但為了進(jìn)行兩位的顯示,我們就設(shè)計(jì)了兩個(gè)小燈,每個(gè)小燈分別代表十位和個(gè)位,當(dāng)某個(gè)小燈被點(diǎn)亮?xí)r代表當(dāng)前顯示的是對應(yīng)位的數(shù)值,每個(gè)一秒轉(zhuǎn)換一次,這樣就可以實(shí)現(xiàn)
19、兩位的顯示了。模塊四:電機(jī)運(yùn)轉(zhuǎn)時(shí)序控制電路(shixu)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity shixu is port ( clk,start,time_over:in std_logic; q1,q2:out std_logic );end shixu;architecture shixu of shixu is begin process(clk) variable state:std_logic; variable wash_time:integer :=0; va
20、riable wait_time:integer :=0; begin if(clk'event and clk='1') then if(start='0') then wash_time:=0; wait_time:=0; state:='0' q1<='0'q2<='0' else if(time_over='1') then if(wash_time=20) then if(wait_time=9) then wash_time:=0; state:=not state;
21、 else wait_time:=wait_time+1; end if; else wash_time:=wash_time+1; wait_time:=0; end if; end if; if(wash_time=20) then q1<='0'q2<='0' else if(state='0') then q1<='1'q2<='0' else q1<='0'q2<='1' end if; end if; end if; end if; e
22、nd process;end shixu;通過時(shí)鐘的輸入進(jìn)行計(jì)算當(dāng)前系統(tǒng)應(yīng)該處的狀態(tài),并進(jìn)行編碼輸出電機(jī)的運(yùn)轉(zhuǎn)狀態(tài)。由于在顯示以及輸入的時(shí)候只有分鐘,故需要內(nèi)設(shè)一個(gè)秒的計(jì)時(shí)變量。模塊五:譯碼器(move)library ieee;use ieee.std_logic_1164.all;entity move is port( q1,q2: in std_logic; REV,RUN,PAUSE: buffer std_logic );end move;architecture move of move is begin REV<=q2;RUN<=q1;PAUSE<=not(q
23、1 OR q2);end move;分析輸入的電機(jī)轉(zhuǎn)動(dòng)編碼信號(hào),即為思路中的Q1何Q2,安排電機(jī)運(yùn)行狀態(tài)并進(jìn)行輸出。主程序(wash)用來將各個(gè)模塊進(jìn)行組合,從而實(shí)現(xiàn)一個(gè)可以運(yùn)行的系統(tǒng)。程序代碼如下所示:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use work.all;entity wash is port ( load:in std_logic; time_input:in std_logic_vector(3 downto 0); clk:in std_logic; start:in
24、std_logic; time_set:buffer std_logic_vector(7 downto 0); time_over:buffer std_logic; REV,RUN,PAUSE: buffer std_logic; a,b,c,d,e,f,g: buffer std_logic; minute,second:buffer std_logic );end wash;architecture wash of wash is component yuzhitime port ( load:in std_logic; time_input:in std_logic_vector(3
25、 downto 0); time_set:out std_logic_vector(7 downto 0) ); end component; component counter port ( clk,start:in std_logic; time_set:in std_logic_vector(7 downto 0); time_remain:buffer std_logic_vector(7 downto 0); time_over:buffer std_logic ); end component; component showtime port ( time_remain:in st
26、d_logic_vector(7 downto 0); clk:in std_logic; minute,second:out std_logic; a,b,c,d,e,f,g: out std_logic ); end component; component shixu port ( clk,start,time_over:in std_logic; q1,q2:out std_logic ); end component; component move port ( q1,q2: in std_logic; REV,RUN,PAUSE: buffer std_logic ); end co
溫馨提示
- 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 特價(jià)房買賣合同模板
- 會(huì)議音響租賃合同
- 食品供應(yīng)鏈服務(wù)合同范文
- 搪瓷化工容器的安全標(biāo)準(zhǔn)考核試卷
- 戶外帳篷批發(fā)考核試卷
- 助動(dòng)車行車記錄儀使用與維護(hù)考核試卷
- 摩托車ABS系統(tǒng)傳感器檢測考核試卷
- 工業(yè)機(jī)器人的智能電源管理考核試卷
- 體育運(yùn)動(dòng)心理承受能力測試考核試卷
- 家裝整裝合同范本
- v建筑主墩雙壁鋼圍堰施工工藝資料
- 人教版新課標(biāo)小學(xué)美術(shù)二年級(jí)下冊全冊教案
- 病歷書寫基本規(guī)范及相關(guān)法律解析
- 我國互聯(lián)網(wǎng)公司資本結(jié)構(gòu)分析-以新浪公司為例
- 【藍(lán)天幼兒園小一班早期閱讀現(xiàn)狀的調(diào)查報(bào)告(含問卷)7800字(論文)】
- 2023年全國職業(yè)院校技能大賽賽項(xiàng)-ZZ005 裝配式建筑構(gòu)件安裝賽項(xiàng)模塊一理論賽題
- 第二次全國土地調(diào)查技術(shù)規(guī)程完整版
- 客戶答謝活動(dòng)承包合同
- AQ/T 5201-2007 涂裝工程安全設(shè)施驗(yàn)收規(guī)范(正式版)
- 華南師范大學(xué)333教育綜合專業(yè)碩士歷年考研真題匯編(含部分答案)合集
- 食管早癌的內(nèi)鏡診斷
評論
0/150
提交評論