m
m
Line 3: Line 3:
  
 
=Objective=
 
=Objective=
 +
In this tutorial we will be discussing about the internal RTC of LPC1768. We will see what are the different registers associated with the RTC but we will mainly focus on basics registers required to use RTC. Later we will see how to use Explore Embedded library for RTC.
 +
 
=RTC Registers=
 
=RTC Registers=
  

Revision as of 11:50, 5 June 2015

---

Objective

In this tutorial we will be discussing about the internal RTC of LPC1768. We will see what are the different registers associated with the RTC but we will mainly focus on basics registers required to use RTC. Later we will see how to use Explore Embedded library for RTC.

RTC Registers

CCR ( Clock Control Register )
CCR
31:5 4 3:2 1 0
- CCALEN - CTCRST CLKEN

Bit 0 – CLKEN : Clock Enable
This bit is written with one to enable time counters and written with zero to disable time counters.


Bit 1 - CTCRST : CTC Reset

Bit 3:2
These bits must be set to zero for normal RTC operation.

Bit 4 - CCALEN : Calibration counter enable
To disable calibration counter and reset it to zero, write one to this bit. When written zero, the counter is enabled and starts counting

Bit 31:5 Reserved

Time Counter Register

The time value consists of the eight counters and there is one register associated with each counter. To update the RTC, new values should be written to these registers.

Time Counter Register
Register Description Minimum Value Maximum Value
SEC Seconds value 0 59
MIN Minutes value 0 59
HOUR Hours value 0 23
DOM Day of Month value 1 28,29,30 or 31
( depending on the

month and whether it is a leap year).

DOW Day of Week value 0 6
DOY Day of Year value 1 365 (366 for Leap Year)
MONTH Month value 1 12
YEAR Year value 0 4095
Consolidated Time Registers

The values of the Time Counters can optionally be read in a consolidated format which allows the programmer to read all time counters with only three read operations.

There are 3 Consolidated Time Registers. The minimum and maximum values of the various fields in these registers are same as the respective Time Counter Register.

These registers are read only. New values should be written to Time Counter Registers.


Consolidated Time Register 0 (CTIME0)

CTIME0
31:27 26:24 23:21 20:16 15:14 13:8 7:6 5:0
Reserved Day of Week Reserved Hours Reserved Minute Reserved Second

Consolidated Time Register 1 (CTIME1)

CTIME1
31:27 27:16 15:12 11:8 7:5 4:0
Reserved Year Reserved Month Reserved Day of Month


Consolidated Time Register 2 (CTIME2)

CTIME2
31:12 11:0
Reserved Day of Year

Steps for Configuring RTC

Code EXample

Example 1

Using Explore Embedded Liberaries