介紹了多功能數(shù)字鐘的系統(tǒng)設(shè)計。系統(tǒng)具有時間設(shè)置及顯示、鬧鐘、溫度顯示等功能。系統(tǒng)以 AT89C52為核心,主要進(jìn)行基于AT89C52低功耗MCU的字符型數(shù)字鐘及其系統(tǒng)的研究。系統(tǒng)帶有液晶顯示器,配合按鍵提供友好的用戶界面,操作簡單,同時具有溫度檢測功能,時鐘數(shù)據(jù)和溫度數(shù)據(jù)也可通過RS232向上位機(jī)傳送。該數(shù)字鐘能長期、連續(xù)、可靠、穩(wěn)定的工作;同時還具有體積小、功耗低等特點,便于攜帶,使用方便。系統(tǒng)軟件設(shè)計包括單片機(jī)計算機(jī)兩部分的編程。計算機(jī)軟件編程主要實現(xiàn)參數(shù)設(shè)置、串行口數(shù)據(jù)接收、指令發(fā)送以及數(shù)據(jù)的顯示和存儲,采用Visual Basic語言編程。單片機(jī)軟件編程主要實現(xiàn)鍵盤、液晶顯示、溫度檢測等各模塊的功能,采用C語言編程。該系統(tǒng)通過串行口與計算機(jī)通信,計算機(jī)給單片機(jī)發(fā)指令實現(xiàn)數(shù)據(jù)采集及系統(tǒng)控制,并將數(shù)據(jù)實時地傳回計算機(jī)。
關(guān)鍵詞:數(shù)字鐘、液晶顯示、溫度檢測、串口通信
ABSTRACT
This paper describes the design of a multi-functiond digital clock system.It as displaying and setting time for clock and alarm,this system has other special features such as temperature measurement and data protection at power faillure.The core part of the system is based on a king of advanced MCU,AT89C52,this system mainly carries on low power consume MCU the character list type the research of the digital clock and its system according to the AT89 C52.The system takes liquid crystal display, matching with a key to provide amity of customer interface, the operation is simple, having the temperature examination function in the meantime, the clock data and the temperature data can also heading up a machine transmission through aRS232. consecution,credibility,stable work;Still have a physical volume in the meantime small,the power consume a low etc. characteristics, easy to take, the usage convenience.The system software design includes a single slice a plait distance with two parts of machine calculator.The calculator software plait distance mainly carries out a parameter constitution,string to go a people's data to receive,the instruction send out and data of manifestation with saving, the adoption Visual Basic languageplaitdistance.Singlelicethemachinesoftwareplaitdistance,LCDmanifestation,temperature examination each mold of etc. piece, adoption the C language plait distance.
That system goes and calculator correspondence through a string, the calculator give single slice machine hair the instruction carry out a data to collect and the system control, and is solid the data the ground send back a calculator.
Key words:digital clock,LCD,Alarm,Temperture displaying
1. 1數(shù)字鐘的研究的背景及意義
數(shù)字鐘是采用數(shù)字電路實現(xiàn)對.時,分,秒.數(shù)字顯示的計時裝置,廣泛用于個人家庭,車站, 碼頭辦公室等公共場所,成為人們?nèi)粘I钪胁豢缮俚谋匦杵?由于數(shù)字集成電路的發(fā)展和石英晶體振蕩器的廣泛應(yīng)用,使得數(shù)字鐘的精度,遠(yuǎn)遠(yuǎn)超過老式鐘表, 鐘表的數(shù)字化給人們生產(chǎn)生活帶來了極大的方便,而且大大地擴(kuò)展了鐘表原先的報時功能。諸如定時自動報警、按時自動打鈴、時間程序自動控制、定時廣播、自動起閉路燈、定時開關(guān)烘箱、通斷動力設(shè)備、甚至各種定時電氣的自動啟用等,所有這些,都是以鐘表數(shù)字化為基礎(chǔ)的。因此,研究數(shù)字鐘及擴(kuò)大其應(yīng)用,有著非,F(xiàn)實的意義。
本作品采用Atmel公司的AT89C51單片機(jī),以匯編語言為程序設(shè)計的基礎(chǔ),設(shè)計一個用四位數(shù)碼管顯示時、分的時鐘。在實物圖中,左邊靠近電源的綠色發(fā)光二極管(長亮)是電源指示燈,表示的是5V穩(wěn)定電源工作正常;單片機(jī)左下角紅色發(fā)光二極管是秒燈,每閃爍一次表示時間走動一秒鐘;按鍵正上方綠色發(fā)光二極管是設(shè)置燈,當(dāng)時間正常走動時此時不亮,當(dāng)?shù)谝淮伟聪略O(shè)置鍵(右鍵)時,此綠燈亮,同時秒時熄滅,且分鐘的兩位數(shù)碼管出現(xiàn)閃爍,時間停止走動,進(jìn)入校時狀態(tài),表示此時可以進(jìn)行分鐘的調(diào)整,當(dāng)按一次加一鍵(左鍵)可實現(xiàn)分鐘的加一功能,分鐘以60分為極限,超出60分則返回數(shù)值0,從0再重新算起;如果再次按下設(shè)置鍵時,這時秒燈和設(shè)置燈仍舊保持熄滅和點亮狀態(tài),表示分鐘的數(shù)碼管停止閃爍,反過來表示小時的兩位數(shù)碼管則開始閃爍,此時可進(jìn)行小時的調(diào)整,按加1鍵可實現(xiàn)小時的加1功能,小時調(diào)整以24為上限,同樣超出24小時則從新回0;當(dāng)?shù)谌伟聪略O(shè)置鍵時,數(shù)碼管停止閃爍,設(shè)置燈熄滅,秒燈重新閃爍,時間以設(shè)定值計時。