CN118860064A - Electric energy meter clock precision adjusting method and device, electronic equipment and storage medium - Google Patents
Electric energy meter clock precision adjusting method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN118860064A CN118860064A CN202410858045.6A CN202410858045A CN118860064A CN 118860064 A CN118860064 A CN 118860064A CN 202410858045 A CN202410858045 A CN 202410858045A CN 118860064 A CN118860064 A CN 118860064A
- Authority
- CN
- China
- Prior art keywords
- clock
- frequency
- management chip
- source
- value
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 239000013078 crystal Substances 0.000 claims abstract description 44
- 238000004590 computer program Methods 0.000 claims description 20
- 230000008859 change Effects 0.000 claims description 12
- 238000004364 calculation method Methods 0.000 claims description 7
- 230000010355 oscillation Effects 0.000 claims description 4
- 230000000630 rising effect Effects 0.000 claims description 4
- 238000007726 management method Methods 0.000 description 85
- 238000010586 diagram Methods 0.000 description 11
- 238000012545 processing Methods 0.000 description 10
- 230000006870 function Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000008014 freezing Effects 0.000 description 1
- 238000007710 freezing Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Landscapes
- Oscillators With Electromechanical Resonators (AREA)
Abstract
The invention provides a method and a device for adjusting clock precision of an electric energy meter, electronic equipment and a storage medium. The method provided by the invention comprises the following steps: after the clock management chip is electrified, the clock management chip works with the clock of the high-frequency RC oscillator; taking the first preset frequency clock signal as a signal counting source, taking the second preset frequency clock signal output by an external clock source crystal as a signal capturing source, and capturing and counting the second preset frequency clock signal to obtain a capturing count value; and determining a deviation value according to the captured count value and a standard count value of a second preset frequency clock signal, and adjusting the original frequency adjustment value of the frequency adjustment register according to the deviation value to obtain an adjusted frequency adjustment value, so that a master clock of the clock management chip operates according to the adjusted frequency adjustment value. The method of the invention can improve the clock precision of the clock management chip and the clock precision of the electric energy meter under the condition of not increasing more hardware cost and more power consumption.
Description
Technical Field
The invention relates to the technical field of electric energy meters, in particular to an electric energy meter clock precision adjusting method and device, electronic equipment and a storage medium.
Background
The intelligent electric energy meter generally has the functions of electric energy metering, data processing, real-time monitoring, automatic control, information interaction and the like. The intelligent electric energy meter can comprise a metering module (metering core) and a management module (management core), wherein the metering module is mainly used for realizing metering, clock, freezing, event, communication and other functions, the management module is required to participate in the external communication of the electric energy meter, and meanwhile, the communication of the main station to the metering module and the expansion module is required to be forwarded to the corresponding module, and after the corresponding module responds, the communication is forwarded to the main station by the management core. Since the management module is required to carry out data processing of the multifunctional module, the MCU ((Microcontroller Unit, micro control unit)) running the higher system clock is required to clock it.
The complex-denier micro FM33A0XXEV clock management chip comprises a low-frequency crystal oscillation circuit, a high-frequency crystal oscillator, a high-frequency RC oscillator, low-power consumption internal ring oscillator, a phase-locked loop PLL_L, a phase-locked loop PLL_H and other clock sources, and clock generation modules in the chip integrate the clock sources so as to provide required clocks for all the modules. When the clock management chip provides the system clock to the management module, the combination of the high frequency crystal oscillator and the phase-locked loop pll_h can provide the system clock of up to 64MHz, but because the combination includes one more external high frequency crystal, the cost and power consumption are increased, and the combination of the high frequency RC oscillator, the low frequency crystal oscillator circuit and the phase-locked loop pll_h can also provide the system clock of up to 64MHz, the combination uses the internal high frequency RC oscillator and the external low speed 32768Hz crystal, the cost and power consumption are lower, but because the accuracy of the system clock is also lower due to the use of the internal high frequency RC oscillator.
Disclosure of Invention
The invention aims to provide a method and a device for adjusting clock precision of an electric energy meter, electronic equipment and a storage medium, so as to solve the technical problem that cost, power consumption and precision cannot be considered in the prior art.
The technical scheme of the invention is as follows, and provides a clock precision adjusting method of an electric energy meter, which comprises the following steps:
after the clock management chip is electrified, enabling the clock management chip to work with a clock of a high-frequency RC oscillator;
Taking a first preset frequency clock signal output by the inside of the clock management chip as a signal counting source, taking a second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source, and capturing and counting the second preset frequency clock signal to obtain a capturing count value;
and determining a deviation value according to the capture count value and the standard count value of the second preset frequency clock signal, and adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value to obtain an adjusted frequency adjustment value, so that the master clock of the clock management chip operates according to the adjusted frequency adjustment value.
Further, taking the first preset frequency clock signal output by the clock management chip as a signal counting source, taking the second preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal capturing source, and capturing and counting the second preset frequency clock signal, including:
When the clock management chip is initialized or the temperature change value inside the clock management chip exceeds a preset temperature change threshold value in preset time, a first preset frequency clock signal output inside the clock management chip is used as a signal counting source, a second preset frequency clock signal output by a clock source crystal outside the clock management chip is used as a signal capturing source, and capturing and counting are carried out on the second preset frequency clock signal.
Further, taking the first preset frequency clock signal output by the clock management chip as a signal counting source, taking the second preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal capturing source, and capturing and counting the second preset frequency clock signal, including:
Taking a first preset frequency clock signal output by the clock management chip as a signal counting source, taking a second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source, the rising edge of the signal capture source is captured using a single pulse period capture mode to capture count the second preset frequency clock signal.
Further, determining an offset value based on the capture count value and a standard count value of the second preset frequency clock signal, including:
Determining a deviation value according to the captured count value, the standard count value of the second preset frequency clock signal and a deviation calculation formula, wherein the deviation calculation formula comprises
Wherein m is an offset value, N 1 is the capture count value, N 0 is the standard count value, F 1 is a first preset frequency, F 2 is a second preset frequency, α is a prescaler value of the signal count source, and β is a multiple of a center frequency of the frequency adjustment register.
Further, adjusting the original frequency tuning value of the frequency tuning register of the high-frequency RC oscillator according to the deviation value includes:
and judging whether the deviation value is larger than a preset deviation threshold value, if so, re-determining the deviation value until the preset determination times are reached, otherwise, adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value.
Further, the clock management chip internally outputs a first preset frequency clock signal as a signal counting source, and the signal counting source comprises:
And taking the 64MHz main clock signal output by the inside of the clock management chip or the 8MHz clock signal after the frequency division of the 64Mhz main clock signal as a signal counting source.
Further, taking the second preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal capturing source comprises the following steps:
And taking a second preset frequency clock signal output by a low-frequency crystal oscillation circuit crystal outside the clock management chip as a signal capturing source.
The invention also provides an electric energy meter clock precision adjusting device, which comprises an enabling module, a capturing counting module and an adjusting module;
The enabling module is used for enabling the clock management chip to work with a clock of the high-frequency RC oscillator after the clock management chip is electrified;
The capture counting module is used for capturing and counting a second preset frequency clock signal by taking the first preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal capturing source and taking the second preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal counting source to obtain a capture count value;
The adjusting module is configured to determine a deviation value according to the capture count value and the standard count value of the second preset frequency clock signal, and adjust an original frequency adjustment value of a frequency adjustment register of the high-frequency RC oscillator according to the deviation value to obtain an adjusted frequency adjustment value, so that a master clock of the clock management chip operates according to the adjusted frequency adjustment value.
Another technical scheme of the invention is as follows, and further provides an electronic device, which comprises a memory and a processor, wherein the memory stores a computer program which can be executed by the processor, and the clock precision adjusting method of the electric energy meter according to any one of the technical schemes is realized when the processor executes the computer program.
Another aspect of the present invention further provides a computer readable storage medium, where a computer program is stored, where the computer program when executed by a processor implements the method for adjusting clock accuracy of an electric energy meter according to any one of the above aspects.
The invention has the beneficial effects that: after the clock management chip is electrified, enabling the clock management chip to work with a clock of a high-frequency RC oscillator; taking a first preset frequency clock signal output by the inside of the clock management chip as a signal counting source, taking a second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source, and capturing and counting the second preset frequency clock signal to obtain a capturing count value; determining a deviation value according to the capture count value and the standard count value of the second preset frequency clock signal, and adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value to obtain an adjusted frequency adjustment value, so that a master clock of the clock management chip operates according to the adjusted frequency adjustment value; through the technical scheme, the clock precision of the clock management chip can be improved under the condition of not increasing more hardware cost and more power consumption, so that the clock precision of the electric energy meter can be improved.
Drawings
FIG. 1 is a schematic flow chart of a method for adjusting clock accuracy of an electric energy meter according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an electric energy meter clock precision adjusting device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
Fig. 4 is a schematic structural diagram of a computer readable storage medium according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the invention. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
Fig. 1 is a flow chart of a method for adjusting clock accuracy of an electric energy meter according to an embodiment of the invention. It should be noted that, if the same result is substantially achieved, the clock accuracy adjustment method of the present invention is not limited to the flow sequence shown in fig. 1. As shown in fig. 1, the method for adjusting clock accuracy of the electric energy meter comprises the following steps:
S101, after a clock management chip is electrified, enabling the clock management chip to work with a clock of a high-frequency RC oscillator;
In one embodiment, after the FM33A0610EV clock management chip is powered on, an 8MHz clock of a high-frequency RC oscillator (RCHF) is enabled to work, and a hardware circuit of the FM33A0610EV clock management chip reads an 8MHz calibration value from an LDT1 pin of the clock management chip, so that a normal temperature frequency error is less than +/-0.5%, and a full temperature area change is less than +/-2%.
S102, taking a first preset frequency clock signal output by the inside of the clock management chip as a signal counting source, taking a second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source, and capturing and counting the second preset frequency clock signal to obtain a capturing count value;
It should be noted that, the second preset frequency output by the clock source crystal outside the clock management chip is not affected by the temperature change inside the clock management chip, and thus can be used as a signal capturing source.
In some embodiments, taking the first preset frequency clock signal output by the clock management chip as a signal counting source and taking the second preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal capturing source, capturing and counting the second preset frequency clock signal includes:
When the clock management chip is initialized or the temperature change value inside the clock management chip exceeds a preset temperature change threshold value in preset time, a first preset frequency clock signal output inside the clock management chip is used as a signal counting source, a second preset frequency clock signal output by a clock source crystal outside the clock management chip is used as a signal capturing source, and capturing and counting are carried out on the second preset frequency clock signal.
In one embodiment, after the clock management chip is initialized, the master clock runs at 64Mhz, and the electric energy meter can preset time at intervals, for example, 10s at intervals, and the temperature inside the clock management chip is obtained through the temperature sensor; when the clock management chip is initialized or the internal temperature change value of the clock management chip exceeds a preset temperature change threshold, capturing and counting the second preset frequency clock signal once, and further adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator once, wherein the internal temperature change value of the clock management chip in the preset time may be an absolute value of a difference between the internal temperature value of the clock management chip at a start time point of the preset time and the internal temperature value of the clock management chip at an end time point of the preset time, and for example, the preset temperature change threshold may be 5 ℃.
In some embodiments, taking the first preset frequency clock signal output by the clock management chip as a signal counting source and taking the second preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal capturing source, capturing and counting the second preset frequency clock signal includes:
Taking a first preset frequency clock signal output by the clock management chip as a signal counting source, taking a second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source, the rising edge of the signal capture source is captured using a single pulse period capture mode to capture count the second preset frequency clock signal.
In a specific embodiment, the rising edge of the signal capturing source is captured by using a single pulse period capturing mode, so as to capture and count the clock signal with the second preset frequency, and obtain a capture count value N 1, where the capture count value N 1 corresponds to the period of the clock signal output by the clock source crystal, that is, corresponds to the second preset frequency.
In some embodiments, determining the offset value from the capture count value and a standard count value of the second preset frequency clock signal comprises:
Determining a deviation value according to the captured count value, the standard count value of the second preset frequency clock signal and a deviation calculation formula, wherein the deviation calculation formula comprises
Wherein m is an offset value, N 1 is the capture count value, N 0 is the standard count value, F 1 is a first preset frequency, F 2 is a second preset frequency, α is a prescaler value of the signal count source, and β is a multiple of a center frequency of the frequency adjustment register.
According to the embodiment of the invention, the deviation value is determined according to the capture count value, the standard count value of the second preset frequency clock signal and the deviation calculation formula, so that the deviation of the frequency adjustment register of the high-frequency RC oscillator caused by the influence of temperature can be determined, the deviation is compensated, and the clock precision of the clock management chip in the electric energy meter can be improved.
In some embodiments, taking the first preset frequency clock signal output by the clock management chip as a signal counting source comprises:
And taking the 64MHz main clock signal output by the inside of the clock management chip or the 8MHz clock signal after the frequency division of the 64Mhz main clock signal as a signal counting source.
The 8MHz clock of the high frequency RC oscillator is multiplied by the pll_h to obtain a 64MHz master clock signal.
In some embodiments, taking the second preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal capturing source comprises:
And taking a second preset frequency clock signal output by a low-frequency crystal oscillation circuit crystal outside the clock management chip as a signal capturing source.
In one embodiment, the 8MHz clock signal obtained by dividing the 64Mhz main clock signal output by the clock management chip is used as a signal counting source, the 32768Hz clock signal output by the low frequency crystal oscillating circuit crystal outside the clock management chip is used as a signal capturing source, the prescaler value alpha of the signal counting source is 128, the multiple beta of the center frequency of the frequency adjusting register is 0.25%, if,
S103, determining a deviation value according to the capture count value and the standard count value of the second preset frequency clock signal, and adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value to obtain an adjusted frequency adjustment value, so that the master clock of the clock management chip operates according to the adjusted frequency adjustment value.
In some embodiments, adjusting the original frequency tuning value of the frequency tuning register of the high frequency RC oscillator according to the offset value includes:
and judging whether the deviation value is larger than a preset deviation threshold value, if so, re-determining the deviation value until the preset determination times are reached, otherwise, adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value.
In a specific embodiment, if the deviation value is greater than the preset deviation threshold, it indicates that the capturing count is not accurate enough, and the capturing count needs to be re-captured, and the deviation value is re-determined until the preset determination times are reached, where the preset determination times may be 5, and the preset deviation threshold may be determined according to the actual situation. If the deviation value is larger than the preset deviation threshold value after the preset determination times are reached, the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator is not adjusted, so that the high-frequency RC oscillator works with a default 8MHz clock.
In one specific embodiment, the frequency of the high-frequency RC oscillator is represented as 8'h00 in a frequency tuning register, the frequency is represented as 8' hFF, the tuning range is +/-30% of the center frequency, the tuning step is beta times of the center frequency, and beta can be 0.25%. When the frequency adjustment register of the high-frequency RC oscillator needs to be adjusted, the 8MHz adjustment value is read from the LDT1 pin, then the frequency adjustment value is written into the RCHFTR register (frequency adjustment register) of the high-frequency RC oscillator according to the needed frequency adjustment value, the original frequency adjustment value rchf _trim of the frequency adjustment register of the high-frequency RC oscillator is subtracted by m to obtain an adjusted frequency adjustment value, and the adjusted frequency adjustment value is used as the latest frequency adjustment value of the frequency adjustment register, so that the master clock of the clock management chip runs according to the latest frequency adjustment value. The original frequency adjustment value may be a frequency adjustment value before adjustment. When the frequency adjustment register of the high-frequency RC oscillator needs to be adjusted again, the latest frequency adjustment value of the frequency adjustment register can be used as the original frequency adjustment value of the frequency adjustment register, and the latest frequency adjustment value adjusted at the present time can be determined according to the latest deviation value.
According to the method for adjusting the clock precision of the electric energy meter, after the clock management chip is electrified, the clock management chip works with the clock of the high-frequency RC oscillator; taking a first preset frequency clock signal output by the inside of the clock management chip as a signal counting source, taking a second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source, and capturing and counting the second preset frequency clock signal to obtain a capturing count value; determining a deviation value according to the capture count value and the standard count value of the second preset frequency clock signal, and adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value to obtain an adjusted frequency adjustment value, so that a master clock of the clock management chip operates according to the adjusted frequency adjustment value; under the condition of not increasing more hardware cost and more power consumption, the clock precision of the clock management chip can be improved, so that the clock precision of the electric energy meter can be improved. According to the clock precision adjusting method for the electric energy meter, provided by the embodiment of the invention, a high-frequency crystal is not needed, so that the hardware cost is saved, the clock precision requirement of the intelligent electric energy meter in a full temperature range is ensured, and the requirements of high-speed data processing and communication interaction of each route of the intelligent electric energy meter can be met.
Based on the above method for adjusting clock accuracy of the electric energy meter, the embodiment of the invention also provides an electric energy meter clock accuracy adjusting device, a structural schematic diagram of which is shown in fig. 2, wherein the electric energy meter clock accuracy adjusting device 20 comprises an enabling module 21, a capturing counting module 22 and an adjusting module 23;
the enabling module 21 is configured to enable the clock management chip to operate with a clock of the high-frequency RC oscillator after the clock management chip is powered on;
The capture counting module 22 is configured to capture and count a second preset frequency clock signal output by a clock source crystal outside the clock management chip, with the first preset frequency clock signal output by the clock management chip as a signal counting source, and with the second preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal capturing source, so as to obtain a capture count value;
The adjusting module 23 is configured to determine a deviation value according to the capture count value and the standard count value of the second preset frequency clock signal, and adjust an original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value to obtain an adjusted frequency adjustment value, so that a master clock of the clock management chip operates according to the adjusted frequency adjustment value.
For other details of implementing the above technical solution by each module in the above device for adjusting clock accuracy of electric energy meter, reference may be made to the description in the method for adjusting clock accuracy of electric energy meter provided in the above embodiment of the invention, which is not repeated here.
Based on the above method for adjusting clock accuracy of the electric energy meter, the embodiment of the invention also provides an electronic device, and a schematic structural diagram thereof, as shown in fig. 3, the electronic device 30 includes a processor 31 and a memory 32 coupled with the processor 31. The memory 32 stores a computer program which, when executed by the processor 31, causes the processor 31 to execute the steps of the electric energy meter clock accuracy adjustment method in the above-described embodiment.
For other details of implementing the above technical solution by the processor 31 in the electronic device 30, reference may be made to the description of the method for adjusting clock accuracy of the electric energy meter provided in the above embodiment of the invention, which is not repeated herein.
The processor 31 may also be called a CPU (central processing unit), and the processor 31 may be an integrated circuit chip with signal processing capability; the processor 31 may also be a general purpose processor, such as a microprocessor or the processor 31 may also be any conventional processor, a DSP (DIGITAL SIGNAL processor), an ASIC (Application SPECIFIC INTEGRATED Circuit), an FPGA (Field Programmable GATA ARRAY, field programmable gate array) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components.
The embodiment of the invention also provides a computer readable storage medium, the structure of which is schematically shown in fig. 4, and the storage medium 40 stores a readable computer program 41; the computer program 41 may be stored in the storage medium 40 as a software product, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium 40 includes: various media capable of storing program codes, such as a U disk, a mobile hard disk, a magnetic disk or an optical disk, a ROM (Read-Only Memory), a RAM (Random Access Memory), or a terminal device such as a computer, a server, a mobile phone, a tablet.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (Solid STATE DISK, SSD)), etc.
The above description has been made in detail for the technical solutions provided by the present application, and specific examples are applied in the present application to illustrate the principles and embodiments of the present application, and the above examples are only used to help understand the method and core ideas of the present application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus and computer program products according to the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.
Claims (10)
1. The method for adjusting the clock precision of the electric energy meter is characterized by comprising the following steps of:
after the clock management chip is electrified, enabling the clock management chip to work with a clock of a high-frequency RC oscillator;
Taking a first preset frequency clock signal output by the inside of the clock management chip as a signal counting source, taking a second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source, and capturing and counting the second preset frequency clock signal to obtain a capturing count value;
and determining a deviation value according to the capture count value and the standard count value of the second preset frequency clock signal, and adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value to obtain an adjusted frequency adjustment value, so that the master clock of the clock management chip operates according to the adjusted frequency adjustment value.
2. The method for adjusting clock accuracy of an electric energy meter according to claim 1, wherein capturing and counting the second preset frequency clock signal by taking the first preset frequency clock signal output by the clock management chip as a signal counting source and taking the second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source comprises:
When the clock management chip is initialized or the temperature change value inside the clock management chip exceeds a preset temperature change threshold value in preset time, a first preset frequency clock signal output inside the clock management chip is used as a signal counting source, a second preset frequency clock signal output by a clock source crystal outside the clock management chip is used as a signal capturing source, and capturing and counting are carried out on the second preset frequency clock signal.
3. The method for adjusting clock accuracy of an electric energy meter according to claim 1, wherein capturing and counting the second preset frequency clock signal by taking the first preset frequency clock signal output by the clock management chip as a signal counting source and taking the second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source comprises:
Taking a first preset frequency clock signal output by the clock management chip as a signal counting source, taking a second preset frequency clock signal output by a clock source crystal outside the clock management chip as a signal capturing source, the rising edge of the signal capture source is captured using a single pulse period capture mode to capture count the second preset frequency clock signal.
4. The method of claim 1, wherein determining the offset value based on the captured count value and a standard count value of the second preset frequency clock signal comprises:
Determining a deviation value according to the captured count value, the standard count value of the second preset frequency clock signal and a deviation calculation formula, wherein the deviation calculation formula comprises
Wherein m is an offset value, N 1 is the capture count value, N 0 is the standard count value, F 1 is a first preset frequency, F 2 is a second preset frequency, α is a prescaler value of the signal count source, and β is a multiple of a center frequency of the frequency adjustment register.
5. The method for adjusting clock accuracy of an electric energy meter according to claim 1, wherein adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value comprises:
and judging whether the deviation value is larger than a preset deviation threshold value, if so, re-determining the deviation value until the preset determination times are reached, otherwise, adjusting the original frequency adjustment value of the frequency adjustment register of the high-frequency RC oscillator according to the deviation value.
6. The method for adjusting clock accuracy of an electric energy meter according to claim 1, wherein the clock signal with the first preset frequency output from the clock management chip is used as a signal counting source, and the method comprises the following steps:
And taking the 64MHz main clock signal output by the inside of the clock management chip or the 8MHz clock signal after the frequency division of the 64Mhz main clock signal as a signal counting source.
7. The method for adjusting clock accuracy of an electric energy meter according to claim 1, wherein the clock signal with a second preset frequency output by a clock source crystal outside the clock management chip is used as a signal capturing source, and the method comprises the steps of:
And taking a second preset frequency clock signal output by a low-frequency crystal oscillation circuit crystal outside the clock management chip as a signal capturing source.
8. The clock precision adjusting device of the electric energy meter is characterized by comprising an enabling module, a capturing counting module and an adjusting module;
The enabling module is used for enabling the clock management chip to work with a clock of the high-frequency RC oscillator after the clock management chip is electrified;
The capture counting module is used for capturing and counting a second preset frequency clock signal by taking the first preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal capturing source and taking the second preset frequency clock signal output by the clock source crystal outside the clock management chip as a signal counting source to obtain a capture count value;
The adjusting module is configured to determine a deviation value according to the capture count value and the standard count value of the second preset frequency clock signal, and adjust an original frequency adjustment value of a frequency adjustment register of the high-frequency RC oscillator according to the deviation value to obtain an adjusted frequency adjustment value, so that a master clock of the clock management chip operates according to the adjusted frequency adjustment value.
9. An electronic device comprising a memory, a processor, the memory storing a computer program executable by the processor, wherein the processor implements the method of clock accuracy adjustment of the power meter of any one of claims 1 to 7 when the computer program is executed.
10. A computer-readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the electric energy meter clock accuracy adjustment method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410858045.6A CN118860064A (en) | 2024-06-28 | 2024-06-28 | Electric energy meter clock precision adjusting method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410858045.6A CN118860064A (en) | 2024-06-28 | 2024-06-28 | Electric energy meter clock precision adjusting method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118860064A true CN118860064A (en) | 2024-10-29 |
Family
ID=93170271
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410858045.6A Pending CN118860064A (en) | 2024-06-28 | 2024-06-28 | Electric energy meter clock precision adjusting method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118860064A (en) |
-
2024
- 2024-06-28 CN CN202410858045.6A patent/CN118860064A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1130096C (en) | Synchronisation of a low power clock in a wireless communication device | |
CN109067394B (en) | On-chip clock calibration device and calibration method | |
EP1445681B1 (en) | Method and apparatus for clock synthesis using universal serial bus downstream received signals | |
CN102405678B (en) | Method and apparatus for calibrating low frequency clock | |
US20110280109A1 (en) | Synchronization of a generated clock | |
CN100538561C (en) | fractional divider system and method | |
CN101782791A (en) | Clock/reset and configuration controller hardcore in communication processor chip | |
CN105142210B (en) | A kind of real-time clock synchronous calibration method and sensor for wireless sense network | |
CN102412957B (en) | High-precision synchronous clock adjusting method | |
JP2002026723A (en) | Method and system for generating clock signal | |
CN104122936B (en) | A kind of MCU chip frequency-dividing clock means for correcting and method | |
JP6898903B2 (en) | Transceiver with real-time clock | |
CN110139236B (en) | Synchronous acquisition method based on wireless sensor network | |
CN106227293A (en) | A kind of system clock | |
CN103092258A (en) | Clock generation circuit self-correction system and clock generation circuit self-correction method | |
CN111669812A (en) | Low-power-consumption Bluetooth chip, equipment, dormancy awakening control method of equipment and communication system | |
CN118860064A (en) | Electric energy meter clock precision adjusting method and device, electronic equipment and storage medium | |
CN210518362U (en) | Single-wire communication circuit and communication system | |
WO2011023030A1 (en) | Integrated circuit and method for acquiring reference clock in integrated circuit | |
US11895588B2 (en) | Timing precision maintenance with reduced power during system sleep | |
CN113259037B (en) | Time synchronization method, medium, and apparatus based on sensor time synchronization system | |
CN206251105U (en) | For the VCXO soft-lock phase devices of base station | |
CN115549838A (en) | Time service equipment, system and method | |
CN210298097U (en) | Thing networking instrument clock timing device | |
CN214480603U (en) | Bluetooth clock circuit structure |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication |