【正文】
月、日、星期、時、分、秒計數(shù)。方案二:采用 LED 數(shù)碼管動態(tài)掃描??紤]到成本因素,因此選用 STC89C52。STC89C52 內(nèi)部具有 8KB ROM 存儲空間,512 字節(jié)數(shù)據(jù)存儲空間,帶有 2K 字節(jié)的 EEPROM 存儲空間,與 MCS51 系列單片機完全兼容,STC89C52 可以通過串口下載。在單片機的應(yīng)用系統(tǒng)中,時鐘有兩個方面的含義:一是指為保障系統(tǒng)正常工作的基準(zhǔn)振蕩定時信號,主要由晶振和外圍電路組成,晶振頻率的大小決定了單片機系統(tǒng)工作的快慢;二是指系統(tǒng)的標(biāo)準(zhǔn)定時時鐘,即定時時間,它通常有兩種實現(xiàn)方法:一是用軟件實現(xiàn),即用單片機內(nèi)部的可編程定時器/計數(shù)器來實現(xiàn);二是用專門的時鐘芯片實現(xiàn)。怎樣讓時鐘更好、更方便、更精確的顯示時間,這就要求人們不斷設(shè)計研發(fā)出新型的時鐘。 利用 STC89C52 單片機對 DS1302 時鐘芯片進行讀寫操作并通過 1602 字符液晶顯示實時時鐘信息,這樣便構(gòu)成了一個單片機電子時鐘。陽泉職業(yè)技術(shù)學(xué)院畢 業(yè) 設(shè) 計 論 文基于 51 單片機的電子時鐘設(shè)計系 部: 信息系 專 業(yè): 電氣自動化班 級: 09 級一班學(xué)生姓名: 張瑞勇 學(xué) 號: 090723012 指導(dǎo)教師: 耿素軍 2022 年 5 月 6 日摘要隨著單片機技術(shù)的飛速發(fā)展,在其推動下,現(xiàn)代的電子產(chǎn)品幾乎滲透到了社會的各個領(lǐng)域,有力地推動了社會生產(chǎn)力的發(fā)展和社會信息化程度的提高,同時也使現(xiàn)代電子產(chǎn)品性能進一步提高。關(guān)鍵詞:單片機,電子時鐘,STC89C52 ABSTRACTWith the rapid development of microputer technology in its promotion, modern electronics into almost all areas of society, a strong impetus to the development of social productive forces and social improvement in the level of information, but also to further improve the performance of modern electronic products.Time is a money, time is life, time is victory… Accurate grasp of time and allocation of time is crucial to people, The clock is necessary in our life tools . Clock Design There are many ways, however, produced by single chip electronic clock is more flexible programming, and easy expansion of electronic capabilities, high accuracy, easy to carry, display visual and so on. In this paper, through the use of STC89C52 microcontroller by DS1302 clock chips for reading and writing operation and through 1602 character liquid crystal display realtime clock information so that forming a single chip electronic clock. Key Words: Microcontroller,STC89C52 ,Electronic clock, 目錄緒論 ...................................................................................................................................1概述 ............................................................................................................................1研究目的 ....................................................................................................................1第 1 章 設(shè)計要求與方案論證 .........................................................................................2 設(shè)計要求 .............................................................................................................2 系統(tǒng)基本方案選擇和論證 .................................................................................2 單片機芯片的選擇方案和論證 .......................................................................2 顯示模塊選擇方案和論證 ..............................................................................2 時鐘芯片的選擇方案和論證 ..........................................................................3 電路設(shè)計最終方案決定 ....................................................................................3第 2 章 主要元件介紹 .....................................................................................................4 STC89C52 介紹 ................................................................................................4 STC89C52 主要功能及 PDIP 封裝 ................................................................4 STC89C52 引腳介紹 ....................................................................................4 STC89C52 最小系統(tǒng) ....................................................................................5 DS1302 時鐘芯片介紹 .....................................................................................6 DS1302 概述 ...............................................................................................6 DS1302 引腳介紹 .........................................................................................7 DS1302 使用方法 ........................................................................................72. 3 1602 字符液晶介紹 .........................................................................................9 1602 液晶概述 .............................................................................................9 1602 引腳介紹 .............................................................................................10 1602 字符液晶使用方法 .............................................................................10第 3 章 系統(tǒng)硬件設(shè)計 ...................................................................................................13 電路設(shè)計框圖 ...................................................................................................13 系統(tǒng)硬件概述 ...................................................................................................13第 4 章 系統(tǒng)的軟件設(shè)計 ...............................................................................................14 程序概述 ............................................................................................................14 延時函數(shù) ............................................................................................................15 對 DS1302 讀寫操作函數(shù) ................................................................................15 向 DS1302 寫數(shù)據(jù) .......................................................................................15 從 DS1302 讀數(shù)據(jù) .......................................................................................16 顯示函數(shù) ...........................................................................................................17 向 1602 液晶中寫一個指令 ...........................................................................17 向液晶寫數(shù)據(jù) ..............................................................................................17 初使化 1602 液晶 .........................................................................................17 如何在液晶上顯示時間、日期及周 .............................................................