[時事閒聊] Genuine Time Clocks (RTCs) in Microcontroller Timers

[複製網址]
This information is the third of the collection on microcontroller timers. The 1st write-up describes the foremost capabilities of most types of timers and addresses periodic timers, and the second covers pulse width modulation MCU timers.
Real-time clocks (RTC) are timers dedicated to maintaining a one-second timebase. Also, an RTC is frequently utilized to preserve monitor of clock time and calendar date either in computer software or hardware. A lot of the functions of the RTC are really specialised and expected for maintaining significant accuracy and really trusted operation. You will find RTC products external to the microcontroller which interface by having an I2C or SPI bus.
This information describes RTCs within a microcontroller.
Overview of Real-time Clocks
The real-time clock's standard perform will be to deliver intervals of 1 second and preserve a continual rely.
You may see a illustration of the in the diagram down below.
Also proven is often a plan functionality, A, looking through a seconds counter and scheduling an function, B, to arise 3 seconds from the potential. This action is named an alarm. Detect the seconds counter runs consistently and does not quit and begin. Two key necessities of an RTC are precision and constant operation.
Another diagram reveals widespread components features of the RTC.
An RTC typically has its very own interior oscillator having an exterior crystal and an option to use an external frequency reference. All clock resources operate at 32,768 Hz. An exterior clock resource lets the use of an extremely correct and stable gadget this sort of to be a TCXO (temperature-compensated crystal oscillator).
A clock source is chosen having a multiplexer and enter to a prescaler which divides the clock by an element of 32,768 (215) to supply a one-second clock.
A primary RTC incorporates a seconds counter and that is normally 32 bits or more. Some RTCs have specialised counters to maintain keep track of with the time of day as well as calendar day.
A fundamental RTC without time and date counters employs software for this objective. A common possibility is often a one Hz sq. wave from an output pin. An RTC will likely have a number of doable situations to produce a processor interrupt.
An RTC normally provides a devoted electrical power pin to permit procedure once the relaxation on the microcontroller is run down. This electric power pin is usually related into a battery or individual energy provide.
RTC Accuracy and Frequency Payment
The precision of an RTC will depend on the 32,768 Hz clock source. Inside a well-designed crystal oscillator, the key source of error may be the crystal. An external TCXO can be employed for very accurate timing, or distinctive frequency compensation procedures are utilized with considerably less pricey crystals plus the internal oscillator. You will find 3 key sources of mistake from the crystal.
Preliminary circuit and crystal tolerance
Crystal drift with temperature
Crystal aging
The graph down below exhibits numerous ideas linked to RTC accuracy.
The darkish blue trace on this graph reveals a typical first tolerance as well as the change with temperature. The pink trace reveals just the temperature mistake. The crucial element to compensating for temperature may be the actuality the actions of a crystal is properly acknowledged and predicted having a quadratic equation. When the initial error is measured immediately after the circuit board is manufactured as well as the temperature is understood, it can be probable to compensate to the most significant mistake resources.
The yellow band is actually a realistic target for accuracy following thorough compensation. Hold in your mind one ppm more than a calendar year is about 30 seconds. Crystal aging is difficult to compensate for. Fortunately, growing older is generally only a couple ppm every year.
The best way to Alter RTC Timing
Discover our Real Time Clocks. At Heisener, we guarantee top quality standards, pioneering and innovative products in addition to a real-time quote service.
In this article are two solutions to change the timing of the RTC as section of a process to compensate for errors.
The primary diagram (Determine 4) depicts the quantity of oscillator cycles counted with the prescaler for each period on the seconds counter.
The first two seconds would be the common 32,768 cycles. The computer software employs temperature readings as well as the initial mistake to find out which the oscillator is working just a little quick and 32,768 cycles is in fact a time period of 0.99990 seconds. To compensate for this little error, the software tells the RTC to vary the modulus of the prescaler to 32,781 for each fourth second to include some time.
This technique has the benefit of a small modify during the interval from second to 2nd. Nonetheless, the procedure needs an adjustable prescaler and extra registers to carry the unique prescale rely along with the quantity of seconds amongst software from the unique depend. I do think this is often really interesting. A little intricate but rather great.
What if the RTC won't have a specific prescaler to regulate the timing? This diagram demonstrates a different technique.



Related links:

A Operating True Time Clock (RTC)
RTC DS1307 ¡§C Pin Description, Options & Working of DS1307
What on earth is RTC (serious time clock), and why is this checked to execute a plan?
Real-Time Clocks
Introduction ¡§C Real-time Clock (RTC) ICs



您需要登錄後才可以回文 登錄 | 註冊

本版透可值規則

快速回覆 返回頂部 返回列表