Today, I will introduce to you a national invention authorized patent-a compensation calibration method and device for RTC module used in electric energy meters. The patent was applied for by the State Grid Corporation of China, and the authorization was announced on August 31, 2018.
Content descriptionThe present invention relates to the technical field of electric power instruments and meters, in particular to a compensation calibration method and device for an RTC (Real-Time Clock) module applied to an electric energy meter.
Background of the inventionFor most systems that require high time accuracy, the RTC module is an indispensable real-time clock generation module, which can provide an accurate real-time clock for the chip. The RTC module generally has an external crystal, and outputs a clock signal according to the natural oscillation frequency of the crystal. Its structure is relatively simple and the cost is low. However, the oscillation frequency of the crystal is affected by temperature, and its oscillation frequency will have a certain deviation, causing the clock after frequency division to be inaccurate. Therefore, in the application, the RTC module output clock signal needs to be calibrated according to the temperature drift characteristics of the crystal.
In order to make the output clock of the RTC module meet the requirements of the real-time clock, many methods in the prior art adopt a way of compensating the frequency of the divided clock to improve the accuracy of the output clock of the RTC module. Among them, the most widely used method is to measure the crystal temperature in each compensation cycle, and then compensate the oscillation offset, that is, the compensation parameter, to the RTC module output clock according to the temperature drift characteristics of the crystal oscillation.
However, due to the limitation of the smallest compensation unit in the compensation module, the offset of each cycle cannot be fully compensated to the real-time clock, which will leave a compensation remainder and cause a slight compensation deviation. In a single clock calibration cycle, this tiny compensation remainder has little effect on the clock accuracy, but the deviation accumulated in multiple cycles will have an impact on the clock accuracy that cannot be ignored.
Summary of the inventionIn order to solve the technical problems in the prior art that the compensation method for the RTC module easily produces the compensation residual cumulative error and cannot meet the requirements of high precision, the present invention proposes a compensation and calibration method and device for the RTC module applied to the electric energy meter.
A compensation calibration method for the RTC module applied to the electric energy meter includes: obtaining the compensation parameters required for clock calibration according to the measured crystal temperature of the RTC module; calculating the compensation calibration value and the minimum compensation unit of the RTC module according to the compensation parameter and the minimum compensation unit of the RTC module Compensation remainder; the clock frequency of the RTC module is calibrated according to the compensation calibration value and the compensation remainder.
Preferably, in the first compensation cycle, the calibration of the clock frequency of the RTC module according to the compensation calibration value and the compensation remainder specifically includes: adjusting the clock frequency of the RTC module according to the compensation calibration value Perform calibration and store the compensation remainder.
In the nth compensation period, the compensation calibration value and the compensation remainder are calculated according to the compensation parameters and the minimum compensation unit of the RTC module, which specifically includes: obtaining according to the compensation remainder stored in the n-1th compensation period and the nth compensation period The compensation parameter and the minimum compensation unit of the RTC module calculate the compensation calibration value and compensation remainder of the nth compensation cycle.
The calculation of the compensation calibration value and the compensation remainder of the nth compensation period according to the compensation remainder stored in the n-1th compensation period, the compensation parameters obtained during the nth compensation period, and the minimum compensation unit of the RTC module includes: an+mn -1=nn*b+mn. Among them, n is a natural number greater than 1, an represents the compensation parameter obtained in the nth compensation cycle, mn-1 represents the compensation remainder stored in the n-1th compensation cycle, nn represents the minimum compensation unit of the RTC module, and b represents the RTC module An integer multiple of the minimum compensation unit, mn represents the compensation remainder of the nth compensation cycle.
In the nth compensation cycle, the calibration of the clock frequency of the RTC module according to the compensation calibration value and the compensation remainder specifically includes: adjusting the RTC module according to the compensation calibration value of the nth compensation cycle The clock frequency is calibrated, and the compensation remainder of the nth compensation cycle is stored.
The storing the nth compensation remainder specifically includes: covering the compensation remainder of the n-1th compensation period with the compensation remainder of the nth compensation period.
A compensation calibration device for an RTC module applied to an electric energy meter includes: a temperature measurement module for obtaining compensation parameters required for clock calibration according to the measured crystal temperature of the RTC module; a control module for obtaining compensation parameters required for clock calibration according to the compensation parameters and The minimum compensation unit of the RTC module calculates the compensation calibration value and the compensation remainder, and calibrates the clock frequency of the RTC module according to the compensation calibration value and the compensation remainder.
The control module is specifically configured to calibrate the clock frequency of the RTC module according to the compensation calibration value in the first compensation cycle, and store the compensation remainder in a storage module; the storage module uses To store the compensation remainder. The control module is also specifically configured to calculate the nth compensation according to the compensation remainder stored in the n-1th compensation period, the compensation parameters obtained in the nth compensation period, and the minimum compensation unit of the RTC module in the nth compensation period. Periodic compensation calibration value and compensation remainder.
Preferably, the control module is further specifically configured to calibrate the clock frequency of the RTC module according to the compensation calibration value of the nth compensation period in the nth compensation period, and store the nth compensation period The compensation remainder of the compensation cycle. The control module is specifically configured to cover the compensation remainder of the n-1th compensation cycle stored in the storage module with the compensation remainder of the nth compensation cycle.
In the solution provided in this embodiment, by taking into account the cumulative remainder errors of the previous multiple compensation cycles in each compensation cycle, and then performing the current compensation and calibration technical means, it solves the problem of the common RTC in the prior art. The compensation method cannot meet the technical problem of the system demanding high accuracy of the real-time clock, and achieves the technical effect of reducing the impact of accumulated errors on the accuracy of the real-time clock and providing the clock accuracy of the RTC module.
SHAOXING COLORBEE PLASTIC CO.,LTD , https://www.fantaicolorbee.com