【正文】
所設計的電子鐘目標為實現(xiàn)以下功能:①24 小時制時間顯示;②可隨時進行時間校對;③秒表計時功能;④鬧鐘功能。當有按鍵按下時,單片機轉(zhuǎn)而處理按鍵。1 系統(tǒng)結(jié)構(gòu)系統(tǒng)由單片機 AT89S51 為主控制器,單片機不斷讀取實時鐘 DS1302 提供的時間,送 LED 顯示。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 大學畢業(yè)設計(論文) 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.基于單片機的秒表/時鐘計時器設計 28 中文翻譯基于 AT89S51 的電子鐘系統(tǒng)設計0 引言電子鐘已成為人們?nèi)粘I钪械谋匦杵?,廣泛應用于家庭、車站、碼頭、劇院、辦公室等場所,給人們的生活、學習、工作帶來極大的方便。 ③ Stopwatch countdown function. ④ Alarm clock function. SCM AT89S51AT89S51 is a section low power loss and high performance CMOS 8 SCM Internal may scratch repeatedly including 4KB online programmable (ISP) writes 1000 time Flash readonly program memory, the ponent uses the high density, nonAT89S51 has the following characteristic: In order to adapt the different product demand, uses PDIP, TQFP, the PLCC three kind of seal forms, this system uses the double row direct PDIP seal form, 4KB the Flash internal program memory, the 128B random access datacarrier storage, 32 exterior bidirectional inputs/output (I/O), 5 interrupt priorities, 2 interrupt nesting interrupt, 2 16 programmable fixed time counters, 2 fullduplexes serial pass unguardedly, watchdog (WDT) electric circuit, internal clock oscillator. In addition, AT89S51 designed and disposes the oscillation frequency to be possible to be 0Hz and may through the software establishment province electricity pattern. Under idle mode, CPU suspension work, but the RAM fixed time counter, the serial port, outside the interruption system may continue to work, falls the electricity pattern freeze oscillator to preserve RAM the data, until stops the chip other functions outside interrupting activates or the hardware repositions. 基于單片機的秒表/時鐘計時器設計 26 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。作者:楊 靜 2022 年 6 月 5 日基于單片機的秒表/時鐘計時器設計 22 參考文獻[1] [M]. 北京:化學工業(yè)出版社,[2] 向繼文, AT89S51 的電子鐘系統(tǒng)設計[J].機電產(chǎn)品開發(fā)與創(chuàng)新,2022,20(2):6263[3] [J].長春大學學報,2022,14(4):3639[4] 張景元,[J].中文核心期刊《微計算機信息》 ,2022,21(92):136137[5] 求是科技,[M].北京:人民郵電出版社,[6] [M].北京:北京航空航天大學出版社,[7] 楊將新等 單片機程序設計及應用從基礎到實踐[M] 電子工業(yè)出版社 2022[8] 馮育長主編 .:西安電子科技大學 2022[9] 范立南,謝子殿 單片機原理及應用教程[M].北京:北京大學出版社,[10] 李廣弟. 單片機基礎[M]. 北京:北京航空航天大學出版社,[11] 楊振江,:西安電子科技大學出版社2022[12] 王振宇. 基于單片機設計的多功能定時器[J].貴州教育學院 2022[13] [M]. 北京:電子工業(yè)出版社, 2022[14] 程小東等 .電氣工程專業(yè)英語實用教程[M].北京:清華大學出版社,2022[15] 樓然苗等 .51 系列單片機設計實例[M].北京:北京航空航天大學出版社,2022[16] 系列單片機原理與接口技術[M].北京:北京航空航天大學出版社2022[17] 劉瑞新. 單片機原理及應用教程[M].北京:機械工業(yè)出版社,2022[18] 系列單片機應用技術[M].北京:北京航空航天大學出版社,2022[19] 周航慈