【正文】
else p=39。039。 end if。 else p=39。039。 end if。 else led1=led11。 end if。 else t=t1。 end if。 end if。 end if。 end process。 process(data) begin case data is when0000=s=0111111。0 when0001=s=0000110。1 when0010=s=1011011。2 when0011=s=1001111。3 when0100=s=1100110。4 when0101=s=1101101。5 when0110=s=1111101。6 when0111=s=0000111。7 when1000=s=1111111。8 when1001=s=1101111。9 when others=null。 end case。 end process。 duon=dout。 cout=s。 end。 第三部分:譯碼模塊 library ieee。 use 。 use 。 use 。 entity yima is port( h:in std_logic_vector(6 downto 0)。 a,b,c,d,e,f,g:out std_logic)。 end。 architecture one of yima is begin g=h(6)。 f=h(5)。 e=h(4)。 d=h(3)。 c=h(2)。 b=h(1)。 a=h(0)。 end one。 總體框圖: 四 、 管腳分配 五.硬件下載實(shí)現(xiàn)現(xiàn)象描述 和預(yù)想的效果一樣。當(dāng)主持人按下復(fù)位開關(guān)時(shí),四個(gè)按鍵開關(guān)生效。選手開始搶答。搶答完后,顯示管顯示選手的號(hào)數(shù)。這時(shí)主持人 可以設(shè)置答題時(shí)間的初始值此時(shí),顯 示器從初始值開始倒計(jì)時(shí),計(jì)至 0時(shí)停止 計(jì)數(shù),同時(shí)揚(yáng)聲器發(fā)出超時(shí)報(bào)警信號(hào)。若參賽者在規(guī)定的時(shí)間內(nèi)回答完問題,主持人可以 用開關(guān) 給出計(jì)時(shí)停止信號(hào),以免揚(yáng)聲器鳴叫。 六 、 體會(huì)與收獲 再次用到