CN102163041A - Wide range temperature error compensating method of real-time clock and system thereof - Google Patents

Wide range temperature error compensating method of real-time clock and system thereof Download PDF

Info

Publication number
CN102163041A
CN102163041A CN2011100302953A CN201110030295A CN102163041A CN 102163041 A CN102163041 A CN 102163041A CN 2011100302953 A CN2011100302953 A CN 2011100302953A CN 201110030295 A CN201110030295 A CN 201110030295A CN 102163041 A CN102163041 A CN 102163041A
Authority
CN
China
Prior art keywords
acc
crystal oscillator
error
compensation
frequency division
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2011100302953A
Other languages
Chinese (zh)
Other versions
CN102163041B (en
Inventor
李鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING YUPONT ELECTRIC POWER TECHNOLOGY CO., LTD.
Original Assignee
BEIJIG YUPONT ELECTRIC POWER TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJIG YUPONT ELECTRIC POWER TECHNOLOGY Co Ltd filed Critical BEIJIG YUPONT ELECTRIC POWER TECHNOLOGY Co Ltd
Priority to CN 201110030295 priority Critical patent/CN102163041B/en
Publication of CN102163041A publication Critical patent/CN102163041A/en
Application granted granted Critical
Publication of CN102163041B publication Critical patent/CN102163041B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Oscillators With Electromechanical Resonators (AREA)

Abstract

The invention provides a wide range temperature error compensating method of a real-time clock and a system of the real-time clock. The compensating method comprises the following steps of: calculating the needed error compensation acc through acquiring current state information of a quartz crystal oscillator, judging whether the needed error compensation acc is in a regulating range provided by the system, if not, leading in a controllable error through regulating a crossover frequency of the quartz crystal oscillator so as to change the calculating value of the error compensation acc and cause the error compensation acc to be in the regulating range provided by the system, and compensating the temperature. The temperature error compensating method actively leads the controllable constant error amount E to the error compensation acc through regulating the crossover frequency of the quartz crystal oscillator so as to change the value of the error compensation acc and cause the error compensation acc to be in the regulating range provided by the product. Thus, the product is capable of compensating the temperature error without changing the hardware configuration and preventing the regulating range of the error compensation acc influencing the precise compensation.

Description

Real-time clock wide region method for compensating temperature errors and system thereof
Technical field
The present invention relates to technical field of semiconductors, particularly a kind of real-time clock (RTC, Real-Time Clock) wide region method for compensating temperature errors and error compensation system thereof.
Background technology
Nowadays along with the progress of science and technology, the precision of clock in the existing built-in field is had higher requirement, to satisfy stricter application in real time more accurately.And the factor that influences clock accuracy has two, and first is the error of quartz crystal oscillator itself, and second is the error that variation of ambient temperature is brought.Before a kind of be the intrinsic error of device self, more constant can balancing out by the method that compensates.The mathematical model that a kind of needs in back are set up temperature and crystal oscillator frequency compensates, to balance out error effect.
At present, the solution to clocking error has hardware compensating and two kinds of methods of software compensation usually.Hardware compensating is by integrated circuit company backoff algorithm to be integrated into chip internal, directly finishes compensation by hardware self, need not the developer and is concerned about.Though hardware compensating has the wide advantage of the high compensation range of precision, its price is higher, is not suitable for using in to the relatively responsive product of cost at some.Software compensation is that the method for employing program computation system is embedded among the CPU, by software algorithm it is compensated.The cost of software compensation is cheap relatively, be fit to be applied to some and develop cheaply, but being limited in scope of its temperature compensation is its fatal shortcoming.
Fig. 2 is a quartz crystal oscillator temperature error curve synoptic diagram.Dotted line is the temperature curve that crystal oscillator is not calibrated time error among the figure, and solid line is the standard temperature curve after the crystal oscillator calibration.The trueness error of quartz crystal oscillator and the relation equation of temperature are as follows:
acc=dev+K×(T-T 0) 2
Wherein, acc is for needing the error of compensation, and dev is the error of crystal oscillator when the hump, T 0Temperature during for the crystal oscillator hump (this hump temperature is 25 ℃ usually), T is the working temperature of crystal oscillator, and K is a curve coefficients, and this coefficient is relevant according to the crystal oscillator coefficient that producer provides.
In theory, adopt the method for software compensation that clocking error is compensated,, record hump error dev, the hump temperature T of this quartz crystal oscillator in advance as long as according to top relation equation 0With curve coefficients K, can realize fine compensation to clocking error.
But product in the market is mainly for cost consideration on the one hand, and the offset registers in order to memory error compensation acc that is adopted is generally the register of only supporting the unsigned number word.This makes error compensation acc minimum can only compensate 0ppm.When the error of needs compensation during less than 0ppm, this product just can't continue clock has been carried out error compensation.Based on this reason, we can derive the temperature compensation range of clock according to the top given quartz crystal oscillator trueness error and the relation equation of temperature:
Figure BDA0000045677730000021
On the other hand, because product design is limited in order to the figure place that writes down compensating error acc and hump error dev.This makes that the scope that is provided with of compensating error acc and hump error dev also is limited.Therefore, in actual use, the setting of compensating error acc and hump error dev has the upper limit.
With common STM32F10xxx clock is example, uses software compensation method that it is compensated calibration.The standard frequency F of this clock chip crystal oscillator 0The scope that provides according to the chip handbook for 32768Hz, hump error dev is 0ppm-121ppm (this mainly is because this clock chip is that hump error dev provides 6 bit bytes), hump temperature T 0Being 25 ℃, curve coefficients K is-0.04ppm/ ℃ 2The temperature compensation range that can obtain this clock chip according to above-mentioned clock temperature compensation range calculating formula is-30 ℃<T<80 ℃, it is compensable to be that the temperature error of this clock chip only is only in ℃ temperature range of-30 ℃<T<80, exceed this scope then this chip can't carry out precise dose error compensation.
Comprehensive above factor makes embedded system when adopting software compensation method that clock is carried out error compensation, and actual can only compensating in certain temperature range exceeds this temperature range and then can't continue compensation.This is a software compensation method greatest problem in actual use.Given this, it is perfect that we are necessary that the software compensation method to clock carries out, and makes it to carry out temperature compensation in wideer temperature range, can not increase too much cost simultaneously.
Summary of the invention
Fundamental purpose of the present invention is to solve problems of the prior art, provide a kind of by in the crossover frequency of regulating clock crystal oscillator, crystal oscillator error compensation being carried out correspondence adjustment, thereby improve the error compensating method of the temperature compensation range of clock, and the system that is used to realize this error compensating method.
The objective of the invention is to be achieved by following technical proposals:
A kind of real-time clock wide region method for compensating temperature errors comprises:
Read the crystal oscillator information of storing in the crystal oscillator information-storing device;
According to the crystal oscillator information that is read, based on the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc; Wherein, acc is temperature compensation, and dev is the hump error, the frequency division unit that f adjusts for the crystal oscillator frequency division, and E is the constant error amount, and K is a curve coefficients, and T is a current operating temperature, T 0Be the hump temperature;
Adjust the f of frequency division unit that the crystal oscillator frequency division is adjusted, make error compensation acc at range of adjustment [ACC Min, ACC Max] in, wherein, [ACC Min, ACC Max] be the range of adjustment of error compensation acc;
The error compensation acc that calculates is write offset registers, crystal oscillator is carried out temperature compensation.
The crystal oscillator information of storing in the described crystal oscillator information-storing device comprises essential information and status information;
Described essential information comprises at least: standard frequency F 0, hump error dev, hump temperature T 0, curve coefficients K and error compensation acc adjustable extent [ACC Min, ACC Max];
Described status information comprises at least: f of frequency division unit and current operating temperature T that the crystal oscillator frequency division is adjusted; The f=F-F of frequency division unit that described crystal oscillator frequency division is adjusted 0, be integer; Wherein, F is the current crossover frequency of crystal oscillator;
Described constant error amount E=1/F 0Or E=[1/F 0].
The crystal oscillator information of storing in the described crystal oscillator information-storing device comprises lower limit empirical value R MinWith upper limit empirical value R Max
Range of adjustment [the ACC of described error compensation acc Min, ACC Max] become [ACC Min+ R Min, ACC Max-R Max].
The f of frequency division unit that described adjustment crystal oscillator frequency division is adjusted makes error compensation acc at range of adjustment [ACC Min, ACC Max] in comprise:
Judge that the error compensation acc calculated is whether in range of adjustment;
If less than the lower limit of range of adjustment, then the f of frequency division unit of crystal oscillator frequency division adjustment subtracts 1, more again according to the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc;
If greater than the upper limit of range of adjustment, then the f of frequency division unit of crystal oscillator frequency division adjustment adds 1, more again according to the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc.
The system interval certain hour cycle comes again described method for compensating temperature errors.
The crystal oscillator information of storing in the described crystal oscillator information-storing device comprises the linear error scope [F of crystal oscillator Min, F Max];
If the current crossover frequency F of described crystal oscillator is adjusted the linear error scope [F that exceeds crystal oscillator Min, F Max], then point out to User Alarms.
The standard frequency F of described crystal oscillator 0Be 32768Hz; Described constant error amount E=31ppm.
A kind of real-time clock wide region temperature error compensation system is characterized in that, comprising: crystal oscillator information-storing device, crystal oscillator compensation computing unit, crystal oscillator information adjustment unit and offset registers;
Described crystal oscillator information-storing device is used to store crystal oscillator information;
Described crystal oscillator compensation computing unit is used for according to the crystal oscillator information that reads, based on the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc; Wherein, acc is temperature compensation, and dev is the hump error, the frequency division unit that f adjusts for the crystal oscillator frequency division, and E is the constant error amount, and K is a curve coefficients, and T is a current operating temperature, T 0Be the hump temperature;
Described crystal oscillator information adjustment unit is used to adjust the f of frequency division unit that the crystal oscillator frequency division is adjusted, and makes error compensation acc at range of adjustment [ACC Min, ACC Max] in; Wherein, [ACC Min, ACC Max] be the range of adjustment of error compensation acc;
Described offset registers is used for write error compensation acc, so that crystal oscillator is carried out temperature compensation.
Described crystal oscillator information-storing device comprises essential information storer and state information memory;
At least store in the described essential information storer: standard frequency F 0, hump error dev, hump temperature T 0, curve coefficients K and error compensation acc adjustable extent [ACC Min, ACC Max];
At least store in the described state information memory: f of frequency division unit and current operating temperature T that the crystal oscillator frequency division is adjusted; The f=F-F of frequency division unit that described crystal oscillator frequency division is adjusted 0, be integer; Wherein, F is the current crossover frequency of crystal oscillator;
Described constant error amount E=1/F 0Or E=[1/F 0].
Described crystal oscillator information adjustment unit comprises: error compensation interval judgement module and crystal oscillator information setting module;
Described error compensation interval judgement module is used to judge that the error compensation acc that is calculated is at described range of adjustment [ACC Min, ACC Max] interval range; At least comprise: less than range of adjustment lower limit interval, range of adjustment interval, greater than range of adjustment upper limit interval;
Described crystal oscillator information setting module is used for judging that according to the interval range of error compensation interval judgement module the f of frequency division unit to the adjustment of described crystal oscillator frequency division adjusts.
Pass through the embodiment of the invention, this real-time clock wide region method for compensating temperature errors is by adjusting the crossover frequency of clock crystal oscillator, initiatively error compensation acc is introduced controlled constant error amount E, thereby change the numerical value of error compensation acc, make it to fall within the adjustable extent that product provides.Like this, product can be proceeded temperature error compensation under the situation that does not change hardware configuration, can not limit and can't carry out fine compensation because of the range of adjustment that is subjected to error compensation acc.
Description of drawings
Fig. 1 is a real-time clock wide region method for compensating temperature errors process flow diagram;
Fig. 2 is a quartz crystal oscillator temperature error curve synoptic diagram;
Fig. 3 is the real-time clock wide region method for compensating temperature errors first embodiment process flow diagram;
Fig. 4 is a real-time clock wide region temperature error compensation system construction drawing.
Embodiment
Below in conjunction with drawings and Examples the present invention is further described.
By introducing us as can be seen about existing clock software Error Compensation Technology in the front, the existing problem of existing clock software Error Compensation Technology does not also lie in the precision problem of itself backoff algorithm, but be that development is limit by objective condition such as cost, the range of adjustment that can offer error compensation acc is limited, thereby cause the temperature compensation range of clock limited, can't in wideer temperature range, obtain error compensation.
Based on the problems referred to above analysis, the real-time clock wide region method for compensating temperature errors that the present invention proposes, by adjusting the crossover frequency of clock crystal oscillator, initiatively introduce controlled error, thereby adjust within the adjustable extent that error compensation acc provides to product, make product be proceeded error compensation, and then realize the more error compensation of wide temperature range.
Fig. 1 is a real-time clock wide region method for compensating temperature errors process flow diagram.As shown in Figure 1, real-time clock wide region method for compensating temperature errors comprises the steps:
Read the crystal oscillator information of storing in the crystal oscillator information-storing device;
According to the crystal oscillator information that is read, based on the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc; Wherein, acc is temperature compensation, and dev is the hump error, the frequency division unit that f adjusts for the crystal oscillator frequency division, and E is the constant error amount, and K is a curve coefficients, and T is a current operating temperature, T 0Be the hump temperature;
Adjust the f of frequency division unit that the crystal oscillator frequency division is adjusted, make error compensation acc at range of adjustment [ACC Min, ACC Max] in, wherein, [ACC Min, ACC Max] be the range of adjustment of error compensation acc;
The error compensation acc that calculates is write offset registers, crystal oscillator is carried out temperature compensation.
Here, we adjust existing crystal oscillator trueness error and temperature relation equation, have increased the error deviation amount fE that adjusts based on frequency division in calculating formula.
Wherein, the frequency division unit that f adjusts for the crystal oscillator frequency division, promptly we carry out the side-play amount that the frequency division adjustment is introduced by frequency divider to the frequency of this quartz crystal oscillator.The f=F-F of frequency division unit that this crystal oscillator frequency division is adjusted 0, be integer.Wherein, F is that crystal oscillator carries out the adjusted crossover frequency of frequency division.
Wherein, E is the constant error amount, is the error of being introduced after the every frequency division adjustment through a frequency division unit of crystal oscillator.We carry out frequency division adjustment meeting to crystal oscillator crystal oscillator are introduced error.When we reduce a frequency division unit, then introduce error 1/ (F 0-1); Continue further to reduce a frequency division unit, then introduce error 1/ (F 0-2); So can push away.Otherwise,, then introduce error-1/ (F when our the frequency division unit that raises 0+ 1); Continue further to raise a frequency division unit, then introduce error-1/ (F 0+ 2); So can push away.Because the standard frequency F of crystal oscillator 0Itself be a bigger value (generally more than five-digit number), in the frequency of crystal oscillator linear error scope at itself (with respect to standard frequency F 0Being a very little scope) when regulating, we can think that the error that this adjusting is introduced is a constant margin of error E=1/F 0(unit: ppm).Certainly, calculate for convenience, we can round processing, i.e. E=[1/F in advance with constant error amount E 0].Can compensate the computation process of acc and the result of calculation of final error compensation acc by simplification error like this, thereby form a linear relationship.
This shows that we can initiatively introduce a controlled error deviation amount fE to error compensation acc, thereby change the calculated value of error compensation acc by clock crystal oscillator is carried out the frequency division adjustment, make it to fall within the adjustable extent that product provides.Like this, product can be proceeded temperature error compensation under the situation that does not change hardware configuration, can not limit and can't carry out fine compensation because of the range of adjustment that is subjected to error compensation acc.
Embodiment one:
As from the foregoing, the key of the real-time clock wide region method for compensating temperature errors that the present invention is designed is, by which kind of way the f of frequency division unit to the adjustment of crystal oscillator frequency division adjusts, and the calculated value that makes its error deviation amount fE that introduces can adjust error compensation acc falls within the adjustable extent that product provides.Here, we just provide a kind of feasible embodiment.As shown in Figure 3, specifically comprise the steps:
Step 1 is obtained the essential information of clock quartz crystal oscillator, comprises at least in this essential information: standard frequency F 0, hump error dev, hump temperature T 0, curve coefficients K and error compensation acc adjustable extent [ACC Min, ACC Max];
Step 2 is obtained the status information of current quartz crystal oscillator, comprises at least in this status information: f of frequency division unit and current operating temperature T that the crystal oscillator frequency division is adjusted; The f=F-F of frequency division unit that described crystal oscillator frequency division is adjusted 0, be integer; Wherein, F is the current crossover frequency of crystal oscillator;
If obtain the status information of current quartz crystal oscillator after the start first, the f=0 of frequency division unit that adjusts of the crystal oscillator frequency division of crystal oscillator acquiescence then, promptly crossover frequency is F=F 0
Step 3 is according to the relation equation acc=dev-fE+K * (T-T of the trueness error and the temperature of quartz crystal oscillator 0) 2Error of calculation compensation acc; Wherein, constant error amount E=1/F 0Or E=[1/F 0];
Step 4, whether acc is at range of adjustment [ACC in the error in judgement compensation Min, ACC Max] in? if error compensation acc is at range of adjustment [ACC Min, ACC Max] in, then execution in step 7; If error compensation acc is less than ACC Min, then execution in step 5; If error compensation acc is greater than ACC Max, then execution in step 6;
Step 5 is adjusted frequency divider and is made the crossover frequency of crystal oscillator subtract 1, i.e. the f of frequency division unit of crystal oscillator frequency division adjustment subtracts 1, and returns step 2;
Step 6 is adjusted frequency divider and is made the crossover frequency of crystal oscillator add 1, i.e. the f of frequency division unit of crystal oscillator frequency division adjustment adds 1, and returns step 2;
Step 7 writes offset registers with the error compensation acc that calculates, and quartz crystal oscillator is carried out temperature compensation.
According to above-mentioned method for compensating temperature errors, system is by obtaining the status information of current quartz crystal oscillator, required error compensation acc is calculated, and judge that it is whether within the range of adjustment that system provides, if not within range of adjustment then introduce Controllable Error by the crossover frequency of adjusting quartz crystal oscillator, thereby change the calculated value of error compensation acc, make it finally to fall within the range of adjustment that system provides, carry out temperature compensation again.By this error compensating method, product can make it all can obtain error compensation accurately in the linear error scope of crystal oscillator itself under the situation that does not change hardware configuration, has enlarged the temperature compensation range of clock.
Should also be noted that simultaneously the foregoing description has only provided the feasible adjustment scheme of a kind of f of frequency division unit that the crystal oscillator frequency division is adjusted, not in order to limit protection scope of the present invention.Those skilled in the art can pass through other flow scheme design; provide the adjustment scheme of the different f of frequency division unit that the crystal oscillator frequency division is adjusted; as long as it introduces Controllable Error by the crossover frequency of adjusting crystal oscillator; thereby error compensation acc is fallen within the range of adjustment that system provides, all should be considered as within protection scope of the present invention.
In addition, clock generally needs real-time monitoring Current Temperatures state, and temperature compensation value is in time revised.Therefore, described method for compensating temperature errors also comprises after described step 7:
Step 8, the system interval certain hour cycle is returned step 2.
Here, the length of this time cycle requires difference to decide according to the required refreshing frequency of each product.
Have again, but the compensation range of compensation method provided by the present invention is that adjusted crossover frequency still is in the linear error scope of crystal oscillator itself as previously mentioned.If exceeded the linear error scope of this crystal oscillator, then can't continue to carry out error compensation according to given relation equation, need point out to User Alarms.Based on this, described method for compensating temperature errors also comprises the steps:
Essential information in the described step 1 also comprises the linear error scope [F of crystal oscillator Min, F Max];
Described step 5 is adjusted frequency divider and is made the crossover frequency of crystal oscillator subtract 1; Judge whether adjusted crossover frequency exceeds described linear error scope [F Min, F Max]; If exceed, then point out to User Alarms; If do not exceed, then return step 2;
Described step 6 is adjusted frequency divider and is made the crossover frequency of crystal oscillator add 1; Judge whether adjusted crossover frequency exceeds described linear error scope [F Min, F Max]; If exceed, then point out to User Alarms; If do not exceed, then return step 2.
Should be pointed out that in the product use of reality described hump error dev and error compensation acc generally are the end value parts that can not be set to its range of adjustment.This is because the error ratio of components and parts and quartz crystal oscillator itself is disperseed, if be set to limit end value, can cause the qualification rate of product to descend.Common way is that limit hump error dev and error compensation acc actual is provided with scope within the scope away from an empirical value R of range of adjustment end value.Certainly, the concrete value of this empirical value R is also different according to each product requirement difference, independently is provided with by the developer.Based on this, error compensating method of the present invention is can corresponding adjustment as follows:
Essential information in the described step 1 also comprises empirical value R;
Described step 4, whether acc is at scope [ACC in the error in judgement compensation Min+ R, ACC Max-R] in? if error compensation acc is at range of adjustment [ACC Min+ R, ACC Max-R] in, then execution in step 7; If error compensation acc is less than ACC Min+ R, then execution in step 5; If error compensation acc is greater than ACC Max-R, then execution in step 6.
Certainly, can different empirical value R be set also can for the bound of the range of adjustment of error compensation acc respectively according to actual conditions Min, R Max, then above-mentioned steps can also further be adjusted as follows.
Essential information in the described step 1 also comprises lower limit empirical value R MinWith upper limit empirical value R Max
Described step 4, whether acc is at scope [ACC in the error in judgement compensation Min+ R Min, ACC Max-R Max] in? if error compensation acc is at range of adjustment [ACC Min+ R Min, ACC Max-R Max] in, then execution in step 7; If error compensation acc is less than ACC Min+ R Min, then execution in step 5; If error compensation acc is greater than ACC Max-R Max, then execution in step 6.
Below we are example with common STM32F10xxx clock still, in conjunction with process step given in the foregoing description one, the method for compensating temperature errors designed to the present invention describes.
Step 1 is obtained the essential information of this clock chip crystal oscillator: standard frequency F 0Be 32768Hz, the hump temperature T 0Be 25 ℃, curve coefficients K is-0.04ppm/ ℃ 2, we are assumed to be 42ppm its hump error dev, and the adjustable extent of error compensation acc is [0,121].Because, the standard frequency F of this crystal oscillator 0Be 32768Hz, so constant error amount E=[1/F 0]=[1/32768]=31ppm.
Step 2 is obtained the status information of this clock chip crystal oscillator.As previously mentioned, obtain the status information of current quartz crystal oscillator after the start first, the f=0 of frequency division unit that acquiescence crystal oscillator frequency division is adjusted, promptly crossover frequency is F=F 0Suppose current operating temperature T=80 ℃.
Step 3 is with the trueness error of above-mentioned essential information and status information substitution crystal oscillator and the relation equation acc=dev-fE+K * (T-T of temperature 0) 2=42-0.04 * (80-25) 2=-79.Therefore, by calculating without crossing the error compensation acc=-79ppm that frequency division is adjusted.
According to preceding described, if be [0,121] according to the adjustable extent of prior art error compensation acc.Therefore, clock crystal oscillator can't obtain accurately error compensation under 80 ℃ working temperature.
Yet, according to the given error compensating method of the present invention, because the error compensation acc that calculates is less than the lower limit 0ppm of adjustable extent, system's execution in step 5, and, finally adjust the f=-3 of frequency division unit that the crystal oscillator frequency division is adjusted, i.e. crossover frequency F=32765Hz through three cyclings.
With the trueness error of adjusted essential information and status information substitution crystal oscillator and the relation equation acc=dev-fE+K * (T-T of temperature 0) 2=42+3 * 31-0.04 * (80-25) 2=14.As seen, introducing error deviation amount fE=93ppm by above-mentioned frequency division adjustment, make adjusted error compensation acc=14ppm, be in [0,121] at adjustable extent, and this crystal oscillator is able to continue to obtain precise dose under 80 ℃ working temperature and compensates.
When working temperature revert to 25 ℃ of normal temperature, the trueness error of the status information substitution crystal oscillator that system will newly record and the relation equation acc=dev-fE+K * (T-T of temperature 0) 2=42+3 * 31-0.04 * (25-25) 2=135.At this moment, error compensation acc exceeds the upper limit 121ppm of adjustable extent, and system's execution in step 6 through once adjusting operation, is finally adjusted the f=-2 of frequency division unit that the crystal oscillator frequency division is adjusted, i.e. crossover frequency F=32766Hz.
With the trueness error of adjusted essential information and status information substitution crystal oscillator and the relation equation acc=dev-fE+K * (T-T of temperature 0) 2=42+2 * 31-0.04 * (25-25) 2=104.As seen, again error compensation acc readjustment being 104ppm by above-mentioned frequency division adjustment, is in [0,121] at adjustable extent, and this crystal oscillator is continued to obtain precise dose and compensates.
As seen, by the designed method for compensating temperature errors of the present invention, we can obtain wideer temperature compensation range under the situation that does not change hardware configuration, improved the practicality of software compensation method greatly.And, this error compensating method not only can exceed under the condition of temperature compensation range in working temperature, adjust the trueness error of crystal oscillator and the relation equation of temperature and realize error compensation, also be provided with callback mechanism simultaneously, make it can be when temperature returns temperature compensation range, adjust the trueness error of crystal oscillator and the relation equation of temperature, acc adjusts back with error compensation.
Fig. 4 is a real-time clock wide region temperature error compensation system construction drawing.This error compensation system is the error compensation system in order to realize that above-mentioned error compensating method is designed.As shown in Figure 4, this error compensation system comprises: crystal oscillator information-storing device, crystal oscillator compensation computing unit, crystal oscillator information adjustment unit and offset registers;
Described crystal oscillator information-storing device is used to store crystal oscillator information;
Described crystal oscillator compensation computing unit is connected with crystal oscillator information-storing device and crystal oscillator information adjustment unit, is used for according to the crystal oscillator information that reads, based on the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc; Wherein, acc is temperature compensation, and dev is the hump error, the frequency division unit that f adjusts for the crystal oscillator frequency division, and E is the constant error amount, and K is a curve coefficients, and T is a current operating temperature, T 0Be the hump temperature;
Described crystal oscillator information adjustment unit is connected with crystal oscillator information-storing device and crystal oscillator compensation computing unit, is used to adjust the f of frequency division unit that the crystal oscillator frequency division is adjusted, and makes error compensation acc at range of adjustment [ACC Min, ACC Max] in; Wherein, [ACC Min, ACC Max] be the range of adjustment of error compensation acc;
Described offset registers is connected with crystal oscillator compensation computing unit, is used for write error compensation acc, so that crystal oscillator is carried out temperature compensation.
Described crystal oscillator information-storing device comprises essential information storer and state information memory;
At least store in the described essential information storer: standard frequency F 0, hump error dev, hump temperature T 0, curve coefficients K and error compensation acc adjustable extent [ACC Min, ACC Max];
At least store in the described state information memory: f of frequency division unit and current operating temperature T that the crystal oscillator frequency division is adjusted; The f=F-F of frequency division unit that described crystal oscillator frequency division is adjusted 0, be integer; Wherein, F is the current crossover frequency of crystal oscillator;
Described constant error amount E=1/F 0Or E=[1/F 0].
Described crystal oscillator information adjustment unit comprises: error compensation interval judgement module and crystal oscillator information setting module;
Described error compensation interval judgement module is used to judge that the error compensation acc that is calculated is at described range of adjustment [ACC Min, ACC Max] interval range; At least comprise: less than range of adjustment lower limit interval, range of adjustment interval, greater than range of adjustment upper limit interval;
Described crystal oscillator information setting module is used for judging that according to the interval range of error compensation interval judgement module the f of frequency division unit to the adjustment of described crystal oscillator frequency division adjusts.
When error compensation interval judgement module error in judgement compensation acc fell into less than range of adjustment lower limit interval, the f of frequency division unit that crystal oscillator information setting module is adjusted the adjustment of crystal oscillator frequency division subtracted 1;
When error compensation interval judgement module error in judgement compensation acc fell into greater than range of adjustment upper limit interval, the f of frequency division unit that crystal oscillator information setting module is adjusted the adjustment of crystal oscillator frequency division added 1;
When error compensation interval judgement module error in judgement compensation acc fell into the range of adjustment interval, then crystal oscillator compensation computing unit write offset registers with the error compensation acc that calculates, and crystal oscillator is carried out temperature compensation.
Above-described embodiment; purpose of the present invention, technical scheme and beneficial effect are further described; institute is understood that; the above only is the specific embodiment of the present invention; and be not intended to limit the scope of the invention; within the spirit and principles in the present invention all, any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. a real-time clock wide region method for compensating temperature errors is characterized in that, comprising:
Read the crystal oscillator information of storing in the crystal oscillator information-storing device;
According to the crystal oscillator information that is read, based on the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc; Wherein, acc is temperature compensation, and dev is the hump error, the frequency division unit that f adjusts for the crystal oscillator frequency division, and E is the constant error amount, and K is a curve coefficients, and T is a current operating temperature, T 0Be the hump temperature;
Adjust the f of frequency division unit that the crystal oscillator frequency division is adjusted, make error compensation acc at range of adjustment [ACC Min, ACC Max] in, wherein, [ACC Min, ACC Max] be the range of adjustment of error compensation acc;
The error compensation acc that calculates is write offset registers, crystal oscillator is carried out temperature compensation.
2. real-time clock wide region method for compensating temperature errors as claimed in claim 1 is characterized in that the crystal oscillator information of storing in the described crystal oscillator information-storing device comprises essential information and status information;
Described essential information comprises at least: standard frequency F 0, hump error dev, hump temperature T 0, curve coefficients K and error compensation acc adjustable extent [ACC Min, ACC Max];
Described status information comprises at least: f of frequency division unit and current operating temperature T that the crystal oscillator frequency division is adjusted; The f=F-F of frequency division unit that described crystal oscillator frequency division is adjusted 0, be integer; Wherein, F is the current crossover frequency of crystal oscillator;
Described constant error amount E=1/F 0Or E=[1/F 0].
3. real-time clock wide region method for compensating temperature errors as claimed in claim 1 is characterized in that the crystal oscillator information of storing in the described crystal oscillator information-storing device comprises lower limit empirical value R MinWith upper limit empirical value R Max
Range of adjustment [the ACC of described error compensation acc Min, ACC Max] become [ACC Min+ R Min, ACC Max-R Max].
4. arbitrary described real-time clock wide region method for compensating temperature errors is characterized in that in the described claim 1 to 3, and the f of frequency division unit that described adjustment crystal oscillator frequency division is adjusted makes error compensation acc at range of adjustment [ACC Min, ACC Max] in comprise:
Judge that the error compensation acc calculated is whether in range of adjustment;
If less than the lower limit of range of adjustment, then the f of frequency division unit of crystal oscillator frequency division adjustment subtracts 1, more again according to the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc;
If greater than the upper limit of range of adjustment, then the f of frequency division unit of crystal oscillator frequency division adjustment adds 1, more again according to the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc.
5. real-time clock wide region method for compensating temperature errors as claimed in claim 1 is characterized in that,
The system interval certain hour cycle comes again described method for compensating temperature errors.
6. real-time clock wide region method for compensating temperature errors as claimed in claim 2 is characterized in that, the crystal oscillator information of storing in the described crystal oscillator information-storing device comprises the linear error scope [F of crystal oscillator Min, F Max];
If the current crossover frequency F of described crystal oscillator is adjusted the linear error scope [F that exceeds crystal oscillator Min, F Max], then point out to User Alarms.
7. real-time clock wide region method for compensating temperature errors as claimed in claim 2 is characterized in that the standard frequency F of described crystal oscillator 0Be 32768Hz; Described constant error amount E=31ppm.
8. a real-time clock wide region temperature error compensation system is characterized in that, comprising: crystal oscillator information-storing device, crystal oscillator compensation computing unit, crystal oscillator information adjustment unit and offset registers;
Described crystal oscillator information-storing device is used to store crystal oscillator information;
Described crystal oscillator compensation computing unit is used for according to the crystal oscillator information that reads, based on the trueness error and the temperature relation equation acc=dev-fE+K * (T-T of crystal oscillator 0) 2Error of calculation compensation acc; Wherein, acc is temperature compensation, and dev is the hump error, the frequency division unit that f adjusts for the crystal oscillator frequency division, and E is the constant error amount, and K is a curve coefficients, and T is a current operating temperature, T 0Be the hump temperature;
Described crystal oscillator information adjustment unit is used to adjust the f of frequency division unit that the crystal oscillator frequency division is adjusted, and makes error compensation acc at range of adjustment [ACC Min, ACC Max] in; Wherein, [ACC Min, ACC Max] be the range of adjustment of error compensation acc;
Described offset registers is used for write error compensation acc, so that crystal oscillator is carried out temperature compensation.
9. real-time clock wide region temperature error compensation as claimed in claim 8 system is characterized in that described crystal oscillator information-storing device comprises essential information storer and state information memory;
At least store in the described essential information storer: standard frequency F 0, hump error dev, hump temperature T 0, curve coefficients K and error compensation acc adjustable extent [ACC Min, ACC Max];
At least store in the described state information memory: f of frequency division unit and current operating temperature T that the crystal oscillator frequency division is adjusted; The f=F-F of frequency division unit that described crystal oscillator frequency division is adjusted 0, be integer; Wherein, F is the current crossover frequency of crystal oscillator;
Described constant error amount E=1/F 0Or E=[1/F 0].
10. real-time clock wide region temperature error compensation as claimed in claim 8 system is characterized in that described crystal oscillator information adjustment unit comprises: error compensation interval judgement module and crystal oscillator information setting module;
Described error compensation interval judgement module is used to judge that the error compensation acc that is calculated is at described range of adjustment [ACC Min, ACC Max] interval range; At least comprise: less than range of adjustment lower limit interval, range of adjustment interval, greater than range of adjustment upper limit interval;
Described crystal oscillator information setting module is used for judging that according to the interval range of error compensation interval judgement module the f of frequency division unit to the adjustment of described crystal oscillator frequency division adjusts.
CN 201110030295 2011-01-27 2011-01-27 Wide range temperature error compensating method of real-time clock and system thereof Active CN102163041B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110030295 CN102163041B (en) 2011-01-27 2011-01-27 Wide range temperature error compensating method of real-time clock and system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110030295 CN102163041B (en) 2011-01-27 2011-01-27 Wide range temperature error compensating method of real-time clock and system thereof

Publications (2)

Publication Number Publication Date
CN102163041A true CN102163041A (en) 2011-08-24
CN102163041B CN102163041B (en) 2013-02-27

Family

ID=44464314

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110030295 Active CN102163041B (en) 2011-01-27 2011-01-27 Wide range temperature error compensating method of real-time clock and system thereof

Country Status (1)

Country Link
CN (1) CN102163041B (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102520608A (en) * 2011-12-19 2012-06-27 深圳市航盛电子股份有限公司 Method and device for automatically correcting automobile vehicle-mounted clock
CN102624331A (en) * 2012-04-01 2012-08-01 钜泉光电科技(上海)股份有限公司 Temperature-compensation circuit and temperature-compensation method of real-time clock
CN103149832A (en) * 2013-01-18 2013-06-12 深圳市文鼎创数据科技有限公司 Clock calibration method of dynamic password token and dynamic password token
CN103176400A (en) * 2013-01-14 2013-06-26 杭州海兴电力科技股份有限公司 Intelligent ammeter clock calibration method
CN103248358A (en) * 2013-05-30 2013-08-14 上海贝岭股份有限公司 Real-time clock compensating device and method
CN103699173A (en) * 2013-11-04 2014-04-02 矽恩微电子(厦门)有限公司 Timing error compensation method of real-time clock
CN105573106A (en) * 2014-10-08 2016-05-11 无锡华润矽科微电子有限公司 Smart meter RTC timing precision correction circuit and method thereof
CN108227471A (en) * 2016-12-21 2018-06-29 展讯通信(上海)有限公司 GPS shares the calibration method and device of clock
CN114088153A (en) * 2020-08-24 2022-02-25 成都秦川物联网科技股份有限公司 Temperature compensation method for intelligent gas meter of Internet of things

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010190585A (en) * 2009-02-16 2010-09-02 Panasonic Electric Works Co Ltd Electronic clock device, electronic equipment including the same, and control system
CN101943885A (en) * 2010-09-08 2011-01-12 珠海中慧微电子有限公司 Method for correcting timing precision of RTC inside SOC in intelligent electric meter

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010190585A (en) * 2009-02-16 2010-09-02 Panasonic Electric Works Co Ltd Electronic clock device, electronic equipment including the same, and control system
CN101943885A (en) * 2010-09-08 2011-01-12 珠海中慧微电子有限公司 Method for correcting timing precision of RTC inside SOC in intelligent electric meter

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
《商情》 20081230 龙桂深 精密计时--自动化与大众化 , 第3期 *
无: "《RM0008 Reference manual》", 30 June 2009, article "RM0008 Reference manual" *
龙桂深: "精密计时——自动化与大众化", 《商情<教育经济研究>》, no. 3, 30 December 2008 (2008-12-30) *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102520608A (en) * 2011-12-19 2012-06-27 深圳市航盛电子股份有限公司 Method and device for automatically correcting automobile vehicle-mounted clock
CN102520608B (en) * 2011-12-19 2014-04-02 深圳市航盛电子股份有限公司 Method and device for automatically correcting automobile vehicle-mounted clock
CN102624331A (en) * 2012-04-01 2012-08-01 钜泉光电科技(上海)股份有限公司 Temperature-compensation circuit and temperature-compensation method of real-time clock
CN103176400A (en) * 2013-01-14 2013-06-26 杭州海兴电力科技股份有限公司 Intelligent ammeter clock calibration method
CN103149832A (en) * 2013-01-18 2013-06-12 深圳市文鼎创数据科技有限公司 Clock calibration method of dynamic password token and dynamic password token
CN103248358A (en) * 2013-05-30 2013-08-14 上海贝岭股份有限公司 Real-time clock compensating device and method
CN103699173A (en) * 2013-11-04 2014-04-02 矽恩微电子(厦门)有限公司 Timing error compensation method of real-time clock
CN103699173B (en) * 2013-11-04 2018-10-23 矽恩微电子(厦门)有限公司 A kind of real-time clock timing error compensation method
CN105573106A (en) * 2014-10-08 2016-05-11 无锡华润矽科微电子有限公司 Smart meter RTC timing precision correction circuit and method thereof
CN105573106B (en) * 2014-10-08 2018-10-09 无锡华润矽科微电子有限公司 To the amendment circuit and its method of RTC accuracy of timekeeping in a kind of intelligent electric meter
CN108227471A (en) * 2016-12-21 2018-06-29 展讯通信(上海)有限公司 GPS shares the calibration method and device of clock
CN114088153A (en) * 2020-08-24 2022-02-25 成都秦川物联网科技股份有限公司 Temperature compensation method for intelligent gas meter of Internet of things

Also Published As

Publication number Publication date
CN102163041B (en) 2013-02-27

Similar Documents

Publication Publication Date Title
CN102163041B (en) Wide range temperature error compensating method of real-time clock and system thereof
CN108475101B (en) Method and apparatus for digital under-voltage detection and control
CN100456858C (en) Time error compensation device and method for terminal
US20200328718A1 (en) Systems and methods for frequency compensation of real-time-clock systems
CN103176400B (en) Intelligent ammeter clock calibration method
JP5259877B2 (en) Adaptive voltage scaler (AVS), voltage level scaling method, circuit, and computer readable medium
CN102075143A (en) Temperature compensation method for piezoelectric oscillator, and piezoelectric oscillator
CN103904998B (en) Method and device for adjusting frequency of mobile terminal
CN110262210B (en) Crystal oscillator time keeping method based on counter
CN108011631A (en) Work clock generation method, clock source and chip
CN110007871A (en) A kind of solid state hard disk data hold time method for inspecting, device and equipment
CN109639238B (en) Passive crystal oscillator driving regulation and control method, device, equipment and storage medium
CN203299557U (en) Real-time clock compensation device
US6636121B2 (en) Method for estimating crystal coefficient values for a signal generator
CN107765760A (en) RTC block clock source dynamic calibration method and its system under instrument sleep pattern
EP3633856A1 (en) Method, apparatus and system for compensating for frequency device, and computer-readable storage medium
CN103092068A (en) Timing method and timing system
US9677908B2 (en) Metrology timekeeping systems and methods
CN109031362B (en) Method and system for correcting clock frequency deviation of receiver
JP2012047705A (en) Time correction device and control method
TW200409466A (en) Information processing apparatus with clock generating circuit and information processing apparatus with clock delaying circuit
CN102916654A (en) Crystal oscillator ageing compensation method
CN103248358A (en) Real-time clock compensating device and method
CN102096440A (en) Method for keeping high precision of real time clock circuit
CN110442186A (en) Deviation correction method, intelligent terminal and storage medium when a kind of clock is walked

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee
CP01 Change in the name or title of a patent holder

Address after: 100045 Beijing city Xicheng District Fuxingmenwai Nan Xiang Di Zang an 1

Patentee after: BEIJING YUPONT ELECTRIC POWER TECHNOLOGY CO., LTD.

Address before: 100045 Beijing city Xicheng District Fuxingmenwai Nan Xiang Di Zang an 1

Patentee before: Beijig Yupont Electric Power Technology Co., Ltd.