【正文】
陽泉職業(yè)技術(shù)學(xué)院畢 業(yè) 設(shè) 計(jì) 論 文基于 51 單片機(jī)的電子時鐘設(shè)計(jì)系 部: 信息系 專 業(yè): 電氣自動化班 級: 09 級一班學(xué)生姓名: 張瑞勇 學(xué) 號: 090723012 指導(dǎo)教師: 耿素軍 2022 年 5 月 6 日摘要隨著單片機(jī)技術(shù)的飛速發(fā)展,在其推動下,現(xiàn)代的電子產(chǎn)品幾乎滲透到了社會的各個領(lǐng)域,有力地推動了社會生產(chǎn)力的發(fā)展和社會信息化程度的提高,同時也使現(xiàn)代電子產(chǎn)品性能進(jìn)一步提高。時間就是金錢、時間就是生命、時間就是勝利……,準(zhǔn)確的掌握時間和分配時間對人們來說至關(guān)重要,時鐘是我們生活中必不可少的工具。電子鐘的設(shè)計(jì)方法有很多種,但是基于單片機(jī)并通過 LCD 顯示的電子時鐘具有編程靈活、精確度高、便于攜帶、顯示直觀等特點(diǎn)。 利用 STC89C52 單片機(jī)對 DS1302 時鐘芯片進(jìn)行讀寫操作并通過 1602 字符液晶顯示實(shí)時時鐘信息,這樣便構(gòu)成了一個單片機(jī)電子時鐘。關(guān)鍵詞:單片機(jī),電子時鐘,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è)計(jì)要求與方案論證 .........................................................................................2 設(shè)計(jì)要求 .............................................................................................................2 系統(tǒng)基本方案選擇和論證 .................................................................................2 單片機(jī)芯片的選擇方案和論證 .......................................................................2 顯示模塊選擇方案和論證 ..............................................................................2 時鐘芯片的選擇方案和論證 ..........................................................................3 電路設(shè)計(jì)最終方案決定 ....................................................................................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è)計(jì) ...................................................................................................13 電路設(shè)計(jì)框圖 ...................................................................................................13 系統(tǒng)硬件概述 ...................................................................................................13第 4 章 系統(tǒng)的軟件設(shè)計(jì) ...............................................................................................14 程序概述 ............................................................................................................14 延時函數(shù) ............................................................................................................15 對 DS1302 讀寫操作函數(shù) ................................................................................15 向 DS1302 寫數(shù)據(jù) .......................................................................................15 從 DS1302 讀數(shù)據(jù) .......................................................................................16 顯示函數(shù) ...........................................................................................................17 向 1602 液晶中寫一個指令 ...........................................................................17 向液晶寫數(shù)據(jù) ..............................................................................................17 初使化 1602 液晶 .........................................................................................17 如何在液晶上顯示時間、日期及周 ..............................................................18 按鍵函數(shù) ............................................................................................................19 12/24 小時顯示模式切換鍵 ......................................................................21 功能鍵函數(shù) .......................