| 数据搜索系统,热门电子元器件搜索 |
|
AN3133 数据表(PDF) 7 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3133 数据表(HTML) 7 Page - STMicroelectronics |
|
7 / 43 page ![]() AN3133 Real-time clock overview Doc ID 16956 Rev 5 7/43 The STM8L/STM8AL RTC calendar is provided in BCD format: this saves from having to perform binary to BCD software conversion routines, which use significant program memory space and CPU-time that may be critical in certain real-time applications. Figure 2. Example of calendar display on an LCD 1.1.1 Sub-seconds Sub-second values are read from RTC registers RTC_SSRH and RTC_SSRL. The sub-seconds field is adjustable and can be up to 0xFFFF, or 65535 in decimal, depending on the value set on RTC_SSRH and RTC_SSRL. SSSS[15:0] (included in RTC_SSRH/RTC_SSRL) is the value in the synchronous prescaler’s counter. Given that this counter continually counts down to zero and then reloads the value from RTC_SPRE[14:0], following is the formula for calculating the fraction of a second: Second fraction = (PREDIV_S – SS) / (PREDIV_S + 1) For example: If RTC_SPRE[14:0] = 0x7FFF, then calendar sub-seconds SS starts downcounting from 0x7FFF to 0. which means that the sub-second resolution is equal to 1/(PREDIV_S + 1) = 30.517578125 µs. Note: 1 The sub-seconds field can be up to 0xFFFF when using the “shift control” feature, by adding 0x7FFF sub-second fractions. 2 SS can be larger than RTC_SPRE only after a shift operation. In this case, the “second fraction” is negative which (intuitively) indicates that the correct time/date is at least a second less than indicated by RTC_TRx/RTC_DRx. 1.1.2 Fine RTC calendar adjustments For accurate RTC adjustments, a “shift control” feature enables the user to add/subtract a number of sub-seconds to/from the current calendar. The shift is used to synchronize the RTC to a master clock: SS[15:0] (included in RTC_SSRH/RTC_SSRL) can be read with RTCCLK/PREDIV_A resolution, and a correction can be applied with RTCCLK/(PREDIV_A+1). The number of sub-seconds that can be added is “1s– n” and the number of sub-seconds that can be subtracted is “–n” (where n can be up to 32767 (0x7FFF) sub-seconds). RTC calendar adjustment examples If RTC_SPRE[14:0] = 1023, RTC_APRE = 31 and RTC current calendar time is 3h, 25mn, 32s and SS = 511, the calendar time is read as 3h, 25mn, 32s and 500ms (03h25’32’’500) since (1023–511)*32/32768 = 500 ms. 11:15:28 PM WED NOV 19 2010 |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 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 |