project: interrupt driven RTC routine for 16f84
Theory of functioning:
The real time clock is a useful tool in embedded systems design, for example in the implementation of industrial timer applications, in which different devices are activated or deactivated at certain times, or in access control systems in which the time of ocurrence of events are critical.
This program was written for the EDUPIC 16f84 module, but may be easily modified to operate with any other Microchip device or any other hardware based on the 16f84. The time is shown in a 16 x 1 LCD, as the one in the photo.
Given that the proposed system is interrupt driven, it is possible to add control routines to the main program to solve an specific problem without affecting the functioning of the time base. So you may freely use the routines to adapt it to your own system.
Timer TMR0 and its prescaler are used to generate interrupt cycles each 65.536 miliseconds. Aditional counters are generated in software to make for the seconds, the seconds tenths, minutes, minutes tenths, hours and hours tenths. When the count reach 23:59:59 it changes automatically to 00:00:00.
Within the program, a delay routine is included to fine tune the time base. The inicial time after reset must be directly modified in file RTCV3.ASM. In this file, instructions are given to do it.
The source file of the program is: RTCV3.ASM