Real-time clocks are used in many embedded applications to record the time at which an event
occurred—for example, when a pressure sensor was activated, or when an analog-to-digital converter (ADC) reading was taken. Currently, there are off-the-shelf components that contain a small crystal time base coupled with simple logic that have standardized interfaces for connecting to the I2C, SPI, or parallel port of a microcontroller. This application note describes how to implement the function of a real-time clock inexpensively by using a C8051Fxxx device, a small 32 kHz watch crystal, and a few passive components.