The following C code was tested with CCS PIC C compiler version 5.051. Simple real time clock and calendar using DS3231 and PIC16F877A CCS C code: In this example the PIC16F877A runs with 8MHz crystal oscillator. The circuit can work without this battery but its pin (#14) has to be grounded. The 3V cell battery is used as a backup to keep time and date running in case of main power failure. The button B1 selects the parameter and B1 increments the selected parameter as shown in the videos below. In the circuit there are 2 push buttons (B1 & B2) connected to pin RB0 and pin RB1, the two push buttons are used to set the time as well as the calendar parameters. The 16×2 LCD has 7 data lines which are connected to pins RD0~6, the DS3231 SCL pin is connected to pin RC3 (#18) and SDA is connected to pin RC4 (#23) of the PIC16F877A.
0 Comments
Leave a Reply. |