【正文】
月、日、星期、時(shí)、分、秒等顯示功能; ( 2) 具有溫度顯示功能; ( 3) 具備年、月、日、星期、時(shí)、分、秒校準(zhǔn)、調(diào)整功能。 電子鐘是一種利用數(shù)字電路來(lái)顯示秒、分、時(shí)的計(jì)時(shí)裝置,與傳統(tǒng)的機(jī)械鐘相比,它具有計(jì)時(shí)準(zhǔn)確、顯示直觀等優(yōu)點(diǎn),因而得到廣泛應(yīng)用。尤其是單片機(jī)技術(shù)的應(yīng)用產(chǎn)品已經(jīng)走進(jìn)了千家萬(wàn)戶。s long life, small error. For the digital electronic calendar using an intuitive digital display can simultaneously display year, month, day, Sunday, hours, minutes, seconds, and temperature and other information, but also a timecalibration and other functions. The circuit uses AT89S52 microcontroller as the core, power consumption, lowvoltage work in 3V, the voltage can choose 3 ~ 5V voltage supply. The design is based on 51 series of microcontrollers to the design of electronic calendar, you can display date information on when the minutes and seconds, and weeks, with adjustable date and time functions. At the same time in the design of the theoretical basis of the MCU and peripheral expansion of knowledge of the more prehensive preparation. The hardware and software design, there is no good basic knowledge and practical experience will be greatly limited, each feature is required to achieve the kind of hardware, procedures, how to write, how to implement such algorithms, there is no certain foundation can not be good implementation. Found during the preparation process to the existing knowledge to plete the preparation of the task alone difficult,In the help of teachers and students to plete the program part of the preparation. Calendar of the design process in hardware and software to synchronize the design. Hardware mainly by the AT89S52 microcontroller, LCD1602 display circuit, and the tune posed of the circuit when the button. In the SCM choice I used the AT89S52 microcontroller, which is suitable for many of the more plex control applications. Monitor the use of software includes calendar program, time to adjust procedures, display programs. Programs written in assembly language used in order to more easily adjust the time and the realization of the lunar calendar display. All programming is plete, the Keil software debugging, make sure that no problems, in the Proteus software within a microcontroller embedded in the simulation. The final overall the teacher to help students, as well as their own efforts to plete the design of the electronic calendar. Keywords: Clock electric clock:DS1302。最后在老師同學(xué)的幫助以及自己的努力下完成了此次電子萬(wàn)年歷的設(shè)計(jì)。程序采用C 語(yǔ)言編寫,以 便更簡(jiǎn)單地實(shí)現(xiàn)調(diào)整時(shí)間功能。 顯示由 LCD1602并行輸出。硬件部分主要由AT89S52 單片機(jī), LCD1602 顯示電路,以及調(diào)時(shí)按鍵電路等組成。在編寫程序過(guò)程中發(fā)現(xiàn)以現(xiàn)有的相關(guān)知識(shí)要獨(dú)自完成編寫任務(wù)困難重重,在老師和同學(xué)的幫助下才完成了程序部分的編寫。在設(shè)計(jì)的同時(shí)對(duì)單片機(jī)的理論基礎(chǔ)和外圍擴(kuò)展知識(shí)進(jìn)行了比較全面準(zhǔn)備。該電路采用 AT89S52 單片機(jī)作為核心,功耗小,能在 3V 的低壓工作,電壓可選用 3~ 5V 電壓供電。它可以對(duì)年、月、日、周日、時(shí)、分、秒進(jìn)行計(jì) 時(shí),還具有閏年補(bǔ)償?shù)榷喾N功能,而且 DS1302 的使用壽命長(zhǎng),誤差小。它體積小,成本低,功能強(qiáng),廣泛應(yīng)用于智能產(chǎn)業(yè)和工業(yè)自動(dòng)化上?;趩纹瑱C(jī)的萬(wàn)年歷的設(shè)計(jì)與制作 摘要 : 單片機(jī)應(yīng)用技術(shù)飛速發(fā)展,縱觀我們現(xiàn)在生活的各個(gè)領(lǐng)域,從導(dǎo)彈的導(dǎo)航裝置,到飛機(jī)上各種儀表的控制,從計(jì)算機(jī)的網(wǎng)絡(luò)通訊與數(shù)據(jù)傳輸,到工業(yè)自動(dòng)化過(guò)程的實(shí)時(shí)控制和數(shù)據(jù)處理,以及我們生活中廣泛使用的各種智能 IC 卡、電子寵物等,這些都離不開單片機(jī)。單片機(jī)是集 CPU 、 RAM 、 ROM、 定時(shí) 、 計(jì)數(shù)和多種接口于一體的微控制器。 電子萬(wàn)年歷是一種非常廣泛日常計(jì)時(shí)工具,對(duì)現(xiàn)代社會(huì)越來(lái)越流行。對(duì)于數(shù)字電子萬(wàn)年歷采用直觀的數(shù)字顯示,可以同時(shí)顯示年、月、日、周、時(shí)、分、秒和溫度等信息,還具有時(shí)間校準(zhǔn) 等 功能 。 本設(shè)計(jì)是基于 51 系列的單片機(jī)進(jìn)行的電子萬(wàn)年歷設(shè)計(jì),可以顯示年月日時(shí)分秒及周信息,具有可調(diào)整日期和時(shí)間功能。在硬件與軟件設(shè)計(jì)時(shí),沒(méi)有良好的基礎(chǔ)知識(shí)和實(shí)踐經(jīng)驗(yàn)會(huì)受到很大限制, 每項(xiàng)功能實(shí)現(xiàn)時(shí)需要哪種硬件,程序該如何編寫,算法如何實(shí)現(xiàn)等,沒(méi)有一定的基礎(chǔ)就不可能很好的實(shí)現(xiàn)。 萬(wàn)年歷的設(shè)計(jì)過(guò)程在硬件與軟件方面進(jìn)行同步設(shè)計(jì)。單片機(jī)使用了AT89S52 單片機(jī),該單片機(jī)適合于許多較為復(fù)雜控制應(yīng)用場(chǎng)合。 軟件方面主要包括日歷程序、時(shí)間調(diào)整程序,顯示程序等。所有程序編寫完成后,在 Keil軟件中進(jìn)行調(diào)試,確定沒(méi)有問(wèn)題后,在 Proteus 軟件中嵌入單片機(jī)內(nèi)進(jìn)行仿真。 關(guān)鍵詞: 時(shí)鐘電鐘; DS1302;動(dòng)態(tài)掃描; 51 單片機(jī) Abstract SCM application technology develop rapidly, looking around us now in all spheres of life, from missiles, navigation equipment, to the various instruments on the aircraft control from a puter work munications and data transmission, industrial automation to realtime process control and data processing, and our lives extensive use of the smart card, electronic pets, which is inseparable from the microcontroller. Monolithic singlechip is the set of CPU, RAM, ROM, the timing, number and variety of interface integrated microcontrollers. Its small size, low cost, high performance, which are widely used in smart industries, and industrial automation. Ecalendar day time is a very wide range of tools, increasingly popular in modern society. It can be year, month, day, Sunday, hours, minutes, seconds for time, but also has a leap year pensation to a variety of functions, and the DS130239。 Dynamic scan:51SCM 引言 當(dāng)今社會(huì)電子技術(shù)迅速的發(fā)展,特別是隨著大規(guī)模集成電路的出現(xiàn),給人類生活帶來(lái)了根本性的改變。電子萬(wàn)年歷的出現(xiàn)給人們的生活帶來(lái)諸多方 便。隨著人們生活環(huán)境的不斷改善和美化,在很多場(chǎng)合可以看到數(shù)字電子鐘。 系統(tǒng)基本方案選擇及論證 單片機(jī)芯片的選擇方案和論證 方案一 : 采用 89C51 芯片作為硬件核心,采用 Flash ROM,內(nèi)部具有 4KB ROM 存儲(chǔ)空間 ,能于 3V 的超低壓工作 ,而且與 MCS51 系列單片機(jī)完全兼容 ,但是運(yùn)用于電路設(shè)計(jì)中時(shí)由于不具備 ISP 在線編程技術(shù) , 當(dāng)在對(duì)電路進(jìn)行調(diào)試時(shí),由于程序的錯(cuò)誤修改或?qū)Τ绦虻男略龉δ苄枰獰氤绦驎r(shí),對(duì)芯片的多次拔插會(huì)對(duì)芯片造成一定的損壞。 所以選擇采用 AT89S52 作為主控制系統(tǒng) . 顯示模塊的選擇方案和論證 方案一: 采用 LED 數(shù)碼管動(dòng)態(tài)掃描 ,LED 數(shù)碼管價(jià)格適中 ,對(duì)于顯示數(shù)字 很 合適 ,但考慮本次設(shè)計(jì)中要顯示多位日期數(shù)據(jù),并且要顯示溫度數(shù)據(jù),在實(shí)際電路連接時(shí)會(huì)需要很多連線,增加出問(wèn)題的可能性,所以不采用此方案。并且可以同時(shí)顯示大量信息 ,所以在此設(shè)計(jì)中采用 LCD 液晶顯示屏 。 時(shí)鐘芯片的選擇方案和論證 方案一: 不使用芯片 ,直接采用單片機(jī)定時(shí)計(jì)數(shù)器提供秒信號(hào),使用程序?qū)崿F(xiàn)年、月、日、星期、時(shí)、分、秒計(jì)數(shù)。所以不采用此方案。但是對(duì)于80C52 單片機(jī)來(lái)說(shuō) ,低位地址線要通過(guò)鎖存器輸出 ,還要地址譯碼器 ,而且并行口芯片的體積相對(duì)較大 。 溫度傳感器的選擇方案和論證 方案一: 使用熱敏電阻作為傳感器,用熱敏電阻與一個(gè)相應(yīng)阻值電阻相串聯(lián)分壓,利用熱敏電阻阻值隨溫度變化而變化的特性,采集這兩個(gè)電阻變化的分壓值,并進(jìn)行 A/D 轉(zhuǎn)換。 方案二: 采用數(shù)字式溫度傳感器 DS18B20,此類傳感器為數(shù)字式傳感器而且僅需要一條數(shù)據(jù)線進(jìn)行數(shù)據(jù)傳輸,易于與單片機(jī)連接,可以去除 A/D 模塊,降低硬件成本,簡(jiǎn)化系統(tǒng)電路。 所以選用 DS18B20 作為溫度采集部分的傳感器。 匯編語(yǔ)言 能充分地發(fā)揮指令系統(tǒng)的功能和效率,可獲得最簡(jiǎn)練的目標(biāo)程序,但可讀性卻不強(qiáng),復(fù)雜一點(diǎn)的程序就更難讀懂了,而本設(shè)計(jì)的軟件設(shè)計(jì)部分必然是需要大篇幅的程序作為支持的,所以不采用匯編語(yǔ)言作為此次設(shè)計(jì)的編程語(yǔ)言。 C語(yǔ)言提供了很多函數(shù),并支持浮點(diǎn)運(yùn)算,開發(fā)效率高,故可縮短開發(fā)時(shí)間,增加程序可讀性和可維護(hù)性。 相比匯編語(yǔ)言, C51對(duì)單片機(jī)的指令系統(tǒng)不要求了解,僅要求對(duì) MCS51的存儲(chǔ)結(jié)構(gòu)有初步了解,無(wú)須懂得單片機(jī)的具體硬件,也能編出符合硬件實(shí)際的專業(yè)水平的程序。 電路設(shè)計(jì)與最終方案 綜上各方案所述 ,對(duì)該萬(wàn)年歷設(shè)計(jì)方案的最終選定 : 采用 AT89S52 作為主 控制系統(tǒng); DS1302 提供時(shí)鐘 。 第二章 主要硬件描述 單片機(jī) AT89S52 單片機(jī)簡(jiǎn)介 單片微型計(jì)算機(jī)( Single— Chip Microputer) ,簡(jiǎn)稱單片機(jī),就是將微處理器( CPU)、存儲(chǔ)器 ROM 和 RAM、定時(shí)器 /計(jì)數(shù)器、中斷系統(tǒng)、輸入 /輸出接口( I/O 接口)、總線和其他多功能器件集成在一塊芯片上的微型計(jì)算機(jī)。 單片機(jī)的主要特點(diǎn)如下。許多信號(hào)的通道均集成在一個(gè)芯片內(nèi),所以運(yùn)行時(shí)系統(tǒng)穩(wěn)定可靠。 ( 3) 控制功能強(qiáng) 具有豐富的控制指令,可以對(duì)邏輯功能比較復(fù)雜的系統(tǒng)進(jìn)行控制。許多單片機(jī)可以在 3V,甚至更低的電壓下運(yùn)行,有 些單片機(jī)的工作電流已降至 A? ( 5) 片內(nèi)存儲(chǔ)容量較小 單片機(jī)內(nèi)部 ROM的存儲(chǔ)容量一般小于 8KB, RAM 的存儲(chǔ)容量一般小于 256B,但可以在外部擴(kuò)展。 除此之外,單片機(jī)還具有集成度