CN116260432A - Filtering method for pulse width measurement and pulse width measurement method - Google Patents

Filtering method for pulse width measurement and pulse width measurement method Download PDF

Info

Publication number
CN116260432A
CN116260432A CN202111508435.3A CN202111508435A CN116260432A CN 116260432 A CN116260432 A CN 116260432A CN 202111508435 A CN202111508435 A CN 202111508435A CN 116260432 A CN116260432 A CN 116260432A
Authority
CN
China
Prior art keywords
width
real
value
time
measurement
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
Application number
CN202111508435.3A
Other languages
Chinese (zh)
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.)
Huada Semiconductor Co ltd
Original Assignee
Huada Semiconductor 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 Huada Semiconductor Co ltd filed Critical Huada Semiconductor Co ltd
Priority to CN202111508435.3A priority Critical patent/CN116260432A/en
Publication of CN116260432A publication Critical patent/CN116260432A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K5/00Manipulating of pulses not covered by one of the other main groups of this subclass
    • H03K5/01Shaping pulses
    • H03K5/04Shaping pulses by increasing duration; by decreasing duration
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R29/00Arrangements for measuring or indicating electric quantities not covered by groups G01R19/00 - G01R27/00
    • G01R29/02Measuring characteristics of individual pulses, e.g. deviation from pulse flatness, rise time or duration
    • G01R29/023Measuring pulse width
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K7/00Modulating pulses with a continuously-variable modulating signal
    • H03K7/08Duration or width modulation ; Duty cycle modulation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Physics & Mathematics (AREA)
  • Nonlinear Science (AREA)
  • General Physics & Mathematics (AREA)
  • Measurement Of Current Or Voltage (AREA)

Abstract

The invention discloses a filtering method for pulse width measurement, which comprises the steps of firstly determining whether pulse signal frequency in a first designated time period is stable, if so, correcting pulse width values according to real-time period width, real-time high level width and real-time low level width obtained by real-time measurement, determining whether the signal state of a current measurement pulse is full-high, full-low or normal according to the corrected pulse width values, then determining the number of three signal states in a second designated time period, and determining the state with the largest number as a real-time signal state; if the input pin is unstable, determining a real-time signal state according to the level used for capturing the input pin in a third appointed time period; and finally, determining an output pulse width value according to the real-time signal state.

Description

Filtering method for pulse width measurement and pulse width measurement method
Technical Field
The present invention relates to pulse width capturing technology, and in particular, to a filtering method for pulse width measurement and a pulse width measurement method.
Background
In motor control, PWM is often used for speed regulation, and for example, the motor control method can be applied to a scene requiring speed control, such as a refrigerator, an air conditioner, a fan, and the like. The principle of PWM speed regulation is to capture the width of the speed regulating pulse by pulse width capture (Pulse width capture, PWC) technology, and then convert the captured width of the speed regulating pulse (abbreviated as pulse width) into a rotational speed command to control the motor to operate according to the rotational speed command. Among these, pulse width capture techniques are one way to measure the pulse width and period of an external input. The width information of the input pulse signals is obtained through the capture of the singlechip. In the PWM speed regulation process, when the width of an input pulse signal is changed, the pulse width captured by the singlechip is changed, and different pulse widths are converted into corresponding speed information, so that the PWM speed regulation is realized. Therefore, the accuracy of PWC is particularly important for PWM speed regulation. However, due to the influence of the performance and noise of the single-chip microcomputer, when the speed regulation pulse has the characteristics of high frequency, high duty ratio or low duty ratio, the pulse width is difficult to accurately determine under the condition of not replacing the single-chip microcomputer with better performance, so that the speed control of the system is influenced.
Aiming at the problem, the filtering mode is adopted at present to process the measured pulse width data, so that the influence of noise is weakened. Currently, the most commonly used filtering method is the average filtering method. The average filtering mode is to carry out arithmetic average on pulse width measured in a period of time, has the characteristics of rapidness, high efficiency and small operand, and can weaken the influence of noise to a certain extent. However, when some measured data is severely affected by noise, the pulse width value obtained by arithmetic average is also affected to generate a larger error, so as to generate an error speed regulation signal. In addition, the arithmetic average mode is to filter data in a period of time, so that the timeliness problem exists.
Disclosure of Invention
In order to solve all or part of the problems in the prior art and eliminate the influence of noise on pulse width measurement, an aspect of the present invention provides a filtering method for pulse width measurement, including:
determining whether the frequency of the pulse signal is stable within a first specified period of time:
if the pulse signal is stable, correcting a pulse width value according to a real-time period width, a real-time high level width and a real-time low level width which are obtained by real-time measurement of the pulse signal, and determining a signal state of the pulse signal according to the corrected pulse width value, wherein the signal state comprises three types of full height, full low and normal, counting the number of the three signal states in a second specified time period, and determining the state with the largest number as a real-time signal state; and
if the input pin is unstable, determining a real-time signal state according to the level used for capturing the input pin in a third appointed time period; and
and determining an output pulse width value according to the real-time signal state.
Further, the filtering mode further includes setting two arrays with the same length:
a first array for storing real-time signal states; and
and the second group is used for storing the corrected pulse width value corresponding to the real-time signal state.
Further, determining whether the frequency of the pulse signal is stable within the first specified period of time includes:
calculating the difference value between the real-time period width obtained by the previous measurement and the real-time period width obtained by the current measurement during each measurement;
comparing the difference value with a preset error threshold value:
if the difference value is smaller than the preset error threshold value, adding one to the signal frequency stability count value; and
if the difference value is greater than or equal to the preset error threshold value, the signal frequency stable count value is decremented by one;
if the signal frequency stabilization count value is larger than the specified value in the first specified time period, the frequency of the pulse signal is stabilized, otherwise, the frequency of the pulse signal is unstable.
Further, the preset error threshold is determined according to the real-time period width obtained by the measurement and a preset frequency stability error coefficient.
Further, correcting the pulse width value includes:
if the low level width average value is smaller than the period width average value minus the measurement error value, and the high level width average value is larger than the period width average value plus the measurement error value, the corrected pulse width value is equal to the real-time period width minus the real-time low level width;
if the low level width average value is larger than the period width average value plus the measurement error value, and the high level width average value is smaller than the period width average value minus the measurement error value, the corrected pulse width value is equal to the real-time high level width;
if the low level width average value is greater than or equal to the period width average value minus the measurement error value and less than or equal to the period width average value plus the measurement error value, the corrected pulse width value is equal to the real-time period width minus the real-time low level width;
if the high level width average value is greater than or equal to the period width average value minus the measurement error value and less than or equal to the period width average value plus the measurement error value, the corrected pulse width value is equal to the real-time high level width; and
if none of the above conditions is satisfied, the capture pulse width level is continuously read a specified number of times:
if the pulse width values are all high levels, the corrected pulse width values are equal to the high level width average value;
and
If both are low, the corrected pulse width value is equal to 0.
Further, the measurement error value is determined according to the cycle width average value and a preset measurement error coefficient.
Further, determining the signal state of the current measurement pulse according to the corrected pulse width value includes:
if the corrected pulse width value is smaller than the minimum measurement width, the signal state is all low;
if the corrected pulse width value is larger than the maximum measurement width, the signal state is full-height; and
if the corrected pulse width value is greater than or equal to the minimum measurement width and less than or equal to the maximum measurement width, the signal state is normal.
Further, the minimum measurement width is determined according to a low-level width average value and a minimum measurement width coefficient; and
the maximum measurement width is determined according to the high level width average value and the maximum measurement width coefficient.
Further, determining the real-time signal state from the level for capturing the input pin for the third specified period of time includes:
if the level for capturing the input pins in the third designated time period is high, the real-time signal state is full high; otherwise
The real-time signal state is all low.
Further, determining an output pulse width value based on the real-time signal state comprises:
if the real-time signal state is all low, the output pulse width value is 0;
if the real-time signal state is full high, outputting a pulse width value which is a period width average value; and
if the real-time signal state is normal, the output pulse width value is the average value of the pulse width values after the pulse correction of which all the signal states are normal in the fifth specified time period.
Based on the filtering method, the invention further provides a pulse width measurement method, which comprises the following steps:
measuring the period width, the low level width and the high level width of the pulse in real time; and
filtering according to the filtering method to obtain an output pulse width value.
Further, the measuring the period width, the low level width, and the high level width of the pulse in real time includes:
setting a singlechip pulse width measurement mode as cycle width measurement, and measuring real-time cycle width;
setting a pulse width measurement mode of the singlechip as high-level width measurement, and measuring real-time high-level width; and
and setting the pulse width measurement mode of the singlechip as low-level width measurement, and measuring the real-time low-level width.
Furthermore, the invention also provides a singlechip which can execute the pulse width measurement method and the filtering method.
The invention provides a filtering method and a pulse width measuring method for pulse width measurement, which adopt a pure software mode, mainly adopt pulse signal width data obtained by chip measurement, finish correcting the real-time width data of the current pulse signal according to the signal state in appointed time, then judge the signal state, respectively record the state information of the pulse signal and the corresponding corrected pulse width value in continuous time by means of a queue, finally judge the real state of the signal according to the recorded state information, and simultaneously calculate the current pulse width by using the corrected pulse width data corresponding to the signal state in the queue, thereby achieving the filtering of the signal and finishing the measurement of the pulse width. By adopting the filtering method, the measuring precision can be improved on the premise of not replacing a singlechip with better performance, better anti-interference capability is realized, and the method is particularly suitable for pulse width measurement of pulse signals with high frequency, high duty cycle and low duty cycle. In addition, the pulse width measurement method is real-time output and has better timeliness. Meanwhile, the filtering method is simple in operation, so that memory consumption and time consumption in the process of the theme operation are small.
Drawings
To further clarify the above and other advantages and features of embodiments of the present invention, a more particular description of embodiments of the invention will be rendered by reference to the appended drawings. It is appreciated that these drawings depict only typical embodiments of the invention and are therefore not to be considered limiting of its scope. In the drawings, for clarity, the same or corresponding parts will be designated by the same or similar reference numerals.
FIG. 1 shows a flow diagram of a filtering method for pulse width measurement according to one embodiment of the present invention; and
fig. 2 shows a schematic flow chart of a pulse width measurement method according to an embodiment of the invention.
Detailed Description
In the following description, the present invention is described with reference to various embodiments. One skilled in the relevant art will recognize, however, that the embodiments can be practiced without one or more of the specific details, or with other alternative and/or additional methods. In other instances, well-known methods or operations are not shown or described in detail to avoid obscuring aspects of the invention.
Reference throughout this specification to "one embodiment" or "the embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. The appearances of the phrase "in one embodiment" in various places in the specification are not necessarily all referring to the same embodiment.
The numbers of the steps of the respective methods of the present invention are not limited to the order of execution of the steps of the methods. The method steps may be performed in a different order unless otherwise indicated.
Further, in the present invention, each "specified period" includes: the end points of the first, second, third, fourth, and fifth specified periods are the current time, and the start point may be, for example, the start time of the first measurement, or any specified time set according to the need.
The invention is based on the following insight of the inventor, and in the existing PWM speed regulation, the reason that the pulse width measurement accuracy is not high is as follows: 1. the performance of the singlechip is lower; 2. the noise impact is large. Thus, improving the accuracy of pulse width measurements can be done in two ways: 1. the singlechip chip with better performance is replaced; 2. noise effects are reduced. The replacement of the monolithic chip has a certain influence on surrounding circuits, and at the same time, the overall cost of the system is necessarily increased, so that the method cannot be widely applied. For noise, filtering is often used for eliminating. In the existing PWM speed regulation, an average filtering mode is mostly adopted, and the effect of the mode is obvious when the noise is smaller. Since the average value of the pulse width over a period of time is used as the final output value, if a large error is avoided, the calculation period should be preferably lengthened to reduce the influence of the pulse severely affected by noise on the average value, however, too long calculation period may result in low timeliness of the measured data. Based on the above, the inventor provides a real-time filtering mode, which can output the pulse width value after filtering in real time. And provides a pulse width measurement method and a singlechip capable of operating the pulse width measurement method on the basis. The embodiments of the present invention will be further described with reference to the drawings.
Fig. 1 shows a flow diagram of a filtering method for pulse width measurement according to an embodiment of the present invention. As shown in fig. 1, a filtering method for pulse width measurement includes:
first, in step 101, it is determined whether the pulse signal frequency is stable. Determining whether the frequency of the pulse signal within the first specified period of time is stable, if so, proceeding to step 1211, otherwise proceeding to step 1221; in one embodiment of the present invention, the judgment as to whether the frequency of the pulse signal is stable is determined by the signal frequency stability count value in the first designated time period, specifically, when each measurement is performed, the difference between the real-time period width obtained by the previous measurement and the real-time period width obtained by the current measurement is calculated, and then the difference is compared with the preset error threshold value:
if the difference value is smaller than the preset error threshold value, adding one to the signal frequency stability count value; and
if the difference value is greater than or equal to the preset error threshold value, the signal frequency stable count value is decremented by one;
if the signal frequency stabilization count value is larger than the specified value in the first specified time period, the frequency of the pulse signal is determined to be stable, otherwise, the frequency of the pulse signal is determined to be unstable. The preset error threshold is determined according to the real-time period width obtained by the measurement and a preset frequency stability error coefficient. Specifically, the real-time period width obtained by the current measurement is equal to the preset frequency stability error coefficient. The preset frequency stability error coefficient refers to a maximum allowable fluctuation range coefficient of a measurement result when each measurement is performed, and may be set according to actual requirements, for example, preferably set to 0.1. The specified value is mainly used for judging whether the signal width in a continuous period of time has large fluctuation or not, can be used for primarily identifying whether the signal is noise or an effective signal, has a noise suppressing effect, has higher suppression capability as the value is larger, and can be set according to actual requirements, for example, is preferably set to be 8. Further, the length of the first specified period of time may be set according to a pulse signal frequency;
in step 1211, the pulse width is corrected. When the frequency of the pulse signal is stable, the pulse width value can be corrected according to the real-time period width, the real-time high level width and the real-time low level width which are obtained through real-time measurement. In one embodiment of the present invention, pulse width correction includes:
if the low level width average value is smaller than the period width average value minus the measurement error value, and the high level width average value is larger than the period width average value plus the measurement error value, the corrected pulse width value is equal to the real-time period width minus the real-time low level width;
if the low level width average value is larger than the period width average value plus the measurement error value, and the high level width average value is smaller than the period width average value minus the measurement error value, the corrected pulse width value is equal to the real-time high level width;
if the low level width average value is greater than or equal to the period width average value minus the measurement error value and less than or equal to the period width average value plus the measurement error value, the corrected pulse width value is equal to the real-time period width minus the real-time low level width;
if the high level width average value is greater than or equal to the period width average value minus the measurement error value and less than or equal to the period width average value plus the measurement error value, the corrected pulse width value is equal to the real-time high level width; and
if none of the above conditions is satisfied, the capture pulse width level is continuously read a specified number of times:
if the pulse width values are all high levels, the corrected pulse width values are equal to the high level width average value; and
if both are low, the corrected pulse width value is equal to 0.
Wherein, the liquid crystal display device comprises a liquid crystal display device,
the low-level width average value is an average value of all the real-time low-level widths obtained by measurement in a fourth appointed time period;
the average value of the high level width is the average value of all the measured real-time high level widths in the fourth appointed time period;
the period width average value is the average value of all the measured real-time period widths in the fourth appointed time period; and
the measurement error value is determined according to a period width average value and a preset measurement error coefficient, specifically, it may be equal to a product of the period width average value and the preset measurement error coefficient, for example, where the duration of the fourth specified period may be equal to or not equal to the first specified period, for example, it may be set according to a signal frequency, or set as a period from a first measurement start time to a current time, and the preset measurement error coefficient may be set according to a measurement accuracy of a normal duty cycle of a pulse signal in practical application, for example, if the measurement accuracy is required to be greater than 1%, the measurement error coefficient is set to 0.01;
in one embodiment of the present invention, the corrected pulse width value is stored in a second array, where the length of the second array is N, where the value of N mainly affects the accuracy of the filtering result of the pulse signal at high frequency, the greater the value of N is set, the more accurate the measurement result of each duty cycle of the pulse signal at high frequency is, for example, when the pulse signal frequency is greater than 20KHz, the value of N is preferably greater than 20, when the pulse signal frequency is 10K-20K, the value of N is preferably greater than 10, and when the pulse signal frequency is 0-10K, the value of N is preferably greater than 5, it should be understood that the setting of the value of N may be set according to practical needs, and is not limited to the preferred value as described above; the method for storing data in an array of length N is as follows: sequentially storing data from the lower mark record value 0, performing self-adding operation on the plurality of sets of index record values once, until the lower mark record value is N-1, resetting the plurality of sets of index record values to 0 when the index record value reaches N after self-adding, and sequentially storing again from the position of the index of 0;
next, at step 1212, the signal state of the current measurement is determined. And determining the signal state of the current measurement pulse according to the corrected pulse width value, wherein the signal state comprises all three types of high, low and normal. In one embodiment of the invention, the determination of the signal state includes:
if the corrected pulse width value is smaller than the minimum measurement width, the signal state is all low, where the minimum measurement width is determined according to the low level width average value and the minimum measurement width coefficient, specifically, for example, may be equal to the product of the low level width average value and the minimum measurement width coefficient, where the minimum measurement width coefficient may be determined according to, for example, the lower limit of the normal duty cycle of the pulse signal, for example, when the pulse signal is required to meet the normal duty cycle of 3% -97% at all frequencies of 200Hz to 25KHz, the minimum measurement pulse width coefficient is preferably 0.03, and it should be understood that the setting of the minimum measurement width coefficient may be set according to the actual requirement, and is not limited to the preferred value as described above;
if the corrected pulse width value is greater than the maximum measurement width, the signal state is full high, where the maximum measurement width is determined according to a high level width average value and a maximum measurement width coefficient, specifically, for example, the maximum measurement width coefficient may be equal to a product of the high level width average value and the maximum measurement width coefficient, where the maximum measurement width coefficient may be determined according to, for example, an upper limit of a normal duty cycle of the pulse signal, for example, when the pulse signal is required to meet a normal duty cycle of 3% -97% at all frequencies of 200Hz to 25KHz, the maximum measurement pulse width coefficient is preferably 0.97, and it should be understood that the setting of the maximum measurement width coefficient may be set according to actual requirements, and is not limited to the preferred value as described above; and
if the corrected pulse width value is greater than or equal to the minimum measurement width and less than or equal to the maximum measurement width, the signal state is normal.
In one embodiment of the present invention, the corrected pulse width value is stored in a first array, the length of the first array is equal to that of the second array, the stored signal states of the first array and the corrected pulse width value stored in the second array are in one-to-one correspondence, and the data storage method is the same as that of the second array;
next, at step 1213, a real-time signal status is determined. Counting the number of three signal states in a second designated time period, and taking the one with the largest number as a real-time signal state, wherein the duration of the second designated time period can be equal to or not equal to the first designated time period, for example, the second designated time period can be set according to the signal frequency, or the second designated time period can be set as a time period from the starting time of the first measurement to the current time, or all the values stored in the first array can be directly counted to determine the real-time signal state;
in step 1221, a real-time signal state is determined. When the pulse signal frequency is unstable, determining a real-time signal state according to the level condition of the input pin in the third designated time period: if the level for capturing the input pins in the third appointed time period is high, judging that the real-time signal state is full high; otherwise, judging the real-time signal state to be all low, wherein the duration of the third designated time period may be equal to or not equal to the first designated time period, for example, the third designated time period may be set according to the signal frequency, or set as a time period from the starting time to the current time of the first measurement; and
finally, at step 103, an output pulse width value is determined. Determining the output pulse width value from the real-time signal state as determined in step 1213 or 1221, specifically, includes:
if the real-time signal state is all low, the output pulse width value is 0;
if the real-time signal state is full high, outputting a pulse width value which is a period width average value; and
if the real-time signal state is normal, the output pulse width value is an average value of pulse width values after pulse correction of which all signal states are normal in a fifth specified time period, where the duration of the fifth specified time period may be equal to or not equal to the first specified time period, for example, it may be set according to the signal frequency, or set as a time period from the first measurement start time to the current time, or may directly use an average value of all values greater than or equal to the minimum measurement width and less than or equal to the maximum measurement width in the second array as the output pulse width value.
Based on the foregoing filtering method, fig. 2 is a schematic flow chart of a pulse width measurement method according to an embodiment of the present invention. As shown in fig. 2, a pulse width measurement method includes:
first, in step 201, real-time measurements are made. The period width, low level width and high level width of the pulse are measured in real time. Since most singlechips do not support simultaneous measurement of three widths, in one embodiment of the present invention, the three widths need to be measured sequentially, specifically including:
firstly, setting a pulse width measurement mode of a singlechip as a period width measurement mode, and measuring a real-time period width, wherein the period width measurement mode can be, for example, measurement triggered by a rising edge and measurement terminated by the rising edge, or measurement triggered by a falling edge and measurement terminated by the falling edge;
setting a pulse width measurement mode of the singlechip to be a high-level width measurement mode, and measuring a real-time high-level width, wherein the high-level width measurement mode can be, for example, measurement triggered by a rising edge and measurement terminated by a falling edge; and
finally, setting the pulse width measurement mode of the singlechip as a low-level width measurement mode, and measuring the real-time low-level width, wherein the low-level width measurement mode can be, for example, measurement triggered by a falling edge and measurement terminated by a rising edge; and
finally, in step 202, filtering is performed. According to the filtering method, filtering is performed to obtain an output pulse width value, and in the embodiment of the invention, real-time measurement is performed synchronously while filtering to ensure that the pulse width value can be continuously output.
The invention provides a filtering method and a pulse width measuring method for pulse width measurement, which are characterized in that pulse signal width data obtained through chip measurement are used for finishing correction of real-time width data of a current pulse signal according to signal states in appointed time, then the signal states are judged, state information of the pulse signal and corresponding corrected pulse width values in continuous time are respectively recorded by means of a queue, finally the actual state of the signal is judged according to the recorded state information, and meanwhile the corrected pulse width data corresponding to the signal states in the queue are used for calculating the current pulse width, so that the filtering of the signal is achieved, and the measurement of pulse width is finished. The method is realized by completely adopting software without depending on hardware performance, can improve measurement accuracy and realize better anti-interference capability on the premise of not replacing a singlechip, and is particularly suitable for pulse width measurement of pulse signals with high frequency, high duty cycle and low duty cycle. In addition, the pulse width measurement method is real-time output and has better timeliness. Meanwhile, the filtering method is simple in operation, so that the memory consumption and the time consumption in the whole operation process are both of the order of O (n).
While various embodiments of the present invention have been described above, it should be understood that they have been presented by way of example only, and not limitation. It will be apparent to those skilled in the relevant art that various combinations, modifications, and variations can be made therein without departing from the spirit and scope of the invention. Thus, the breadth and scope of the present invention as disclosed herein should not be limited by any of the above-described exemplary embodiments, but should be defined only in accordance with the following claims and their equivalents.

Claims (13)

1. A filtering method for pulse width measurement, comprising the steps of:
determining whether the frequency of the pulse signal is stable within a first specified period of time, wherein:
if stable, the following steps are executed:
correcting a pulse width value according to the real-time period width, the real-time high level width and the real-time low level width obtained by the real-time measurement of the pulse signal;
determining the signal state of the pulse signal according to the corrected pulse width value,
wherein the signal state comprises full high, full low, and normal; and
determining the number of all high, all low and normal signal states within a second specified period of time, and determining the most numerous states as real-time signal states; and
if not, the following steps are executed:
determining a real-time signal state according to the level for capturing the input pin in the third designated time period; and
and determining an output pulse width value according to the real-time signal state.
2. The filtering method of claim 1, further comprising setting two arrays of equal length, comprising:
a first array configured to store real-time signal states; and
a second array configured to store corrected pulse width values corresponding to the real-time signal states.
3. The filtering method of claim 1, wherein determining whether the frequency of the pulse signal is stable for the first specified period of time comprises:
calculating the difference value between the real-time period width obtained by the previous measurement and the real-time period width obtained by the current measurement during each measurement;
comparing the difference value with a preset error threshold value:
if the difference value is smaller than the preset error threshold value, adding one to the signal frequency stability count value; and
if the difference value is greater than or equal to the preset error threshold value, the signal frequency stable count value is decremented by one; and
if the signal frequency stabilization count value is larger than the specified value in the first specified time period, the frequency of the pulse signal is stabilized, otherwise, the frequency of the pulse signal is unstable.
4. A filtering method according to claim 3, wherein the predetermined error threshold is equal to the product of the real-time period width obtained by the current measurement and a predetermined frequency stability error coefficient.
5. The filtering method of claim 1, wherein correcting the pulse width value comprises:
if the low level width average value is smaller than the period width average value minus the measurement error value, and the high level width average value is larger than the period width average value plus the measurement error value, the corrected pulse width value is equal to the real-time period width minus the real-time low level width;
if the low level width average value is larger than the period width average value plus the measurement error value, and the high level width average value is smaller than the period width average value minus the measurement error value, the corrected pulse width value is equal to the real-time high level width;
if the low level width average value is greater than or equal to the period width average value minus the measurement error value and less than or equal to the period width average value plus the measurement error value, the corrected pulse width value is equal to the real-time period width minus the real-time low level width;
if the high level width average value is greater than or equal to the period width average value minus the measurement error value and less than or equal to the period width average value plus the measurement error value, the corrected pulse width value is equal to the real-time high level width; otherwise
Continuously reading the capture pulse width level a specified number of times:
if the pulse width values are all high levels, the corrected pulse width values are equal to the high level width average value; and
if the pulse width values are all low levels, the corrected pulse width values are equal to 0;
wherein, the liquid crystal display device comprises a liquid crystal display device,
the low-level width average value is an average value of all the real-time low-level widths obtained by measurement in a fourth appointed time period;
the average value of the high level width is the average value of all the measured real-time high level widths in the fourth appointed time period; and
and the period width average value is the average value of all the measured real-time period widths in the fourth appointed time period.
6. The filtering method of claim 5, wherein the measurement error value is equal to a product of a cycle width average and a predetermined measurement error coefficient.
7. The filtering method of claim 1, wherein determining the signal state of the current measurement pulse based on the corrected pulse width value comprises:
if the corrected pulse width value is smaller than the minimum measurement width, the signal state is all low;
if the corrected pulse width value is larger than the maximum measurement width, the signal state is full-height; and
if the corrected pulse width value is greater than or equal to the minimum measurement width and less than or equal to the maximum measurement width, the signal state is normal.
8. The filtering method of claim 7, wherein the minimum measured width is equal to a product of a low-level width average value and a minimum measured width coefficient, wherein the low-level width average value is an average value of all measured real-time low-level widths in a fourth specified period of time; and
the maximum measurement width is equal to the product of a high level width average value and a maximum measurement width coefficient, wherein the high level width average value is the average value of all the measured real-time high level widths in a fourth appointed time period.
9. The filtering method of claim 1, wherein determining the real-time signal state based on the level for capturing the input pin for the third specified period of time comprises:
if the level for capturing the input pins in the third designated time period is high, the real-time signal state is full high; otherwise
The real-time signal state is all low.
10. The filtering method of claim 1, wherein determining an output pulse width value based on the real-time signal condition comprises:
if the real-time signal state is all low, the output pulse width value is 0;
if the real-time signal state is full high, outputting a pulse width value which is a period width average value; and
if the real-time signal state is normal, the output pulse width value is the average value of the pulse width values after the pulse correction of which all the signal states are normal in the fifth specified time period.
11. A method of pulse width measurement comprising the steps of:
measuring the period width, the low level width and the high level width of the pulse in real time; and
filtering according to any of the filtering methods of claims 1-10, resulting in an output pulse width value.
12. The method of claim 11, wherein measuring the period width, the low level width, and the high level width of the pulse in real time comprises:
setting a singlechip pulse width measurement mode as a period width measurement mode, and measuring the real-time period width;
setting a pulse width measurement mode of the singlechip as a high-level width measurement mode, and measuring the real-time high-level width; and
and setting the pulse width measurement mode of the singlechip as a low-level width measurement mode, and measuring the real-time low-level width.
13. A single chip microcomputer, characterized in that it is configured to be able to perform the method of pulse width measurement according to any of the claims 11 to 12.
CN202111508435.3A 2021-12-10 2021-12-10 Filtering method for pulse width measurement and pulse width measurement method Pending CN116260432A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111508435.3A CN116260432A (en) 2021-12-10 2021-12-10 Filtering method for pulse width measurement and pulse width measurement method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111508435.3A CN116260432A (en) 2021-12-10 2021-12-10 Filtering method for pulse width measurement and pulse width measurement method

Publications (1)

Publication Number Publication Date
CN116260432A true CN116260432A (en) 2023-06-13

Family

ID=86681338

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111508435.3A Pending CN116260432A (en) 2021-12-10 2021-12-10 Filtering method for pulse width measurement and pulse width measurement method

Country Status (1)

Country Link
CN (1) CN116260432A (en)

Similar Documents

Publication Publication Date Title
US8078901B1 (en) Method for increasing a processor operating frequency when other subsystem demands are low
US20090327656A1 (en) Efficiency-based determination of operational characteristics
US6886120B2 (en) Memory control circuit
KR102569897B1 (en) Method and apparatus for diagnosing vehicle battery
US20190294336A1 (en) Optimization of memory refresh rates using estimation of die temperature
US10431323B2 (en) Calibrating I/O impedances using estimation of memory die temperature
US5158062A (en) Adaptive air/fuel ratio control method
US20070255967A1 (en) Method of controlling operating clock frequency of hard disk drive, recording medium, and hard disk drive
CN116260432A (en) Filtering method for pulse width measurement and pulse width measurement method
CN107992149B (en) Trimming method and trimming device of voltage band gap circuit
CN115684711A (en) Electric energy metering method and device, computer equipment and storage medium
CN106873752B (en) Chip dormancy control method and device
US7667913B2 (en) Control unit, storage unit, and method for manufacturing storage unit
CN102414567A (en) Correction device, probability density function measuring device, jitter measuring device, jitter separating device, electronic device, correction method, program, and recording medium
JP2006208321A (en) Information terminal and battery remaining capacity calculating method
CN116430255B (en) Battery electric quantity self-adaptive display method, device, storage medium and system
CN116047827B (en) Calibration method and device of electrochromic device and electrochromic device
CN117632273B (en) Configuration method and system of integrated circuit, storage module of integrated circuit and medium
JPH09113527A (en) Cycle measuring device
JP3857290B2 (en) Integrated circuit power consumption estimation device
JP2882413B2 (en) High-speed average pass / fail judgment device
JPS583534A (en) Automatic monitoring interval setting system
CN114353894A (en) Frequency stability method for improving pulse equivalent output
KR101273750B1 (en) Measuring rotation speed of fan usinging counter
JP3402956B2 (en) VTR motor controller

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination