6.S5PV210中RTC时钟时钟基础简介

来源:互联网 发布:魔音软件男变女 编辑:程序博客网 时间:2024/06/05 09:23
REAL TIME CLOCK (RTC)---实时时钟

4.1 OVERVIEW OF REAL TIME CLOCK
The Real Time Clock (RTC) unit can operate using the backup battery while the system power is off. Although power is off, backup battery can store the time by Second, Minute, Hour, Day of the week, Day, Month, and Year data. The RTC unit works with an external 32.768 kHz crystal and performs the function of alarm.
实时时钟概述:
实时时钟单元在系统断电的时候能使用备用电池运行。尽管断电,通过备用电池仍然能够存储时间日期。RTC单元通过一个外部的32.768kHz晶振工作,并能提供闹钟功能。



4.2 KEY FEATURES OF REAL TIME CLOCK
* Supports BCD Number, that is Second, Minute, Hour, Day of the week, Day, Month, and Year.
* Supports Leap Year Generator
* Supports Alarm Function, that is ,Alarm-Interrupt or Wake-up from power down modes (idle, deep idle, stop,deep stop, and sleep)
* Supports Tick Counter Function, that is Tick-Interrupt or Wake-up from power down modes (idle, deep idle,stop, deep stop, and sleep)
* Supports Independent Power Pin (RTCVDD)
* Supports millisecond tick time interrupt for RTOS kernel time tick .
实时时钟的关键特性:
* 支持BCD码,时钟包括:秒、分、时、星期、日、月、年。
* 支持生成闰年
* 支持闹钟功能,通过闹钟中断或掉电模式(空闲、深度空闲、停止、深度停止、休眠)唤醒
* 支持滴答计数功能,通过滴答中断或掉电模式(空闲、深度空闲、停止、深度停止、休眠)唤醒
* 支持独立的电源引脚(RTCVDD)
* 支持为RTOS内核时钟节拍提供毫秒计时


4.2.1 REAL TIME CLOCK OPERATION DESCRIPTION
实时时钟结构框图


4.3 LEAP YEAR GENERATOR
The leap year generator determines the last day of each month out of 28, 29, 30, or 31. This is calculated based on the data from BCDDAY, BCDMON, and BCDYEAR. This block considers leap year while deciding on the last day of a month.
NOTE: The BCDYEAR register is 12-bit wide. It can represent maximum three BCD digits. The implicit number of thousands place is 2. Therefore, it can represent years from 400*n to 400*n + 999 (n = 0, 1, 2, 3, 4, 5, … ).
闰年发生器:
闰年发生器确定每个月的最后一天为28/29/30/31。这是以BCDDAY, BCDMON, and BCDYEAR中的数据为依据来计算的。这个模块考虑闰年来决定每月最后一天的日期。
注意:BCDYEAR寄存器是12位宽的。所以它能表示最多3个BCD码(4个二进制位表示一个BCD码)。千位的位置隐式为2。所以,它能表示的年份为400*n to 400*n + 999 (n = 0, 1, 2, 3, 4, 5, … )。

4.4 READ / WRITE REGISTER
读/写寄存器
To write the BCD register in RTC block, set the Bit 0 of the RTCCON register. To display the second, minute,hour, day of the week, day, month, and year, the CPU should read the data in BCDSEC, BCDMIN, BCDHOUR,BCDDAYWEEK, BCDDAY, BCDMON, and BCDYEAR registers, respectively, in the RTC block. However, a onesecond deviation can exist because multiple registers are read.
在RTC模块中写BCD寄存器时,需要置位RTCCON寄存器中的bit0(使能RTC控制)。CPU通过读取BCDSEC, BCDMIN, BCDHOUR,BCDDAYWEEK, BCDDAY, BCDMON, and BCDYEAR寄存器来显示具体的日期。然而,因为多个寄存器被读所以会出现秒级的误差。

For example, if you read the registers from BCDYEAR to BCDMIN, the result is assumed to be 2059 (Year), 12(Month), 31 (Day), 23 (Hour) and 59 (Minute). If you read the BCDSEC register and the value ranges from 1 to 59(Second), there is no problem. However, if the value is 0 sec., the year, month, day, hour, and minute can change to 2060 (Year), 1 (Month), 1 (Day), 0 (Hour) and 0 (Minute) because of the one second deviation. In this case, you must read again from BCDYEAR to BCDSEC if BCDSEC is zero.
例如,如果你从 BCDYEAR 到 BCDMIN寄存器中读取数值,结果假设为2059年12月31日23时59分。然后你读BCDSEC寄存器的值,如果是1到59这个范围没有问题出现,但是如果读的是0秒,那么日期很有一秒之差变为2060年1月1日0时0分。这种情况下,如果BCDSEC值为0你需要再次从BCDYEAR到BCDSEC寄存器中读取数值。

4.4.1 BACKUP BATTERY OPERATION
The backup battery can drive the RTC logic. The backup battery supplies the power through the RTCVDD pin into the RTC block, even if the system power is off. If the system is off, the interfaces of the CPU and RTC logic should be blocked, and to minimize power dissipation the backup battery only drives the oscillation circuit and the BCD counters.
备用电池操作:
备用电池能够驱动RTC逻辑。即使系统断电,备用电池也可以通过RTCVDD引脚为RTC模块供电。如果系统断电,CPU和RTC逻辑块的接口将会被阻断,备用电池仅仅驱动振荡电路和BCD计数器以最小化的耗电。


4.5 ALARM FUNCTION
The RTC generates ALARM_INT (alarm interrupt) and ALARM_WK (alarm wake-up) at a specific time in the
power-off mode or normal operation mode. In normal operation mode, ALARM_INT is activated. In the power-off mode, ALARM_WK signal is activated as well as the ALARM_INT. The RTC alarm register (RTCALM) determines the alarm enable/disable status and the condition of the alarm time setting.
闹钟功能:
在断电模式或者正常运行模式,RTC在特定的时间产生闹钟中断或者闹钟唤醒。在正常运行模式下,闹钟中断被激活,在断电模式下闹钟唤醒信号被激活也和闹钟中断一样。RTC闹钟寄存器(RTCALM)确定闹钟使能/禁止和设置闹钟时间的条件。


4.6 TICK TIME INTERRUPT
The RTC tick time is used for interrupt request. The TICNT register contains an interrupt enable bit and count value for the interrupt. If the count value reaches ‘0’ if the tick time interrupt occurs. Then the period of interrupt is as follows:
* Period = (n+1) / (Tick clock source frequency) second (n= tick counter value)
TICK TIME 中断:
RTC滴答时间被作用于中断请求。TICNT寄存器包含一个中断使能位和中断计数值。如果中断计数值到0产生一个滴答时钟中断。中断周期计算如下:
* Period = (n+1) / (Tick clock source frequency) second (n= tick counter value)



This RTC time tick can be used for Real Time Operating System (RTOS) kernel time tick. If RTC time tick
generates time tick, the time related function of RTOS always synchronized in real time.
这个被用于RTOS内核中,所以这里我们先不考虑这个内容。

4.7 32.768KHZ X-TAL CONNECTION EXAMPLE
shows a circuit of the RTC unit oscillation at 32.768kHz. The capacitance 20pF of the load capacitor is
an example value. It should be adjusted according to the crystal load capacitance.
32.768KHZ X-TAL连接示例:
下图显示为一个RTC单元中的32.768KHz晶振电路。负载电阻中的电容20pF是示例值。它应按照晶振的负载电容来调整。



4.8 RTC START
To start RTC, set RTCCON[0] as 1.
开始RTC,设置RTCON[0]为1。

4.9 I/O DESCRIPTION

I/O描述。



原创粉丝点击