【正文】
中,更進一步地熟悉有關數(shù)字電路的知識和具體應用。學 會了利 Max+plus 和 QuarterII 軟件進行原理圖的繪制,硬件描述語言 VHDL 的編寫,程序的仿真等工作。并能根據(jù)仿真結(jié)果分析設計的存在的問題和缺陷,從而進行程序的調(diào)試和完善。 在設計電路中,往往是先仿真后連接實物圖,但有時候仿真和電路連接并不是完全一致的,例如在對具體模塊的仿真的過程中,往往沒有考慮到整體設計的層面以及與上下模塊接口的設計。再加上器件對信號的延時等問題,實際下載到實驗箱上后會出現(xiàn)一系列的問題,因此仿真圖和電路連接圖還是有一定區(qū)別的。 此次的數(shù)字鐘設計重在于按鍵的控制和各個模塊代碼的編寫 ,雖然能把鍵盤接口和各個模塊的代碼編寫出來,并能正常顯示,但對于各個模塊的優(yōu)化設計還有一定的缺陷和不足??偟膩碚f,通過這次的設計實驗更進一步地增強了實驗的動手能力,對數(shù)字鐘的工作原理也有了更加透徹的理解。 在本設計調(diào)試過程中遇到了一些問題如下: ,數(shù)碼管 顯示 全部為零,計數(shù)器不工作,經(jīng)分析得知程序中的總的清零信號保持有效狀態(tài), 改動程序后計數(shù)器開始計數(shù)。 59 時變 0 時,分計數(shù) 模塊 滯后計數(shù),考慮的器件的延時,將程序中秒的進位信號提前 1 秒 。 控制按鍵給月模塊加計數(shù)時 ,發(fā)現(xiàn)的月加到 12 時,年則在沒有按鍵按下的情況下一直加計數(shù)。 檢查程序后得知,月的進位信號在月為 12 后變一直有效,其它模塊也存在這種情況,改動程序后各個模塊工作正常。 34 按鍵時,由于有些按鍵控制是秒時鐘同步的,所以控制起來顯得梢慢些,但是工作正常,能滿足實際的需要。 研究展望 本設計中雖然有控制鍵對時鐘進行控制,但是用到的按鍵太多,在實際應用上存在不足。故提出改進方案為用一個按鍵控制數(shù)碼管的片選,再用兩個按鍵控制計數(shù)的加減。 這樣可以節(jié)省按鍵資源,以供更多的功能的使用。 本設計是 采用硬件描述語 言和 FPGA 芯片相結(jié)合進行的數(shù)字鐘的研究,從中可以看出 EDA 技術(shù)的發(fā)展在一定程度上實現(xiàn)了硬件設計的軟件化。設計的過程變的相對簡單,容易修改等優(yōu)點,相信隨著電子技術(shù)的發(fā)展,數(shù)字鐘的功能會更加多樣化,滿足人們的各種需要。 35 致謝 在論文完成之際,我首先要向指導 老師和志強和 章 瑞平 老師表示最真摯的謝意。 和志強和張瑞平 老師認真負責的工作態(tài)度,嚴謹?shù)闹螌W精神和深厚的理論水平都使我 受 益匪淺。無論在理論上還是在實踐中,都給與我很大的幫助 。在理論上,老師耐心講 解電路原理圖的繪制,以及元器件的性能;在實際操作中,從 系統(tǒng)的設計 到最終系統(tǒng)的調(diào)試 , 老師都給予了諸多幫助, 使我得到不少的提高, 這是在這次設計中我所得到的最寶貴的財富。 對于我以后的工作和學習都是一種巨大的幫助,感謝他 耐心的輔導。 在這次畢業(yè)設計中,我的專業(yè)知識水平也取得一定的進步。而這些進步都離不開老師和同學的幫助。在此我向曾經(jīng)幫助和關心我的老師和同學致以誠摯的感謝。 由于本人學識有限,加之時間倉促,文中不免有錯誤和待改進之處,真誠歡迎各位師長、同學提出寶貴意見。 36 附錄 1. 月計數(shù)模塊的程序: library ieee。 use 。 use 。 entity yue is port(enl,res,clk,yadd,ydec:in std_logic。 a,b:out std_logic_vector(3 downto 0)。 eryue,ysel,ca:out std_logic)。 end yue。 architecture SEC of yue is begin process(enl,clk,res) variable y0,y1:std_logic_vector(3 downto 0)。 begin if res=39。139。 then y0:=0000。 y1:=0000。 ca=39。039。 elsif clk39。event and clk=39。139。 then ca=39。039。 if yadd=39。139。 or enl=39。139。 then if y0=0010 and y1=0001 then y0:=0001。 y1:=0000。 ca=39。139。 elsif y01001 then y0:=y0+1。 ca=39。039。 else y0:=0000。 y1:=y1+1。 end if。 elsif ydec=39。139。 then 37 if y0=0001 and y1=0000 then y0:=0010。 y1:=0001。 elsif y00000 then y0:=y01。 else y0:=1001。 y1:=y11。 end if。 end if。 end if。 if ((y0=0100 or y0=0110 or y0=1001 ) and y1=0000)or (y0=0000 and y1=0001) then ysel=39。139。 else ysel=39。039。 end if。 if y0=0010 and y1=0000 then eryue=39。139。 else eryue=39。039。 end if。 a=y0。 b=y1。 end process。 end SEC。 : library ieee。 use 。 use 。 use 。 entity niand is port(enl,res,clk,nadd,ndec:in std_logic。 a,b,c,d:out std_logic_vector(3 downto 0)。 nsel:out std_logic)。 end niand。 38 architecture nd of niand is begin process(res,enl,clk) variable n0,n1,n2,n3:std_logic_vector(3 downto 0)。 begin if res=39。139。 then n0:=0000。 n1:=0000。 n2:=0000。 n3:=0000。 elsif clk39。event and clk=39。139。 then if nadd=39。139。 or enl=39。139。 then if n01001 then n0:=n0+1。 elsif n0=1001 then n0:=0000。 n1:=n1+1。 if n1=1010 then n1:=0000。 n2:=n2+1。 end if。 if n2=1010 then n2:=0000。 n3:=n3+1。 end if。 if n3=1010 then n3:=0000。 end if。 end if。 elsif ndec=39。139。 then if n00000 then n0:=n01 。 elsif n0=0000 and n1=0000 and n2=0000 and n3=0000 then n0:=1001。 n1:=1001。 n2:=1001。 39 n3:=1001。 elsif n0=0000 and n1=0000 and n2=0000 then n0:=1001。 n1:=1001。 n2:=1001。 n3:=n31。 elsif n0=0000 and n1=0000 then n0:=1001。 n1:=1001。 n2:=n21。 elsif n0=0000 then n0:=1001。 n1:=n11。 end if。 else n3:=0010。 end if。 if (n0(0)=39。039。 and n0(1)=39。039。 and n1(0)=39。039。)or(n0(0)=39。039。 and n0(1)=39。139。 and n1(0)=39。139。) then nsel=39。039。 else nsel=39。139。 end if。 end if。 a=n0。 b=n1。 c=n2。 d=n3。 end process。 end nd。 : library ieee。 use 。 use 。 40 use 。 entity seltime is port(disclk,conv:in std_logic。 m0,m1,f0,f1,s0,s1,r0,r1,y0,y1,n0,n1,n2,n3:in std_logic_vector(3 downto 0)。 dataout:out std_logic_vector(3 downto 0)。 wsel:out std_logic_vector(3 downto 0))。 end seltime。 architecture st of seltime is signal count:std_logic_vector(3 downto 0)。 begin wsel=count。 process(disclk,conv) begin if disclk39。event and disclk=39。139。 then if count=1010 then count=0000。 else count=count+1。 end if。 end if。 if conv=39。139。 then case count is when1010=dataout=s1。 when1001=dataout=s0。 when0110=dataout=f1。 when0101=dataout=f0。 when0100=dataout=m1。 when0011=dataout=m0。 when others =dataout=0000。 end case。 else 41 case count is when1010=dataout=n3。 when1001=dataout=n2。 when1000=dataout=n1。 when0111=dataout=n0。 when0110=dataout=y1。 when0101=dataout=y0。 when0100=dataout=r1。 when0011=dataout=r0。 whe