This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
当RTC配置好启动后。如果用户需要通过按键修改时间的话,修改RTCHOUR和RTCMIN的时候,需要事先关闭RTC模块吗?还是直接改写就可以呢?怎样做是安全的,不会出错的?
以MSP430F6733为例RTC_C会有提供一个a keep-out window,在这段时间里面更新是安全的。
24.2.5 Reading or Writing Real-Time Clock Registers
Because the system clock may in fact be asynchronous to the RTC_C clock source, special care must be
used when accessing the real-time clock registers.
SLAU208M–June 2008–Revised February 2013 Real-Time Clock C (RTC_C) 625
Submit Documentation Feedback
Copyright © 2008–2013, Texas Instruments Incorporated
ECCN 5E002 TSPA – Technology / Software Publicly Available
RTC_C Operation www.ti.com
The real-time clock registers are updated once per second. To prevent reading any real-time clock register
at the time of an update that could result in an invalid time being read, a keep-out window is provided. The
keep-out window is centered approximately 128/32768 seconds around the update transition. The read
only RTCRDY bit is reset during the keep-out window period and set outside the keep-out the window
period. Any read of the clock registers while RTCRDY is reset is considered to be potentially invalid, and
the time read should be ignored.
An easy way to safely read the real-time clock registers is to utilize the RTCRDYIFG interrupt flag. Setting
RTCRDYIE enables the RTCRDYIFG interrupt. Once enabled, an interrupt is generated based on the
rising edge of the RTCRDY bit, causing the RTCRDYIFG to be set. At this point, the application has
nearly a complete second to safely read any or all of the real-time clock registers. This synchronization
process prevents reading the time value during transition. The RTCRDYIFG flag is reset automatically
when the interrupt is serviced or can be reset with software.