Real Time Clock Using the PIC16CXXX


A very simple real time clock electronic project can be designed using the PIC16CXXX microcontroller family , designed by Microchip Technology . This real time clock electronic project uses the Timer1 module, from a mid-range PIC16CXXX microcontroller, to control a low-power real-time clock. Timer1 was chosen because it has its own crystal which allows the module to operate during sleep.

Upon power-up, the device is initialized with the display starting at 12:00 PM, and Timer1 is configured to generate an interrupt (every second). The Timer1 overflow interrupt wakes the device from sleep. This causes the time registers (HRS, MIN, SECS) to be updated. If the SECS register contains an even value (SECS<0> = 0), the colon (":") is not displayed. This gives a visual indication for each second. Then the device returns to sleep.

Real Time Clock Circuit Diagram

Real Time Clock Circuit Diagram



For setting the clock are used three keys : SELECT_UNITS Key (S1) selects which units are to be modified (hours, minutes, off), the INC Key (S2) increments the selected units and CLR_MIN Key (S3) clears the minutes and seconds (useful for exactly setting the time ) .

This simplify design use a standard Hitachi LCD display module and some other electronic parts .

The RA2:RA0 pins are the control signals to the LCD display, RB3:RB0 acts as a 4-bit data bus, and RB7:RB5 are the input switches. The OSC1 pin is connected to an RC network, which generates an approximate 4 MHz device frequency. Because Timer1 operates asynchronously to the device, the device's oscillator can be configured for RC mode.

Timer1’s crystal is connected to the T1OSI and T1OSO pins. A good choice for a crystal is a 32.786 kHz (watch) crystal.

This electronic project and source code was designed by Mark Palmer Microchip Technology Inc.

0 comments:

Post a Comment