【正文】
二,ATMEGA16與 DS130LCD51SPI 之間是否連接準確,必須嚴格對照電路圖檢查。第三,用萬能表仔細檢查每個焊點是否虛焊,本系統(tǒng)用雙排針做單片機的 SPI,焊接時很容易使相鄰管腳連接到一塊,這種情況尤其要注意,一經發(fā)現(xiàn),必須用工具將其斷路。在燒入代碼時完成以上硬件檢測工作后,燒入代碼仍然不能正常運行,此后則需要結合軟件調試來分析是否是硬件問題,如果將代碼燒入其他設備可正常運行,則說明本設計的硬件依然有問題,則需要繼續(xù)排查。本設計系統(tǒng)板子焊好后接通電源無法通電,經萬用表檢測,發(fā)現(xiàn) ATmega16 芯片管腳有焊連錯誤并且指示燈連接錯誤,改正后問題解決。 軟件調試用雙龍下載器將代碼燒寫進本設計系統(tǒng),在液晶屏上觀測運行結果。最開始,液晶屏完全無顯示,僅有背景燈光。于是從硬件、軟件兩部分分別排查,用以上硬件檢測方法后,再進行軟件檢測。軟件檢測需要分模塊進行。筆者及小組成員首先檢測液晶屏,向液晶屏燒入一段簡單的顯示程序,結果正常,排除了液晶屏的硬件問題,經過繼續(xù)的排查,考慮是實時時鐘芯片 DS1302 的代碼編寫不正確。經過仔細閱讀芯片手冊,發(fā)現(xiàn) DS1302 的讀寫操作需要提高注意,在寫一個字節(jié)的時候,AVR 單片機的 I/O 口應該一直保持輸出狀態(tài),但在讀一個字節(jié)的時候,AVR 單片機的 I/O 口應該先是輸出狀態(tài),然后變?yōu)檩斎霠顟B(tài),而且必須改變時鐘信號的順序,所以筆者經調試明白了時鐘信號與復位(片選)信號的關系:在寫入數(shù)據(jù)時,河北師范大學本科生畢業(yè)論文16當 RST 信號還沒有拉高之前,必須把時鐘信號初始化拉低。本設計系統(tǒng)小結 系統(tǒng)不足及功能拓展首先總結本設計系統(tǒng)的不足以及可考慮的進一步拓展:1) 可設置復位按鍵、調整時間按鍵(現(xiàn)在只能通過程序復位、設初始值,不能自動調時間)。2) 基于 ds1302 的缺陷,“年”時鐘寄存器只能控制個位及十位數(shù)字。3) 可加上蜂鳴器,利用中斷實現(xiàn)整點報時。4) 可設置鬧鈴功能。5) 可加上 DS18B20 溫度傳感器顯示溫度或加上 SHT11 溫濕度傳感器,在屏幕上動態(tài)顯示 實時溫濕度。 學習心得與展望本次畢業(yè)設計系統(tǒng)的學習心得與展望有:1) 理論與實踐相結合的重要性,通過實際動手,進一步學習了單片機知識。2) 學會了自主學習芯片的方法與技巧及編程上的經驗,如:片選拉高之前必須將時鐘拉低,但是這一點芯片手冊時序圖不顯示,需經驗積累。3) 通過實際動手打開了思路,有信心在短時間內學習一種芯片。4) 知識的嚴密性很重要,團隊合作很重要。參考文獻[1] 楊欣等.電子設計從零開始[M].北京:清華大學出版社..[2] 李軍,劉君華. AVR 單片機的特點及其應用[J]. 測控技術 , 2022,(07) .[3] 李慧. 基于 FPGA 的電子萬年歷設計[J]. 微計算機信息 , 2022,(20) .[4] ,.[5] 李振軍.電路設計基礎與典型范例[M].北京:電子工業(yè)出版社..河北師范大學本科生畢業(yè)論文17Abstract: from the ancient time hourglass, to the present mechanical clock and watch, quartz clock, The timing technology development has gone through a long process of improvement, which fully shows the importance of time for both of the ancients and us now. Now, the global society has entered the information age, people bee more heavy dependence on time measurement precision, so that the clock is more and more widely used functional. Clearly, ordinary mechanical watches can’t satisfy the plex modern requirement, electronic clock emerge as the times require. Electronic clock time can not only meet the basic requirements, and it’s smallvolume, lowcost, the biggest bright spot is that it can be improved according to the needs of different customers by increasing the functions, so the electronic clock is more and more popular of people.This topic is focus on this and the main purpose of the study is to design a clock system based on the MCU. Due to the MCU has the advantages of affordable and plete functions, it is widely used in automatic control products. The study regard ATmega16 chip as the core, and is mainly made of real time clock chip DS1302, plete its display and timing function through the LCD screen, this design has conpleted the the hardware circuit function, and software programming using C language.Keywords: electronic clock DS1302 LCD scre