| Electronic Components Datasheet Search |
|
AN3371 Datasheet(PDF) 11 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3371 Datasheet(HTML) 11 Page - STMicroelectronics |
|
11 / 45 page ![]() AN3371 Overview of the STM32 advanced RTC Doc ID 018624 Rev 5 11/45 Configuring the alarm behavior using the MSKx bits The alarm behavior can be configured using the MSKx bits (x = 1, 2, 3, 4) of the RTC_ALRMAR register for alarm A (RTC_ALRMBR register for alarm B). Table 5 shows all the possible alarm settings. As an example, to configure the alarm time to 23:15:07 on Monday (assuming that the WDSEL = 1), MSKx bits must be set to 0000b. When the WDSEL = 0, all cases are similar, except that the Alarm Mask field compares with the day number and not the day of the week, and MSKx bits must be set to 0000b. Table 4. Steps to configure the alarm Step What to do How to do it Comments 1 Disable the RTC registers Write protection Write "0xCA" and then "0x53" into the RTC_WPR register RTC registers can be modified 2 Disable alarm A Clear ALRAE(1) bit in RTC_CR register. 1. Respectively ALRBE bit for alarm B. 3 Check that the RTC_ALRMAR register can be accessed Poll ALRAWF(2) bit until it is set in RTC_ISR. 2. Respectively ALRBWF bit for alarm B. It takes approximately two RTCCLK clock cycles (clock synchronization). 4 Configure the alarm Configure RTC_ALRMAR(3) register. 3. Respectively RTC_ALRMBR register for alarm B. The alarm hour format must be the same(4) as the RTC Calendar in RTC_ALRMAR. 4. 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. 5 Re-enable alarm A Set ALRAE(5) bit in RTC_CR register. 5. Respectively ALRBE bit for alarm B. 6. RTC alarm registers can only be written when the corresponding RTC alarm is disabled or during RTC Initialization mode. 6 Enable the RTC registers Write protection Write "0xFF" into the RTC_WPR register RTC registers can no longer be modified Table 5. Alarm combinations MSK3 MSK2 MSK1 MSK0 Alarm behavior 00 00 All fields are used in alarm comparison: Alarm occurs at 23:15:07, each Monday. 00 01 Seconds do not matter in alarm comparison The alarm occurs every second of 23:15, each Monday. 00 10 Minutes do not matter in alarm comparison The alarm occurs at the 7th second of every minute of 23:XX, each Monday. 00 11 Minutes and seconds do not matter in alarm comparison 01 00 Hours do not matter in alarm comparison 01 01 Hours and seconds do not matter in alarm comparison |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List 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 |