AN923 STMICROELECTRONICS | Alldatasheet

Document overview

  • Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
  • PDF pages: 7

Technical content

Managing century information using serial real-time clocks and TIMEKEEPER® NVRAMs By Doug Sams Introduction ST's serial real-time clocks (RTCs) and TIMEKEEPER® NVRAMs all include at least one byte of year data in binary-coded decimal (BCD) format. Many devices include additional bits for tracking the century, effectively extending the year register. Applications can use software to further extend the century/year data to any desired resolution. The amount of software required depends on the resources built into the chip and the resolution needed by the application.

Devices with no century data AN923 Devices with no century data M48T02/12, M48T08/08Y/18, M41TC8025 A few devices have only a single byte of year information. The BCD year register represents a 2-digit number in the range 00 to 99. The result is that the software must interpret what the 2-digit number means. For example, 85 might be interpreted as 1985, or 2085, or 2185. So the software must maintain the upper two digits of the year, outside of the RTC. The reader should note that the upper two digits of the 4-digit year are considered the century value. So, for the devices listed above, the software must maintain the century information in non-volatile memory such as flash or EEPROM, and increment the century value whenever the year value, in the RTC, rolls over from 99 to 00. Devices with one bit of century data M41ST85W, M41T0, M41T00, M41T00AUD, M41T00CAP, M41T00S, M41T11, M41T56, M41T80, M41T81, M41T81S, M41T94, M48T35AV, M48T35/Y, M48T58 Most ST clock devices include at least one bit of century information. When enabled (CEB is set), the century bit will toggle at the end of every century, at midnight of December 31 of the year ending in 99. User software must interpret the bit's meaning. For example, users can let 0 represent 2000-2099 and 1 represent 2100-2199, but other mappings may also be used. By adding more bits in software, the century information can be extended to whatever resolution is desired.

Figure 1. Two-bit binary counter (century bits CB1:CB0) In this example, CB1:CB0 represent the two lower bits of the century byte. bit to support the years 10000-19999.

Table 1. Century data provided according to device

  1. 1 byte (BCD) which increments once per century
  2. 2 century bits which increment once per century
  3. 1 century bit which toggles once per century

AN923 Support for leap year Support for leap year Leap year occurs every four years, in years which are multiples of 4. For example, 2012 was a leap year. An exception to that is any year which is a multiple of 100. For example, the year 2100 is not a leap year. A contradiction to that is that years which are multiples of 400 are indeed leap years. Hence, while 2100 is not a leap year, 2400 is. During any year which is a multiple of 4, ST RTC and TIMEKEEPER devices will automatically insert leap day, February 29. Therefore, the application software must correct for this during the exception years (2100, 2200, etc.) as noted above. M41TC8025 serial RTC and leap year The M41TC8025 handles leap year differently than all other ST clock devices. It treats all years ending in 00 as non-leap years. Thus, the years 2100, 2200, 2300, 2400, et cetera, all skip leap day. For this device, the application software must insert leap day in the appropriate years. For example, the software will need to insert leap day in 2400, but not 2100, 2200 nor 2300, as noted above. For any other year which is a multiple of 4, the M41TC8025 properly inserts leap day just like ST's other RTC devices do. For more information about ST's TIMEKEEPER NVRAM's and serial real-time clocks, please contact a local ST sales office or visit www.st.com.

Revision history

Table 2. Document revision history