Phase difference measurement method and device, equipment, storage medium and program product

By converting the signal to be measured into a square wave and distributing it to different channels, and calculating the rising edge time interval of the signal circuit, the hardware limitations and real-time problems of signal phase difference measurement in the existing technology are solved, and high precision and reliability are achieved. Phase difference measurement.

CN118624983APending Publication Date: 2024-09-10CHINA FAW CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410850729.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

In scenarios where high precision is required, the existing technology has hardware limitations and real-time problems in signal phase difference measurement, and cannot output accurate and reliable results in real time.

Method used

By converting the signal to be measured into a square wave, and assigning it to different channels of the measurement circuit according to the phase of the square wave, the time interval between the rising edges of the channels is determined, thereby calculating the phase difference and reducing reliance on filters and phase detectors.

Benefits of technology

It achieves high-precision, real-time and reliable phase difference measurement, is suitable for a variety of scenarios, and reduces hardware limitations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118624983A
    Figure CN118624983A
Patent Text Reader

Abstract

The invention relates to a phase difference measurement method and device, equipment, a storage medium and a program product, and relates to the technical field of signal processing. The method comprises the following steps: converting a first to-be-detected signal into a first square wave, and converting a second to-be-detected signal into a second square wave; distributing the first square wave and the second square wave to different channels of the measuring circuit according to the phase of the first square wave and the phase of the second square wave; and determining a time interval between rising edges of different channels of the measuring circuit, and determining a phase difference between the first signal to be measured and the second signal to be measured according to the time interval. According to the method, the channels are redistributed and defined in the measurement circuit for different signals to be measured, so that the time interval between the rising edges of different channels is measured, the phase difference between different signals to be measured is determined in real time, a filter and a phase discriminator do not need to be combined, the limitation of hardware is reduced, and the measurement accuracy is improved. And the precision, the real-time performance and the reliability of the finally determined phase difference can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of signal processing technology, and in particular to a phase difference measurement method, device, equipment, storage medium and program product. Background Art

[0002] The amplitude and phase of the waveform can jointly describe the instantaneous state of the oscillation harmonic at a certain moment. The measurement of phase difference is often used in applications in multiple industries such as computing, communications, circuits, and aerospace. Generally, the phase difference is directly read out with an oscilloscope, but this method is affected by the instrument itself, and the reading results and fluctuations are large. It is not suitable for scenarios with high-precision requirements for phase difference. Therefore, it is necessary to digitize the oscillation waveform to obtain a more accurate and reliable phase difference result.

[0003] However, the current common digital processing method requires combining filters and phase detectors into different circuits to filter out some noise and then transmit it to the ADC (Analog-to-Digital Converter) circuit, and then process the input signal through interpolation or zero-crossing detection to calculate the phase difference of the signal. Not only is there a hardware limitation, but a large amount of calculations will also make it impossible to output the results in real time. Summary of the invention

[0004] Based on this, it is necessary to provide a phase difference measurement method, device, equipment, storage medium and program product that can be applied to more scenarios and can efficiently and in real time measure signal phase differences in response to the above technical problems.

[0005] In a first aspect, the present application provides a phase difference measurement method, comprising:

[0006] Converting the first signal to be tested into a first square wave, and converting the second signal to be tested into a second square wave;

[0007] Distributing the first square wave and the second square wave to different channels of a measurement circuit according to a phase of the first square wave and a phase of the second square wave;

[0008] The time interval between rising edges of different channels of the measuring circuit is determined, and the phase difference between the first signal to be measured and the second signal to be measured is determined according to the time interval.

[0009] In one embodiment, converting the first signal to be tested into a first square wave, and converting the second signal to be tested into a second square wave, comprises:

[0010] Performing filtering processing on the first signal to be tested and the second signal to be tested respectively;

[0011] Generate a first sine wave corresponding to the first signal to be tested after filtering, and generate a second sine wave corresponding to the second signal to be tested after filtering; wherein the difference between the amplitude of the first sine wave and the amplitude of the second sine wave meets a preset condition;

[0012] The first sine wave is converted into a first square wave, and the second sine wave is converted into a second square wave.

[0013] In one embodiment, according to the phase of the first square wave and the phase of the second square wave, allocating the first square wave and the second square wave to different channels of the measurement circuit includes:

[0014] According to the phase of the first square wave and the phase of the second square wave, selecting a target square wave with a leading phase from the first square wave and the second square wave;

[0015] The selected target square wave is distributed to a first channel of the measurement circuit, and the unselected other square wave is distributed to a second channel of the measurement circuit.

[0016] In one embodiment, selecting a target square wave with a leading phase from the first square wave and the second square wave according to the phase of the first square wave and the phase of the second square wave comprises:

[0017] Comparing the level of the first square wave and the level of the second square wave at the time corresponding to the rising edge of the first square wave;

[0018] If the level of the first square wave is higher than the level of the second square wave, the first square wave is determined as the target square wave with phase advance;

[0019] If the level of the first square wave is lower than the level of the second square wave, the second square wave is determined as the target square wave with phase advancement.

[0020] In one embodiment, determining the time interval between rising edges of different channels of the measurement circuit includes:

[0021] When it is determined by the first counter in the measuring circuit that the number of rising edges of the first channel reaches the target value, the number of pulses is obtained by the second counter in the measuring circuit;

[0022] According to the number of pulses, the time interval between the rising edge of the first channel and the rising edge of the second channel is determined.

[0023] In one embodiment, the measuring circuit includes a high-frequency counting circuit, the high-frequency counting circuit includes a first counter and a second counter, the first counter is an 8-bit counter, and the second counter is a 24-bit counter.

[0024] In a second aspect, the present application provides a phase difference measurement device, comprising:

[0025] A signal conversion module, used for converting the first signal to be tested into a first square wave, and converting the second signal to be tested into a second square wave;

[0026] A channel allocation module, used for allocating the first square wave and the second square wave to different channels of the measurement circuit according to the phase of the first square wave and the phase of the second square wave;

[0027] The phase difference measurement module is used to determine the time interval between the rising edges of different channels of the measurement circuit, and determine the phase difference between the first signal to be measured and the second signal to be measured according to the time interval.

[0028] In a third aspect, the present application provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the first aspect when executing the computer program.

[0029] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method of the first aspect when the computer program is executed by a processor.

[0030] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the method of the first aspect when executed by a processor.

[0031] The above-mentioned phase difference measurement method, device, equipment, storage medium and program product convert the first signal to be measured into a first square wave, and convert the second signal to be measured into a second square wave; according to the phase of the first square wave and the phase of the second square wave, the first square wave and the second square wave are distributed to different channels of the measurement circuit; the time interval between the rising edges of different channels of the measurement circuit is determined, and the phase difference between the first signal to be measured and the second signal to be measured is determined according to the time interval. The present application reallocates and defines channels in the measurement circuit for different signals to be measured, so as to measure the time interval between the rising edges of different channels, so as to determine the phase difference between different signals to be measured in real time. Compared with the prior art, the present application does not need to combine filters and phase detectors, thereby reducing hardware limitations, and determines the phase difference based on the time interval between the rising edges of different channels, which can improve the accuracy, real-time performance and reliability of the phase difference finally determined. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is an application scenario diagram of a phase difference measurement method in an embodiment;

[0033] Figure 2 is a flow chart of a phase difference measurement method in one embodiment;

[0034] Figure 3 A schematic diagram of a process for generating a square wave in one embodiment;

[0035] Figure 4 It is a schematic diagram of a process of allocating square waves to corresponding channels in one embodiment;

[0036] Figure 5 A schematic diagram of a flow chart of determining the time interval between rising edges of a channel in one embodiment;

[0037] Figure 6 is a circuit diagram of a measuring circuit in one embodiment;

[0038] Figure 7 is a flow chart of a phase difference measurement method in another embodiment;

[0039] Figure 8 is a structural block diagram of a phase difference measurement device in one embodiment;

[0040] Fig. 9 The figure is a structural block diagram of a computer device for implementing a phase difference measurement method in an embodiment. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0042] The phase difference measurement method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown in the figure, the first signal to be measured (such as the input excitation signal) and the second signal to be measured (such as the output resonance signal) are respectively input into the measuring device, and the first signal to be measured and the second signal to be measured are processed by different amplifiers and square wave generators in the measuring device to obtain corresponding square waves W1 and W2, and then the square waves W1 and W2 are both input into the processing and timing logic module in the measuring device to allocate channels, so that the 8-bit high-speed counter in the measuring device can count the number of measurements, and the 24-bit high-speed counter can count the phase difference timing, and further, the processing and timing logic module outputs the phase difference between the first signal to be measured and the second signal to be measured based on the statistical results.

[0043] The measuring device further includes a high-frequency clock generator PLL (Phase-Locked Loop) and a clock distributor for controlling a 24-bit high-speed counter.

[0044] Among them, RST is the reset pin, START is the start conversion input pin, INT is the interrupt pin, SPI (serial peripheral interface), and PS are outputs.

[0045] In one embodiment, Figure 2 As shown, a phase difference measurement method is provided, comprising the following steps:

[0046] S201, converting a first signal to be tested into a first square wave, and converting a second signal to be tested into a second square wave.

[0047] The first signal to be tested and the second signal to be tested are two different signals with a certain phase difference and different waveforms.

[0048] Exemplarily, the first signal to be measured may be an input excitation signal, the second signal to be measured may be an output resonance signal, and both the first signal to be measured and the second signal to be measured are sinusoidal waves.

[0049] The first signal to be tested and the second signal to be tested are respectively converted into square waves. The first square wave corresponding to the first signal to be tested can be expressed as W1, and the second square wave corresponding to the second signal to be tested can be expressed as W2.

[0050] Optionally, the first signal to be tested and the second signal to be tested are input into a measuring circuit, and are respectively processed by a square wave generator in the measuring circuit to obtain a first square wave and a second square wave. The square wave generators for processing the first signal to be tested and the second signal to be tested may be different.

[0051] Optionally, a gate circuit including an inverter 74HC14 and an RC circuit (Resistor-Capacitance circuit) are used to shape the first signal to be measured and the second signal to be measured respectively to obtain corresponding first square waves and second square waves.

[0052] Optionally, an operational amplifier including a comparator LM311 and an RC circuit are used to shape the first signal to be measured and the second signal to be measured, respectively, to obtain corresponding first square waves and second square waves.

[0053] S202 , allocating the first square wave and the second square wave to different channels of a measurement circuit according to a phase of the first square wave and a phase of the second square wave.

[0054] The measurement circuit includes a plurality of tri-state gates (tri-state buffers), and different tri-state gates form different circuits to execute logic for comparing the phase of the first square wave with the phase of the second square wave, and then allocating the first square wave and the second square wave to different channels according to the comparison result.

[0055] Exemplarily, the measurement circuit includes at least two three-state gate circuits, each of which is composed of at least two three-state gates connected in parallel, and each three-state gate circuit is used to compare the phase of the first square wave with the phase of the second square wave, and the outputs of different three-state gate circuits are different, so that the output of one of the three-state gate circuits is the first square wave, which is input to one of the channels of the measurement circuit, and the output of the other three-state gate circuit is the second square wave, which is input to another channel of the measurement circuit.

[0056] S203, determining the time interval between rising edges of different channels of the measurement circuit, and determining the phase difference between the first signal to be measured and the second signal to be measured according to the time interval.

[0057] The rising edge refers to the moment when the voltage changes from a low level to a high level. Different channels of the measurement circuit execute different processing logics. By measuring the time interval between the rising edges of the output signals of different channels, the corresponding phase difference, that is, the phase difference between the first signal to be measured and the second signal to be measured, can be obtained.

[0058] Exemplarily, the rising edge times of different channels of the measurement circuit are recorded respectively, and then the time intervals between them are determined according to the rising edge times of different channels, and then converted into phase differences, which are output by a DSP (Digital Signal Processor) in the measurement circuit.

[0059] The embodiment of the present application converts the first signal to be tested into a first square wave, and converts the second signal to be tested into a second square wave; distributes the first square wave and the second square wave to different channels of the measurement circuit according to the phase of the first square wave and the phase of the second square wave; determines the time interval between the rising edges of different channels of the measurement circuit, and determines the phase difference between the first signal to be tested and the second signal to be tested according to the time interval. For different signals to be tested, the channels are redistributed and defined in the measurement circuit, so as to measure the time interval between the rising edges of different channels, so as to determine the phase difference between different signals to be tested in real time, without combining filters and phase detectors, thereby reducing hardware limitations, and determining the phase difference based on the time interval between the rising edges of different channels can improve the accuracy, real-time performance and reliability of the phase difference finally determined.

[0060] In order to improve the accuracy of digital signal processing, based on the above embodiments, in one embodiment, the signal to be tested may be pre-processed and converted into a square wave, such as Figure 3 As shown, the above S201 includes:

[0061] S301, filter the first signal to be tested and the second signal to be tested respectively.

[0062] The filtering process can separate useful signals from noise, thereby improving the anti-interference capability and signal-to-noise ratio of the signal. This embodiment does not impose any specific limitation on the filtering process.

[0063] Optionally, before the first signal to be measured and the second signal to be measured are input into the measuring circuit, filtering processing is performed on the first signal to be measured and the second signal to be measured respectively.

[0064] Optionally, the first signal to be measured and the second signal to be measured are directly input into a measuring circuit, and the first signal to be measured and the second signal to be measured are filtered by a filter in the measuring circuit.

[0065] S302, generating a first sine wave corresponding to the first signal to be tested after filtering, and generating a second sine wave corresponding to the second signal to be tested after filtering.

[0066] Exemplarily, the first signal to be measured and the second signal to be measured are converted into the first sine wave and the second sine wave whose amplitude difference satisfies the preset condition through the amplifier in the measurement circuit. The first signal to be measured is input into one amplifier to obtain the output first sine wave, and the second signal to be measured is input into another amplifier to obtain the output second sine wave.

[0067] The difference between the amplitude of the first sine wave and the amplitude of the second sine wave satisfies a preset condition. The preset condition may be that the difference in amplitude is lower than a target threshold, and the target threshold may be set based on actual conditions.

[0068] In other words, the first signal to be measured and the second signal to be measured after filtering are converted into two sine waves with substantially the same amplitude through the amplifier.

[0069] S303, converting the first sine wave into a first square wave, and converting the second sine wave into a second square wave.

[0070] Exemplarily, the first sine wave and the second sine wave are converted into the first square wave and the second square wave by the hysteresis comparator in the measurement circuit. The first sine wave is input to a hysteresis comparator as a square wave generator to obtain the output first square wave, and the second sine wave is input to another hysteresis comparator as a square wave generator to obtain the output second square wave.

[0071] The first square wave can be expressed as W1, and the second square wave can be expressed as W2.

[0072] The embodiment of the present application preprocesses the first test signal and the second test signal, and converts them into a first square wave and a second square wave whose phase difference is easy to compare, which can improve the accuracy of subsequent phase difference measurement results and can be applicable to phase difference measurement in non-square waves (such as waveforms with a duty cycle not of 50%) and irregular shapes (such as distorted waveforms).

[0073] In order to accurately determine the phase difference, based on the above embodiment, in one embodiment, a first channel and a second channel are introduced, and the first square wave and the second square wave are assigned to appropriate channels based on the phase difference, such as Figure 4 As shown, the above S202 includes:

[0074] S401 , selecting a target square wave with a leading phase from the first square wave and the second square wave according to the phase of the first square wave and the phase of the second square wave.

[0075] The phase sequence of the first square wave and the second square wave is identified. When the phase of the first square wave is ahead, the first square wave is used as the target square wave. When the phase of the second square wave is ahead, the second square wave is used as the target square wave.

[0076] Optionally, compare the level of the first square wave and the level of the second square wave at the corresponding moment of the rising edge of the first square wave; if the level of the first square wave is higher than the level of the second square wave, determine the first square wave as the target square wave with phase lead; if the level of the first square wave is lower than the level of the second square wave, determine the second square wave as the target square wave with phase lead.

[0077] Exemplarily, taking the rising edge of the first square wave W1 as a reference, if the level of the first square wave W1 is higher than the level of the second square wave W2 at this time, it means that the phase of the first square wave W1 is ahead, and the first square wave W1 is the target square wave; conversely, if the level of the second square wave W2 is higher than the level of the first square wave W1 at this time, it means that the phase of the second square wave W2 is ahead, and the second square wave W2 is the target square wave.

[0078] Correspondingly, the processing and timing logic module of the measurement circuit outputs a result represented by PS, where PS=1 indicates that the first signal to be measured (corresponding to the first square wave W1) has a phase lead, and PS=0 indicates that the second signal to be measured (corresponding to the second square wave W2) has a phase lead.

[0079] S402 , allocating the selected target square wave to a first channel of a measurement circuit, and allocating another unselected square wave to a second channel of the measurement circuit.

[0080] The channels are reallocated and defined through a plurality of tri-state gates (tri-state buffers), the target square wave with a phase advance is allocated to the first channel SW1, and the other square wave with a phase delay is allocated to the second channel SW2.

[0081] The first channel SW1 and the second channel SW2 are connected to the high-frequency counting circuit in the measurement circuit through different lines. The high-frequency counting circuit is implemented based on a high-frequency counting chip, and the counting frequency can reach 1.6GHz. The high-frequency counting circuit can be used to count the rising edge of the first channel SW1 and count the high-frequency pulses, so as to achieve the purpose of timing.

[0082] The embodiment of the present application allocates the square wave to different channels based on its phase, so as to count the rising edges of the phase-advanced signal, which is beneficial to the subsequent accurate determination of the phase difference between the first signal to be measured and the second signal to be measured. The time difference design between the rising edges can expand the application scope of the phase difference measurement and has better adaptability to working conditions.

[0083] In order to achieve high-precision phase difference measurement, based on the above embodiment, in one embodiment, a first timer and a second timer can be introduced to perform automatic multiple measurements, such as Figure 5 As shown, the above S203 includes:

[0084] S501 , when it is determined through a first counter in a measuring circuit that the number of rising edges of a first channel reaches a target value, the number of pulses is acquired through a second counter in the measuring circuit.

[0085] The measuring circuit includes a high frequency generating circuit and a high frequency counting circuit, wherein the high frequency generating circuit is used to insert high frequency pulses during the measuring period, and the high frequency counting circuit is used to count the number of high frequency pulses to achieve the purpose of timing.

[0086] Optionally, the high frequency generation circuit is implemented based on a PLL chip integrating a VCO (Voltage Controlled Oscillator), and can output a 1.5 GHz pulse signal.

[0087] Optionally, the measurement circuit also includes a digital clock circuit, which is used to convert the analog signal output by the high-frequency generation circuit into a PECL level (Positive Emitter Coupled Logic) clock through a clock distribution chip. An external crystal oscillator is used as a reference frequency source, and a DSP is used to write commands to the PLL chip through an SPI interface (Serial Peripheral Interface) to control the output frequency of the high-frequency pulse, and then a clock distribution chip is used to convert the analog signal into a PECL level clock, that is, a CLOCK signal.

[0088] Optionally, the high-frequency counting circuit includes a first counter and a second counter, and the first counter is an 8-bit counter, the second counter is a 24-bit counter, and the second counter can be obtained by cascading three 8-bit counters.

[0089] Inputting the CLOCK signal into the second counter can achieve a maximum count of 16M and a maximum timing of 13ms. The numerical value can be read in the DSP through the port mode or address decoding, such as reading the number of rising edges of the first channel and the number of pulses.

[0090] Specifically, the number of rising edges of the first channel is counted by the first counter, that is, the number of measurements is counted. When the number of measurements reaches the target value, such as 255 times, an external interrupt signal is output to enter the interrupt service program, and then the number of pulses at this time is read by the second counter.

[0091] S502, determining a time interval between a rising edge of the first channel and a rising edge of the second channel according to the number of pulses.

[0092] Specifically, the time deviation, i.e., the time interval between the rising edge of the first channel and the rising edge of the second channel, can be obtained by taking an average value of the number of pulses. For example, when the number of measurements reaches a target value such as 255 times, the number of pulses is divided by 254 to obtain the time interval between the rising edge of the first channel and the rising edge of the second channel.

[0093] Exemplarily, in the case of determining the number of pulses in the phase difference, the phase difference between the two waveforms is determined according to the frequency of the pulses, thereby achieving measurement of the phase difference between the first signal to be measured and the second signal to be measured.

[0094] The embodiment of the present application provides a first timer for counting the number of measurements, thereby realizing automated multiple measurements, reducing the performance requirements on hardware and the complexity on software, and by taking the average of the results of multiple measurements, the accuracy of the measurement results can be significantly improved.

[0095] In one embodiment, a measurement circuit is provided, such as Figure 6As shown, the measurement circuit includes DSP, multiple tri-state gates, D flip-flops, level conversion modules (i.e., TTL (Transistor-Transistor-Logic) to ECL (Emitter Coupled Logic) / ECL to TTL), an 8-bit high-speed counter, and a 24-bit high-speed counter cascaded from three 8-bit high-speed counters. Among them, the pin definitions of the counter include: input terminal MR, used for counter reset; input terminal / CE, used to control whether counting is allowed; input terminal CLK, used to count the rising edge of the pulse signal; output terminals Q0-Q7, used for counter output; output terminal / TC, used to indicate the counter full (Q0-Q7 is 0xFF) flag.

[0096] The first square wave W1 and the second square wave W2 are identified before and after phase, and input into the first channel SW1 or the second channel SW2 respectively. After level conversion, the DSP reads the numerical value, such as the number of measurements measured by the 8-bit high-speed counter and the number of pulses measured by the 24-bit high-speed counter, and finally outputs the phase difference between the two waveforms.

[0097] In one embodiment, an optional example of a phase difference measurement method is provided, such as Figure 7 As shown, the following steps are included:

[0098] S701, filter the first signal to be tested and the second signal to be tested respectively.

[0099] S702, generating a first sine wave corresponding to the first signal to be tested after filtering, and generating a second sine wave corresponding to the second signal to be tested after filtering.

[0100] The difference between the amplitude of the first sine wave and the amplitude of the second sine wave meets a preset condition.

[0101] S703, converting the first sine wave into a first square wave, and converting the second sine wave into a second square wave.

[0102] S704, selecting a target square wave with a leading phase from the first square wave and the second square wave according to the phase of the first square wave and the phase of the second square wave.

[0103] Optionally, compare the level of the first square wave and the level of the second square wave at the corresponding moment of the rising edge of the first square wave; if the level of the first square wave is higher than the level of the second square wave, determine the first square wave as the target square wave with phase lead; if the level of the first square wave is lower than the level of the second square wave, determine the second square wave as the target square wave with phase lead.

[0104] S705 , allocating the selected target square wave to the first channel of the measurement circuit, and allocating the other unselected square wave to the second channel of the measurement circuit.

[0105] The measuring circuit includes a high-frequency counting circuit, and the high-frequency counting circuit includes a first counter and a second counter, wherein the first counter is an 8-bit counter and the second counter is a 24-bit counter.

[0106] S706, when it is determined through the first counter in the measuring circuit that the number of rising edges of the first channel reaches the target value, the number of pulses is acquired through the second counter in the measuring circuit.

[0107] S707, determining the time interval between the rising edge of the first channel and the rising edge of the second channel according to the number of pulses.

[0108] S708: Determine a phase difference between the first signal to be tested and the second signal to be tested according to the time interval.

[0109] The specific process of the above steps can be found in the description of the above method embodiment. The implementation principles and technical effects are similar and will not be repeated here.

[0110] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0111] Based on the same inventive concept, the embodiment of the present application also provides a phase difference measurement device for implementing the phase difference measurement method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more phase difference measurement device embodiments provided below can refer to the limitations of the phase difference measurement method above, and will not be repeated here.

[0112] In one embodiment, Figure 8 As shown, a phase difference measurement device 1 is provided, comprising a signal conversion module 10, a channel allocation module 20 and a phase difference measurement module 30, wherein:

[0113] The signal conversion module 10 is used to convert the first signal to be tested into a first square wave, and to convert the second signal to be tested into a second square wave.

[0114] The channel allocation module 20 is used to allocate the first square wave and the second square wave to different channels of the measurement circuit according to the phase of the first square wave and the phase of the second square wave.

[0115] The phase difference measurement module 30 is used to determine the time interval between the rising edges of different channels of the measurement circuit, and determine the phase difference between the first signal to be measured and the second signal to be measured according to the time interval.

[0116] In one embodiment, the signal conversion module 10 may include:

[0117] The filtering processing unit is used to perform filtering processing on the first signal to be tested and the second signal to be tested respectively.

[0118] The sine wave generating unit is used to generate a first sine wave corresponding to the first signal to be tested after filtering, and to generate a second sine wave corresponding to the second signal to be tested after filtering.

[0119] The difference between the amplitude of the first sine wave and the amplitude of the second sine wave meets a preset condition.

[0120] The square wave generating unit is used to convert the first sine wave into a first square wave, and convert the second sine wave into a second square wave.

[0121] In one embodiment, the channel allocation module 20 may include:

[0122] The square wave selection unit is used to select a target square wave with a leading phase from the first square wave and the second square wave according to the phase of the first square wave and the phase of the second square wave.

[0123] The channel allocation unit is used to allocate the selected target square wave to the first channel of the measurement circuit, and allocate another unselected square wave to the second channel of the measurement circuit.

[0124] In one embodiment, the square wave selection unit is specifically used to compare the level of the first square wave and the level of the second square wave at the corresponding moment of the rising edge of the first square wave, and when the level of the first square wave is higher than the level of the second square wave, determine the first square wave as the target square wave with phase lead, and when the level of the first square wave is lower than the level of the second square wave, determine the second square wave as the target square wave with phase lead.

[0125] In one embodiment, the phase difference measurement module 30 may include:

[0126] The quantity acquisition unit is used to acquire the number of pulses through a second counter in the measurement circuit when it is determined through a first counter in the measurement circuit that the number of rising edges of the first channel reaches a target value.

[0127] The interval determination unit is used to determine the time interval between the rising edge of the first channel and the rising edge of the second channel according to the number of pulses.

[0128] In one embodiment, the measurement circuit includes a high-frequency counting circuit, the high-frequency counting circuit includes a first counter and a second counter, the first counter is an 8-bit counter, and the second counter is a 24-bit counter.

[0129] Each module in the above-mentioned phase difference measurement device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0130] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a phase difference measurement method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse, etc.

[0131] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0132] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0133] The first signal to be measured is converted into a first square wave, and the second signal to be measured is converted into a second square wave; the first square wave and the second square wave are distributed to different channels of a measuring circuit according to the phase of the first square wave and the phase of the second square wave; the time interval between the rising edges of different channels of the measuring circuit is determined, and the phase difference between the first signal to be measured and the second signal to be measured is determined according to the time interval.

[0134] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0135] The first test signal and the second test signal are filtered respectively; a first sine wave corresponding to the first test signal after filtering is generated, and a second sine wave corresponding to the second test signal after filtering is generated; wherein the difference between the amplitude of the first sine wave and the amplitude of the second sine wave meets a preset condition; the first sine wave is converted into a first square wave, and the second sine wave is converted into a second square wave.

[0136] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0137] A target square wave with a leading phase is selected from the first square wave and the second square wave according to the phase of the first square wave and the phase of the second square wave; the selected target square wave is allocated to the first channel of the measurement circuit, and the other square wave that is not selected is allocated to the second channel of the measurement circuit.

[0138] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0139] Compare the level of the first square wave and the level of the second square wave at the corresponding moment of the rising edge of the first square wave; if the level of the first square wave is higher than the level of the second square wave, determine the first square wave as the target square wave with phase lead; if the level of the first square wave is lower than the level of the second square wave, determine the second square wave as the target square wave with phase lead.

[0140] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0141] When the number of rising edges of the first channel reaches the target value through the first counter in the measuring circuit, the number of pulses is obtained through the second counter in the measuring circuit; and the time interval between the rising edge of the first channel and the rising edge of the second channel is determined according to the number of pulses.

[0142] In one embodiment, the measurement circuit includes a high-frequency counting circuit, the high-frequency counting circuit includes a first counter and a second counter, the first counter is an 8-bit counter, and the second counter is a 24-bit counter.

[0143] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0144] The first signal to be measured is converted into a first square wave, and the second signal to be measured is converted into a second square wave; the first square wave and the second square wave are distributed to different channels of a measuring circuit according to the phase of the first square wave and the phase of the second square wave; the time interval between the rising edges of different channels of the measuring circuit is determined, and the phase difference between the first signal to be measured and the second signal to be measured is determined according to the time interval.

[0145] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0146] The first test signal and the second test signal are filtered respectively; a first sine wave corresponding to the first test signal after filtering is generated, and a second sine wave corresponding to the second test signal after filtering is generated; wherein the difference between the amplitude of the first sine wave and the amplitude of the second sine wave meets a preset condition; the first sine wave is converted into a first square wave, and the second sine wave is converted into a second square wave.

[0147] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0148] A target square wave with a leading phase is selected from the first square wave and the second square wave according to the phase of the first square wave and the phase of the second square wave; the selected target square wave is allocated to the first channel of the measurement circuit, and the other square wave that is not selected is allocated to the second channel of the measurement circuit.

[0149] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0150] Compare the level of the first square wave and the level of the second square wave at the corresponding moment of the rising edge of the first square wave; if the level of the first square wave is higher than the level of the second square wave, determine the first square wave as the target square wave with phase lead; if the level of the first square wave is lower than the level of the second square wave, determine the second square wave as the target square wave with phase lead.

[0151] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0152] When the number of rising edges of the first channel reaches the target value through the first counter in the measuring circuit, the number of pulses is obtained through the second counter in the measuring circuit; and the time interval between the rising edge of the first channel and the rising edge of the second channel is determined according to the number of pulses.

[0153] In one embodiment, the measurement circuit includes a high-frequency counting circuit, the high-frequency counting circuit includes a first counter and a second counter, the first counter is an 8-bit counter, and the second counter is a 24-bit counter.

[0154] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0155] The first signal to be measured is converted into a first square wave, and the second signal to be measured is converted into a second square wave; the first square wave and the second square wave are distributed to different channels of a measuring circuit according to the phase of the first square wave and the phase of the second square wave; the time interval between the rising edges of different channels of the measuring circuit is determined, and the phase difference between the first signal to be measured and the second signal to be measured is determined according to the time interval.

[0156] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0157] The first test signal and the second test signal are filtered respectively; a first sine wave corresponding to the first test signal after filtering is generated, and a second sine wave corresponding to the second test signal after filtering is generated; wherein the difference between the amplitude of the first sine wave and the amplitude of the second sine wave meets a preset condition; the first sine wave is converted into a first square wave, and the second sine wave is converted into a second square wave.

[0158] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0159] A target square wave with a leading phase is selected from the first square wave and the second square wave according to the phase of the first square wave and the phase of the second square wave; the selected target square wave is allocated to the first channel of the measurement circuit, and the other square wave that is not selected is allocated to the second channel of the measurement circuit.

[0160] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0161] Compare the level of the first square wave and the level of the second square wave at the corresponding moment of the rising edge of the first square wave; if the level of the first square wave is higher than the level of the second square wave, determine the first square wave as the target square wave with phase lead; if the level of the first square wave is lower than the level of the second square wave, determine the second square wave as the target square wave with phase lead.

[0162] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0163] When the number of rising edges of the first channel reaches the target value through the first counter in the measuring circuit, the number of pulses is obtained through the second counter in the measuring circuit; and the time interval between the rising edge of the first channel and the rising edge of the second channel is determined according to the number of pulses.

[0164] In one embodiment, the measurement circuit includes a high-frequency counting circuit, the high-frequency counting circuit includes a first counter and a second counter, the first counter is an 8-bit counter, and the second counter is a 24-bit counter.

[0165] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0166] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0167] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A phase difference measurement method, characterized in that: The method comprises: Converting the first signal to be tested into a first square wave, and converting the second signal to be tested into a second square wave; Allocating the first square wave and the second square wave to different channels of a measurement circuit according to a phase of the first square wave and a phase of the second square wave; The time interval between rising edges of different channels of the measurement circuit is determined, and the phase difference between the first signal to be measured and the second signal to be measured is determined according to the time interval.

2. The method according to claim 1, characterized in that: The step of converting the first signal to be tested into a first square wave and converting the second signal to be tested into a second square wave comprises: Performing filtering processing on the first signal to be tested and the second signal to be tested respectively; Generate a first sine wave corresponding to the first signal to be tested after filtering, and generate a second sine wave corresponding to the second signal to be tested after filtering; wherein the difference between the amplitude of the first sine wave and the amplitude of the second sine wave meets a preset condition; The first sine wave is converted into a first square wave, and the second sine wave is converted into a second square wave.

3. The method according to claim 1, characterized in that The step of allocating the first square wave and the second square wave to different channels of a measurement circuit according to the phase of the first square wave and the phase of the second square wave comprises: Selecting a target square wave with a leading phase from the first square wave and the second square wave according to the phase of the first square wave and the phase of the second square wave; The selected target square wave is distributed to a first channel of the measurement circuit, and the unselected other square wave is distributed to a second channel of the measurement circuit.

4. The method according to claim 3, characterized in that The step of selecting a target square wave with a phase lead from the first square wave and the second square wave according to the phase of the first square wave and the phase of the second square wave comprises: comparing a level of the first square wave and a level of the second square wave at a time corresponding to a rising edge of the first square wave; If the level of the first square wave is higher than the level of the second square wave, determining the first square wave as a target square wave with a phase lead; If the level of the first square wave is lower than the level of the second square wave, the second square wave is determined as a target square wave with a phase lead.

5. The method according to claim 3, characterized in that: Determining the time interval between rising edges of different channels of the measurement circuit includes: When it is determined by the first counter in the measuring circuit that the number of rising edges of the first channel reaches a target value, the number of pulses is acquired by the second counter in the measuring circuit; A time interval between a rising edge of the first channel and a rising edge of the second channel is determined according to the number of the pulses.

6. The method according to any one of claims 1 to 5, characterized in that The measuring circuit includes a high-frequency counting circuit, and the high-frequency counting circuit includes a first counter and a second counter, wherein the first counter is an 8-bit counter and the second counter is a 24-bit counter.

7. A phase difference measuring device, characterized in that: The device comprises: A signal conversion module, used for converting the first signal to be tested into a first square wave, and converting the second signal to be tested into a second square wave; a channel allocation module, configured to allocate the first square wave and the second square wave to different channels of a measurement circuit according to a phase of the first square wave and a phase of the second square wave; The phase difference measurement module is used to determine the time interval between the rising edges of different channels of the measurement circuit, and determine the phase difference between the first signal to be measured and the second signal to be measured according to the time interval.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.