【正文】
else time_remain(7 downto 4)=time_remain(3 downto 0)。 time_over=39。) then if(time_second=0 and time_remain(7 downto 0)=0) then time_over=39。 time_second:=59。 end if。 . . end if。 end counter。 use 。 a,b,c,d,e,f,g:out std_logic )。 signal choose:std_logic。) then choose=not choose。039。 else minute=39。 bcd= time_remain(3 downto 0)。 process(bcd) begin case bcd is when 0000=temp=1111110。 when 0100=temp=0110011。 when 1000=temp=1111111。 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; 時序電路模塊 (analyse) 時序電路模塊 analyse 如圖 7所示,本模塊由 start 控制使能控制,通過時鐘的輸入進(jìn)行計(jì)算當(dāng)前系統(tǒng)所處的狀態(tài),并進(jìn)行編碼輸出電機(jī)的運(yùn)轉(zhuǎn)狀態(tài),out_1 為高位時表示電機(jī)正轉(zhuǎn), out_2 為高位時表示電機(jī)反轉(zhuǎn)。 use 。 architecture analyse of analyse is begin process(clk) variable state:std_logic。event and clk=39。) then wash_time:=0。 out_1=39。 else if(time_over=39。 else wait_time:=wait_time+1。 end if。out_2=39。) then out_1=39。 else out_1=39。 end if。 end process。 圖 9 譯碼器模塊 . . 仿真圖 圖 10 譯碼器模塊仿真圖 譯碼器模塊 move 源程序 library ieee。 end move。 process(choose) begin case choose is when 00=REV=39。PAUSE=39。RUN=39。 when 01=REV=39。PAUSE=39。RUN=39。 end case。 end process。數(shù)碼管在系統(tǒng)的整個運(yùn)行過程中時時顯示剩余運(yùn)轉(zhuǎn)時間。 頂層文件仿真 . . 由上圖可以看出:當(dāng)預(yù)置號時間,啟動 start,數(shù)碼管顯示預(yù)置時間,電機(jī)開始以正轉(zhuǎn) =暫停 =反轉(zhuǎn) =暫停為周期進(jìn)行循環(huán),一個周期正好費(fèi)時一分鐘,一個周期結(jié)束,數(shù)碼管顯示減一,依次循環(huán),直至數(shù)碼管顯示時間為零,洗衣結(jié)束。洗衣機(jī)控制器主要就只有三個狀態(tài),要實(shí)現(xiàn)幾種狀態(tài)的多次循環(huán)的改變,其他的還有計(jì)時和數(shù)碼顯示的功能,通過每個模塊的設(shè)計(jì)最后組裝即可完成系統(tǒng)級的設(shè)計(jì)。但我覺的出現(xiàn)問題并不是很要緊,這些問題能提醒我那些地方?jīng)]有學(xué)好,只要我重視這些地方將其鞏固我想我將能學(xué)到許多的知識。我想在面對一個問題時不能存在僥幸心理,只要我們認(rèn)真對待它,我們就能學(xué)到