CE96926 – PSoC® Real-Time Clock Based on Power Line Frequency | Cypress Semiconductor
CE96926 – PSoC® Real-Time Clock Based on Power Line Frequency
These code examples show how to implement a real-time clock (RTC) using the 50/60-Hz frequency of the mains power line as the time base. PSoC 3, PSoC 4, and PSoC 5LP devices are supported. The example for PSoC 4 BLE also uses a 32-kHz watch crystal oscillator (WCO) that can be used as the secondary time-base in case of a mains power failure.
An RTC provides time and date information – second, minute, hour, day of the week, day of the month, month, and year. The time and date information are usually updated every second based on a one-second interrupt generated from a 32.768-kHz crystal. However, there can be long-term drifts in the time due to factors such as the temperature and aging of the crystal.
An alternative technique is to use the frequency of the mains power line as a time base. Systems that are wall-powered and need a system clock can make use of this technique. This technique is applicable only in countries where mains power frequency adjustment is done.