下载
November 2012 Doc ID 16956 Rev 5 1/43
AN3133
Application note
Using the STM8L05xxx/STM8L101xx/STM8L15xxx/
STM8L162xx/STM8AL31xx/STM8AL3Lxx real-time clock
Introduction
A real-time clock (RTC) is a computer clock that keeps track of the current time. Although
RTCs are often used in personal computers, servers and embedded systems, they are also
present in almost any electronic device that requires accurate time keeping. Microcontrollers
that support RTCs can be used for chronometers, alarm clocks, watches, small electronic
agendas, and many other devices.
This application note describes the features of the RTC controller embedded in medium
density, medium+, and high density STM8L05xxx/STM8L101xx/STM8L15xxx/STM8L162xx/
STM8AL31xx/STM8AL3Lxx devices, together with the steps required to configure the RTC
for use with the calendar, alarm, periodic wakeup unit, tamper detection and chronometer.
Table 1 shows the STM8 family members covered by this application note.
Five application examples are provided with useful configuration information to allow the
user to quickly and correctly configure the RTC for calendar, alarm, periodic wakeup unit,
tamper detection and chronometer applications.
Note: All examples and explanations in this document are based on the STM8L05x/STM8L15x/
STM8L16x/STM8AL31x/STM8AL3Lx standard peripheral library. Please refer to the
STM8L05xx, STM8L15xx, STM8L162x, STM8AL31xx and STM8AL3Lxx microcontroller
family reference manual (RM0031) for more details.
Table 1. Applicable products
Product family Part numbers
Microcontrollers
– STM8L05xxx
– STM8L101xx
– STM8L151C2/F2/G2/K2, STM8L151C3/F3/G3/K3
– STM8L151x4, STM8L151x6, STM8L151x8
– STM8L152x4, STM8L152x6, STM8L152x8
– STM8L162R8, STM8L162M8
– STM8AL313x, STM8AL314x, STM8AL316x
– STM8AL3L4x, STM8AL3L6x
www.st.com