![]() ![]() When restarting the RTC crystal oscillator, either from a no-battery reset condition or by setting the RTC Enable bit, the crystal start-up time must be observed. This may be desirable to preserve the life of the backup energy source during periods of storage. Clearing the RTC Enable bit will halt operation of the crystal amplifier and the clock, but all register values (including the time when the clock was disabled) will be retained. The state of the RTCE bit is undefined after a no-battery reset, however, and should be initialized. This bit can only be accessed by a Timed Access procedure and is unaffected by any operational reset. The operation of the RTC crystal amplifier is controlled by the RTC Enable bit, RTCE (RTCC.0). For this reason, interrupts should be globally disabled before modifying any RTC register. Similarly, any RTC time register operations outside of the 1ms window will result in invalid read operations or ignored write operations. Writes to the time registers before the 4-machine cycle period will be ignored. ![]() Any reads from the time registers before the 4-machine cycle period may return an invalid time. It is critical that the 4-machine cycle setup and 1ms window timings be observed. As mentioned, the next subsecond timer tick will occur at the proper time, so the long-term clock accuracy will not be affected. In that case, the alarm would be delayed a fraction of a millisecond until the RTCRE bit was cleared. The only possible implication with respect to RTC operation occurs if a timer tick that would cause an alarm interrupt occurred during a time register read operation. Only the recognition of that single subsecond timer tick is delayed, and subsequent ticks will be synchronized with the clock. This scheme will not affect the accuracy of the RTC, as any subsecond timer tick that may occur during the read or write window is only temporarily delayed, not discarded. To allow any pending timer ticks to be processed, software must wait four machine cycles between any successive modifications of the RTCWE or RTCRE bits. As a protective measure, the device will clear the RTCWE bit automatically after 1ms if it has not been cleared in software. To prevent the possibility of an accidental write to the RTC time registers, the RTCWE bit should be cleared as soon as the planned modifications are complete. If a subsecond timer tick should occur in the 1ms window, it will be processed immediately as soon as either the RTCWE or RTCRE bits are cleared. Updates to the RTC time registers by the internal timer are temporarily suspended for up to 1ms during software read or write operations. ![]() A register locking mechanism prevents the possibility of both user software and the internal timer accessing the same register simultaneously. Both user software and the internal clock directly write and read the RTC time registers (RTCSS, RTCS, RTCM, RTCH, RTCD0, RTCD1). Real-time clock control and status bit summary Bit nameīe aware that TRM2 and its inverse are not present on the DS5250. Consult the full bit or register description for complete details. Bits and registers designated as unchanged after a reset may be indeterminate following a no-battery reset. The registers and control bits used by the RTC are shown in Table 1. The subsecond register provides a resolution of 1/256 of a second and a maximum rollover count of 1 second. In addition there is an alarm register for the subsecond, seconds, minutes, and hours registers. The RTC consists of subsecond, second, minute, hour, day of the week, and two total day count registers. ![]() The RTC is controlled by dedicated Special Function Registers (SFRs). No load capacitors are required with the RTC crystal. Integration of the RTC means that only a 32.768kHz crystal is required. Although software timing loops or internal timers could be used for such measurements, they are crystal dependent, inefficient for long time measurements, and are incompatible with the use of power management modes. The DS87C530 and DS5250 incorporate a real-time clock (RTC) and alarm to allow the user to perform real-world timing operations such as time-stamping an event, performing a task at a specific time, or executing very long timing delays. Example code is included in this application note. Time measurements and alarm settings are also discussed. This application note examines temperature-measuring techniques interfacing to the DS1620 digital thermometer and thermostat. The Analog Devices DS87C530 and DS5250 high-speed microcontrollers with real-time clocks (RTC) is ideal for applications such as data logging. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |