Here we are introducing a simple project using PIC16F873A/876A. A Dual time Digital clock with alarm. The PIC used is a 28 pin high performance RISC microcontroller from Microchip Inc, and having a 4K/8K byte program memory. It is a flash based and a member of PIC16F87XA family of low cost, CMOS, fully static, 8 bit microcontrollers. It requires less external components thus reducing cost and total power consumption.
Features at a glance
Dual time (Standard time + another time – GMT)
Counts seconds, minutes, hours, day, date, month and year
12 hour / 24 hour time format
Leap year correction valid up to 2100
The heart of this circuit is the inbuilt Timer1 module in PIC16F87XA. It is primarily intended for a 32 KHz crystal, and it will continue to run even in SLEEP. This module can be easily used to implement a real-time clock, an inexpensive 32.768 KHz watch crystal and two 33 pf capacitors are used to complete the circuit. The Timer1 is clocked by this crystal oscillator.
Since Timer1 is a 16 bit counter, the 32.768KHz crystal will cause the Timer1 to overflow in every two seconds or 65536 counts, for this reason TMR1 register pair (TMR1H:TMR1L ) is initialized to 0x8000, so that it will overflows in every seconds. The Timer1 overflow generates an interrupts, and in every interrupt the clock will be updated (in SLEEP, this interrupt will wake up the processor).
Visit Here for more.