1、OVERVIEW总述
The Real Time Clock (RTC) unit can be operated by the backup battery when the system power is off. The data
include the time by second, minute, hour, date, day, month, and year. The RTC unit works with an external 32.768
KHz crystal and can perform the alarm function.
当体系电源封闭时,经过备用电源能够运转实时时钟(RTC)单元。数据包括的时刻,即秒,分钟,小时,日期,日,月和年。RTC 作业由一个外部32.768kHz 的晶体驱动,并能够履行报警功用。
2、FEATURES特性
The Real Time Clock includes the following features:
• BCD number: second, minute, hour, date, day, month, and year. BCD编码。
• Leap year generator闰年产生器。
• Alarm function: alarm-interrupt or wake-up from power-off mode.报警功用:报警中止或从断电形式中唤醒。
• Tick counter function: tick-interrupt or wake-up from power-off mode.时钟计数功用:时钟节拍中止或从断电形式中唤醒。
• Year 2000 problem is removed.这个在下面说,千年虫问题。
• Independent power pin (RTCVDD).
• Supports millisecond tick time interrupt for RTOS kernel time tick.能够用于实时操作体系的体系时钟
3、REAL TIME CLOCK OPERATION DESCRIPTION实时时钟的结构框图
3.1、 LEAP YEAR GENERATOR闰年产生器
The leap year generator can determine the last date of each month out of 28, 29, 30, or 31, based on data from
BCDDAY, BCDMON, and BCDYEAR. This block considers leap year in deciding on the last date. An 8-bit counter
can only represent 2 BCD digits, therefore it cannot decide whether “00” year (the year with its last two digitszeros) is a leap year or not.To solve this problem,the RTC block in 6410 has hard-wired logic to support the leap year in 2000. Note 1900 is not leap year while2000 is leap year. Therefore, two digits of 00 in 6410 denote 2000, not 1900.So, RTC in 6410 supports from 1901 to 2099.
闰年产生器经过BCDDAY, BCDMON 和BCDYEAR 的数据来决议每个月的最终一天是28,29,30 仍是31。
这个模块是经过决议最终的日期来判别闰年的。一个8 位的计数器只能代表两个BCD 数字,因而它不能决
定‘00’年(年的最终两个数字为‘00’)是不是闰年. 举例来说,它不能区别1900 年和2000 年。要处理这个问题,S3C6410 中的实时时钟模块,在2000 年中,硬衔接逻辑支撑闰年。留意1900 年不是闰年,
而2000 年是闰年。因而在S3C6410 中的‘00’的两个数字表明2000 而不是1900。所以6410支撑1901年到2099年。
3.2、READ/WRITE REGISTER读写寄存器
Bit 0 of the RTCCON register must be set high in order to write the BCD register in RTC block.To display the
second, minute, hour, day, date, month, and year, the CPU must read the data in BCDSEC, BCDMIN, BCDHOUR,
BCDDATE, BCDDAY, BCDMON, and BCDYEAR registers respectively in the RTC block.However, a one second
deviation may exist because multiple registers are read.For example, when the user reads the registers from
BCDYEAR to BCDMIN, the result is assumed to be 2059 (Year), 12 (Month), 31 (Date), 23 (Hour) and 59 (Minute).
When the user read the BCDSEC register and the value ranges from 1 to 59 (Second), there is no problem, but, if
the value is 0 sec., the year, month, date, hour, and minute may be changed to 2060 (Year), 1 (Month), 1 (Date), 0
(Hour) and 0 (Minute) because of the one second deviation that was mentioned. In this case, the user must reread
from BCDYEAR to BCDSEC if BCDSEC is zero.
RTCCON 寄存器的位0 有必要被设置为高位,为了是能够写入实时时钟模块中的BCD 寄存器,以显现秒,分钟,小时,日期,日,月和年。CPU 有必要分别在RTC 模块的BCDSEC, BCDMIN, BCDHOUR, BCDDATE, BCDDAY,
BCDMON 和 BCDYEAR 寄存器中读取数据。可是,由于多个寄存器被读取,所以可能有一秒的误差存在。例
如,当用户从BCDYEAR 到BCDMIN 读取寄存器时,成果假设为2059(年),12(月),31(日期),23(小时)
和59(分钟)。当用户读取BCDSEC 寄存器及值规模从1 到59(秒)时,没有问题,但值为0 秒,年,月,日,小时和分钟将被改变为2060(年),1(月),1(日期),0(小时)和0(分钟),便是由于这一秒的变差。在这种情况下,假如BCDSEC 置0,用户有必要从BCDYEAR 到BCDSEC 从头读取。
3.4 、ALARM FUNCTION报警功用,能够对照看上面的那个结构框图
The RTC generates ALARM_INT(alarm interrupt) and ALARM_WK(alarm wake-up) at a specified time in the
power-down mode, power off mode or normal operation mode.
实时时钟在断电形式或正常操作形式的某一特定时刻内产生一个报警信号
In normal operation mode, If ALARM registervalue is a same to BCD register, ALARM_INT is activated as well as the ALARM_WK.正常形式下,ALARM_INT和ALARM_WK都被激活
In the power-off and powerdown,If ALARM register value is a same to BCD register,ALARM_WK is activated.在断电形式下或省电形式下,ALARM_WK被激活
The RTC alarm register(RTCALM) determines the alarm enable/disable status and the condition of the alarm time setting.实时时钟报警寄存器(RTCALM),决议了报警启用/禁用的状况和报警时刻设置的条件
3.5、 TICK TIME INTERRUPT 中止
The RTC tick time is used for interrupt request. TheRTCCON[8]register has an interrupt enable bit. The count
value reaches ‘0’ when the tick time interrupt occurs.实时时钟符号时刻被用于中止请求。TICNT寄存器有一个中止使能位和一个相关的计数器值。每个时钟脉冲,计数值减一。当TICK TIME中止产生计数器的值到达‘0’,T%&&&&&%K TIME中止产生。中止周期
Then the period of interrupt is as follows:
Period = (n+1)/32768 second (n= tick counter value)
看下图,那个32768是可选的。
这个和下面这个寄存器有关:
公式中的n= tick counter value和下面这个寄存器有关:
3.6、 32.768 KHZ X-TAL CONNECTION EXAMPLE时钟晶振电路
4、寄存器:
s3c6410的RTC在linux中的驱动(1)的链接地址