ARM Learning Notes—RTC Programming (I)

Publisher:翅膀小鹰Latest update time:2016-07-19 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
To learn RTC programming, we first need to know what is RTC? How does RTC work? How is the RTC circuit built? What should be paid attention to when programming RTC? To figure out these, the best way is to find the answer from the user manual. I analyzed and learned RTC step by step according to the manual provided by LPC1788.

 

1. Basic Configuration

 1. RTC power control: In register PCONP, set bit PCRTC. Note: The value of PCRTC is also "1" during reset. (Note that all pin operations in ARM are completed by reading and writing registers. Each pin corresponds to a bit in the register. The pin cannot be set or reset directly.)

 2. Clock source: RTC obtains 1HZ from the RTC crystal as the internal function clock, and the external clock is used to receive the value of the RTC register (I have not fully understood it yet, and will continue to study it in the future)

3. Interruption: Interruption will be discussed later, so I won’t go into details here.

2. Features

* Maintain the accuracy of calendars and clocks by the time that has passed. You can get the year, month, day, hour, minute, second, day of the week

* Ultra-low power design, operating current is less than 1 microampere, automatically switches to mains power when the system is powered on, and uses battery power when the system is powered off

* The system has a 20-byte backup register specifically used to backup the timer power supply (not quite clear ARM Learning Notes - RTC Programming - A drop in the ocean - A drop in the ocean's blog)

* Dedicated very low power 32KHZ oscillator

* Dedicated power supply pin Vbat

* The RTC power supply is isolated from other components of the MCU

* The standard counter is RTC with an accuracy better than +/- 1 second per day

* The count increase of the time register will periodically trigger an interrupt

* You can set the alarm time (equivalent to setting an alarm clock)

3. Description

When the system is powered on, a clock count reference can be set for the RTC, and the RTC will work according to this reference, even when the system is powered off. When there is no CPU to obtain data, the RTC works at extremely low power consumption, especially in power saving mode. The RTC in LPC1788 uses an external 32KHZ crystal to generate an internal 1HZ clock reference for accurate operation. It is powered by an independent pin, which can use a battery when powered off, and an external 3.3V power supply when powered on.

4. Block Diagram Description

  ARM Learning Notes - RTC Programming - A drop in the ocean - A drop in the ocean's blog

This is a block diagram of the RTC power supply function. From this diagram, we can clearly see that the RTC has a power selector to select the power supply to be used. There is also a backupregister register. I am not sure what this register is used for.

ARM Learning Notes - RTC Programming - A drop in the ocean - A drop in the ocean's blog
This is a functional block diagram of RTC. From the functional diagram, we know that there are three registers here, an Alarm Register, which is used to set the limit value of the warning interrupt, a Time Register, which is used to store the time value of the RTC, and a Calibration Register (CIIR Increment Interrupt Register), which is used to generate a counting interrupt.
5. PIN pin description
The meaning of the pin has been mentioned in the previous article, so I won’t repeat it here.
6. Register Description
1. RTC interrupt
2. Various register groups
(1) ILR
(2) CCR
(3) CIIR
(4) AMR
(5) RTC_AUX
3. Time register
(1) CTIME0
(2) CTIME1
(3) CTIME2
4. Counting group
(1) Calculation based on year skipping
(2) Standard registers
5. Clear process
6. General registers
7. Warning register group
7. RTC usage points
 
I feel that I took a big detour when reading the manual before, because the manual has more than 1,000 pages, it is impossible to finish reading it in these few days of familiarizing myself with the microcontroller. However, the contents are interrelated. This requires us to learn to read the manual. When reading the datasheet, we must look at the table of contents, find the general direction, and then read until the end of this knowledge point, so that we can understand what we need well.
Keywords:ARM Reference address:ARM Learning Notes—RTC Programming (I)

Previous article:ARM Learning Notes--RTC Programming (Part 2)
Next article:ARM Learning Notes--LPC1788 Pin Analysis

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号