【正文】
Fixed time chip DS13021 Basic function The clock generated by the timer is monly known as soft clock. Generally, when there are many interrupts during the procedure, the error is very large. At this time we generally use the external clock chip approach, and the precision can guarantee. Below we will introduce the use of the DS1302 clock chip. DS1302 includes a clock/calendar and 31B condition RAM , carries on the correspondence through the simple SPI serial munication and the provides the information of the second, minute, hour, the date, the month and the year .The days of each month and the leap year may be controlled automatically. And it is possible to use 24 or 12 hours forms. Between DS1302 and SCM can select the SPI synchronization serial method to carry on the correspondence, only needs the replacement, the data and the clock three I/O mouth line. The major targets or quotas are as following: Containing 31B datacarrier storage. Working voltage: ~. ? Operating current: When low pressure volts, it is smaller than 300nA. Serial SPI three connection ways. ? 8 pin DIP or the SOIC table pastes the seal. ? DS1302pin sequence is shown in Figure 2, and SCM connections is shown in Figure 3? X1, X2: KHz crystal oscillator pin. ? GND: the earth? RST: Replacement pin. ? I/O: Data feeds/output pin. ? SCLK: Serial clock.? Vcc1, Vcc2: The power source, ? VCC1 may meet the reserve battery. 2 DS1302 interior register DS1302 is posed of the controls, the year, the month, the date, when, minute and the second working register, each register’s last data indication the way of reads/writes: For “0” reads the condition。1 系統(tǒng)結(jié)構(gòu)系統(tǒng)由單片機(jī) AT89S51 為主控制器,單片機(jī)不斷讀取實(shí)時(shí)鐘 DS1302 提供的時(shí)間,送 LED 顯示。所設(shè)計(jì)的電子鐘目標(biāo)為實(shí)現(xiàn)以下功能:①24 小時(shí)制時(shí)間顯示;②可隨時(shí)進(jìn)行時(shí)間校對(duì);③秒表計(jì)時(shí)功能;④鬧鐘功能。當(dāng)有按鍵按下時(shí),單片機(jī)轉(zhuǎn)而處理按鍵。clock register 1 0 0 0 0 1 1 0/1 Date register1 0 0 0 1 0 0 0/1 on register 1 0 0 0 1 0 1 0/1 Week register 1 0 0 0 1 1 0 0/1 Year register Chart13 various registers addresses XX 大學(xué)畢業(yè)設(shè)計(jì)(論文) 27 3 Read with the SCM connection software design The processes of read/write between the SCM and the clock are the process of reading/writing each register of the DS1302 in the essence. Set at the RST for high before data transfer, and then transmit one 8 order character having the address and order information to the register. The order byte determines homing register is to read the operation or to write the operation. In a clock cycle, at the rising edge of the SCLK data inputting is effective and at the falling edge of SCLK outputting is effective. If what the RST end inputs is low level, all data transfer will be terminated, and the I/O foot will be at the highresistance reads/writes data succession as shown in Figure simple explanation is as following: SCLK RST I/O 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 Order character Data Figure 14 DS1302 reads/writes the data succession chartData input: after inputting the importation of writing order byte’s eight bytes SCLK cycle, the data byte begins to import data from the low after the eight SCLK the rising edge of inputting, Data output: after inputting reading order byte’s eight SCLK cycle, the data byte begins to import data when the eight SCLK is falling edge of inputting. The first data will output when the first falling edge of the writing order’s last bit. As long as the RST remains high there will be continuing to output data during the lasting SCLK cycle.基于單片機(jī)的秒表/時(shí)鐘計(jì)時(shí)器設(shè)計(jì) 28 中文翻譯基于 AT89S51 的電子鐘系統(tǒng)設(shè)計(jì)0 引言電子鐘已成為人們?nèi)粘I钪械谋匦杵?,廣泛應(yīng)用于家庭、車站、碼頭、劇院、辦公室等場(chǎng)所,給人們的生活、學(xué)習(xí)、工作帶來(lái)極大的方便。作者:楊 靜 2022 年 6 月 5 日基于單片機(jī)的秒表/時(shí)鐘計(jì)時(shí)器設(shè)計(jì) 22 參考文獻(xiàn)[1] [M]. 北京:化學(xué)工業(yè)出版社,[2] 向繼文, AT89S51 的電子鐘系統(tǒng)設(shè)計(jì)[J].機(jī)電產(chǎn)品開(kāi)發(fā)與創(chuàng)新,2022,20(2):6263[3] [J].長(zhǎng)春大學(xué)學(xué)報(bào),2022,14(4):3639[4] 張景元,[J].中文核心期刊《微計(jì)算機(jī)信息》 ,2022,21(92):136137[5] 求是科技,[M].北京:人民郵電出版社,[6] [M].北京:北京航空航天大學(xué)出版社,[7] 楊將新等 單片機(jī)程序設(shè)計(jì)及應(yīng)用從基礎(chǔ)到實(shí)踐[M] 電子工業(yè)出版社 2022[8] 馮育長(zhǎng)主編 .:西安電子科技大學(xué) 2022[9] 范立南,謝子殿 單片機(jī)原理及應(yīng)用教程[M].北京:北京大學(xué)出版社,[10] 李廣弟. 單片機(jī)基礎(chǔ)[M]. 北京:北京航空航天大學(xué)出版社,[11] 楊振江,:西安電子科技大學(xué)出版社2022[12] 王振宇. 基于單片機(jī)設(shè)計(jì)的多功能定時(shí)器[J].貴州教育學(xué)院 2022[13] [M]. 北京:電子工業(yè)出版社, 2022[14] 程小東等 .電氣工程專業(yè)英語(yǔ)實(shí)用教程[M].北京:清華大學(xué)出版社,2022[15] 樓然苗等 .51 系列單片機(jī)設(shè)計(jì)實(shí)例[M].北京:北京航空航天大學(xué)出版社,2022[16] 系列單片機(jī)原理與接口技術(shù)[M].北京:北京航空航天大學(xué)出版社2022[17] 劉瑞新. 單片機(jī)原理及應(yīng)用教程[M].北京:機(jī)械工業(yè)出版社,2022[18] 系列單片機(jī)應(yīng)用技術(shù)[M].北京:北京航空航天大學(xué)出版社,2022[19] 周航慈. 單片機(jī)程序設(shè)計(jì)基礎(chǔ)[M].北京:北京航空航天大學(xué)出版社,1997[20] Microcontroller with 8K Bytes AT89C51,1999XX 大學(xué)畢業(yè)設(shè)計(jì)(論文) 23 基于單片機(jī)的秒表/時(shí)鐘計(jì)時(shí)器設(shè)計(jì) 24 附錄 A 系統(tǒng)原理圖123456ABCD654321D C B ATitleNumberRevisionSize BDate:9Jun2022 Sheet of File:H:\楊楊\楊楊\yDrawn By:C2104C3104C4104+5V12CON2123456789RE1390R390R390R12345678RST9RXD10TXD11INT012INT113T014T115WR16RD17XTAL118XTAL219VSS202122232425262728PSEN29ALE30EA313233343536373839VCC40U1 AT89S51390R390R390R390R390R+5v+5v+5v+5vAD1 IN50488XTAL1XTAL292MC1115PC1215PC1315PC1415PNC1X12X23GND4RST5I/O6SCLK7VDD8U2 DIS302+5VE110uF R92K+5VSCLKIORSTRESTLEDA LEDBLEDC LEDDLEDE LEDFLEDG LEDHLEDA LEDBLEDC LEDDLEDE LEDFLEDG LEDHLEDALEDBLEDCLEDDLEDELEDFLEDGLEDH SCLKIORSTCOM1COM2COM3COM4COM5COM6Q2 9012Q3 9012Q4 9012+5V+5V+5V+5VQ5 9012Q6 9012+5V+5V+5VR6 2KR5 2KR1 2K R2 2K R3 2K R4 2KCOM5COM6COM1COM2COM3COM412345 +5V11223344