| Zakładka z wyszukiwarką danych komponentów |
|
AN3133 Arkusz danych(PDF) 17 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3133 Arkusz danych(HTML) 17 Page - STMicroelectronics |
|
17 / 43 page ![]() AN3133 Programming the RTC Doc ID 16956 Rev 5 17/43 2 Programming the RTC 2.1 Initializing the calendar Table 4 describes the steps required to correctly configure the calendar time and date. 2.2 Programming the alarm Table 5 describes the steps required to configure the alarm. Table 4. Steps to initialize the calendar Step What to do How to do it Comments 1 Enter Initialization mode. Set INIT bit to ‘1’ in RTC_ISR1 register. The calendar counter is stopped to allow update. 2 Wait for the confirmation of Initialization mode (clock synchronization). Poll INITF bit of in RTC_ISR1 until it is set. It takes approximately 2 RTCCLK clock cycles for medium density devices. 3 Program the 3 prescaler registers if needed. Registers RTC_APRER and RTC_SPRERx. 4 Load time and date values in the shadow registers. Set RTC_TRx and RTC_DRx registers. 5 Configure the time format (12h or 24h). Set FMT bit in RTC_CR1 register. 6 Exit Initialization mode. Clear the INIT bit in RTC_ISR1 register. The current calendar counter is then automatically loaded and the counting restarts after 4 RTCCLK clock cycles. Table 5. Steps to configure the alarm Step What to do How to do it Comments 1 Disable the alarm. Clear ALRAE bit in RTC_CR2 register. 2 Check that the RTC_ALRMARx registers can be accessed. Poll ALRAWF bit until it is set in RTC_ISR1. It takes approximately 2 RTCCLK clock cycles (clock synchronization). On medium+ and high density, there is no synchronization time to wait for. 3 Configure the alarm. Configure RTC_ALRMARx registers. The alarm hour format must be the same as the RTC Calendar in RTC_ALARM3(1). 1. As an example, if the alarm is configured to occur at 3:00:00 PM, the alarm will not occur even if the calendar time is 15:00:00, because the RTC calendar is 24-hour format and the alarm is 12-hour format. 4 Re-enable the alarm. Set ALRAE bit in RTC_CR2 register. |
|
Link URL |
| Czy Alldatasheet okazała się pomocna? [ DONATE ] |
O Alldatasheet | Reklama | Kontakt | Polityka prywatności | Link do karty katalogowej | Linki | Lista producentów All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |