使用DS1307的PIC单片机-Using a DS1307

控制/MCU

1883人已加入

描述

Abstract: This application note is intended to demonstrate an application using the DS1307 Real-Time Clock with a Microchip PIC microcontroller. The software example includes basic operating routines, and a schematic of the application circuit is included.

Discussion

This application note demonstrates how to use the DS1307 real-time clock (RTC) with a Microchip PIC16F628 microcontroller.

The example code, written in assembly code, includes a routine for reading the time and date from the RTC and a routine to write time and date data to the RTC from user entries.

Operation

The program uses two general-purpose port pins on the microcontroller to communicate with the DS1307 using the I²C serial interface. The microcontroller's internal UART drives two port pins, which are connected to a DS232 line driver/receiver. User inputs and data outputs from the program are passed through the RS-232 interface from a terminal emulator program on a PC to the microcontroller. The RS-232 DTR input line controls the microcontroller's reset input.

The microcontroller in this example is a PIC16F628. For information on the microcontroller used in this application note, including available programming tools, visit the Microchip web site.

The software is shown in Figure 1. A schematic of the circuit is shown in Figure 2.


Download (TXT, 10kB)
Figure 1. Program Listing


More detailed image (PDF, 126kB)
Figure 2. Schematic drawing of the DS1307 circuit used with a PIC microcontroller.

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 相关推荐

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分