A signal frequency measurement method and system
By setting the reference measurement time and virtual frequency division or frequency multiplication processing, combined with components such as phase-locked loops and timing counters, the problem of low measurement accuracy of counting frequency meters at low and high frequency signals is solved, and the rapid and accurate measurement of signal frequency is achieved.
Patent Information
- Application Number
- CN202210950685.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2042-08-09
AI Technical Summary
The existing counting frequency meter has low accuracy when measuring low-frequency and high-frequency signals, making it difficult to meet measurement needs.
By setting the reference measurement time, obtaining the number of pulses of the signal to be measured, performing virtual frequency division or frequency multiplication according to the frequency range and measurement accuracy, combining components such as phase-locked loops, timing counters and analog switches to achieve rapid measurement of signal frequency.
The signal measurement range is broadened, the measurement accuracy and speed are improved, and the measurement needs of signals of different frequency.
Smart Images

Figure CN115308484B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of measurement control technology, and in particular to a signal frequency measurement method and system. Background Art
[0002] In industrial control systems, frequency meters are usually used to measure signals. Existing counting frequency meters perform frequency measurement based on single-chip microcomputers. Usually, a counter is used to count the signal to be measured within 1 second, and the counting result of the counter is the frequency of the signal.
[0003] However, this counting method frequency meter has low measurement accuracy for low-frequency signals, and it is even difficult to measure; due to the limitation of the microcontroller clock frequency, it is difficult to ensure the measurement accuracy of high-frequency signals. In order to improve the measurement accuracy of low-frequency and high-frequency signals, the periodic method is used to measure low-frequency signals, and the counting method is used to measure high-frequency signals. However, the accuracy of low-frequency signals measured by the periodic method is low and it takes a long time; the accuracy of high-frequency signals measured by the counting method varies greatly, and the error of the microcontroller measuring high-frequency signals is large. Summary of the invention
[0004] In order to solve the technical problem of low measurement accuracy of existing low-frequency and high-frequency signals, the present invention improves the counting method to achieve the measurement of low-frequency and high-frequency signals, and provides a signal frequency measurement method and system.
[0005] In order to achieve the above object, the specific scheme adopted by the present invention is: a signal frequency measurement method, comprising the steps of:
[0006] S1. Obtain the signal to be tested;
[0007] S2. Perform preliminary measurement on the signal to be measured, obtain the number of pulses of the signal to be measured within the reference measurement time, and determine the frequency range of the signal to be measured according to the number of pulses;
[0008] S3, performing virtual frequency division or frequency multiplication processing on the signal to be measured according to the frequency range and measurement accuracy;
[0009] S4. Measure the signal to be measured after the virtual frequency division or frequency multiplication processing, obtain the measurement result, and calculate the actual frequency of the signal to be measured according to the measurement result.
[0010] As an optimization scheme of the above signal frequency measurement method, S2 includes steps S21, S22 and S23.
[0011] S21. Set the benchmark measurement duration T, T = 10 -n s, n are integers;
[0012] S22, obtaining the number of pulses L of the signal to be measured within the reference measurement time T;
[0013] S23, compare the pulse number L and the decision threshold m, and when L>m, determine the frequency range of the signal to be tested When L≤m, the reference measurement time T is expanded according to a predetermined ratio K, where K is 10, and it is cycled X times until the number of pulses of the signal to be measured within the reference measurement time KXT is L>m, where X is a positive integer, and its frequency range is obtained Wherein m is a positive integer, and m=k-1.
[0014] As another optimization scheme of the above signal frequency measurement method, the specific method of S3 is: the measurement accuracy is 0.1-1%, when nx>1, the signal to be measured is subjected to virtual frequency division processing; when nx≤1, the signal to be measured is subjected to frequency doubling processing.
[0015] As another optimization scheme of the above signal frequency measurement method, the ratio of the measured signal frequency multiplication processing or virtual frequency division processing is P=10 1-(n-x) .
[0016] As another optimization solution of the above signal frequency measurement method, the calculation method of the actual frequency in S4 is F=Q / P.
[0017] A signal frequency measurement system, comprising:
[0018] An acquisition module, used for acquiring a signal to be tested;
[0019] The measuring module obtains the frequency range of the signal to be measured according to the number of pulses of the signal to be measured within the reference measuring time;
[0020] The processing module performs frequency multiplication or virtual frequency division processing on the signal to be tested according to the frequency range;
[0021] The calculation module multiplies the measurement result by the inverse of the frequency multiplication or division to calculate the actual frequency value of the signal to be measured.
[0022] As an optimization solution for the above-mentioned signal frequency measurement system, the acquisition module includes a phase-locked loop, the measurement module includes a timing counter, a first dual-synchronous adder counter, a second dual-synchronous adder counter and two timers; the processing module includes a first analog switch, a second analog switch, a first dual-synchronous adder counter and a second dual-synchronous adder counter; and the calculation module includes a processor.
[0023] As another optimization scheme for the above-mentioned signal frequency measurement system, the input channel of the phase-locked loop and the input channel of the first analog switch are both electrically connected to the signal source of the signal to be measured, the output channel of the phase-locked loop and the input channel of the first dual synchronous adder counter are both electrically connected to the input channel of the first analog switch, the input channel of the second dual synchronous adder counter and the input channel of the second analog switch are both electrically connected to the output channel of the first dual synchronous adder counter, the output channel of the second dual synchronous adder counter is also electrically connected to the input channel of the second analog switch, and the first analog switch and the second analog switch are both electrically connected to the processor.
[0024] As another optimization solution of the above signal frequency measurement system, it also includes a display module to display the actual frequency value of the signal to be measured.
[0025] Beneficial effects:
[0026] 1. The signal frequency measurement method described in the present invention improves the existing counting method. By setting a reference measurement time and obtaining the number of pulses of the signal to be measured within the reference measurement time, the frequency range of the signal to be measured is judged. According to the measurement accuracy requirement, the signal to be measured is subjected to virtual frequency division or frequency multiplication processing, so that the number of pulses of the signal to be measured within the reference measurement time is compared with the decision threshold until the number of pulses of the signal to be measured within the reference measurement time is greater than the decision threshold value. This signal frequency measurement method eliminates the limitation of the single-chip microcomputer clock frequency, broadens the measurement range of the signal to be measured, meets the measurement accuracy of different signals to be measured, and improves the measurement speed of the signal.
[0027] 2. The signal frequency measurement system described in the present invention realizes the processing, measurement and calculation of the signal to be measured based on the acquisition module, measurement module, processing module and calculation module, and displays it through the display module, and quickly switches the frequency multiplication or virtual frequency division of the signal to be measured to meet the frequency measurement requirements of different signals to be measured. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A schematic diagram of an embodiment of a signal frequency measurement system of the present invention;
[0029] Figure 2 A schematic diagram of an embodiment of a signal frequency measurement method of the present invention;
[0030] Figure 3 for Figure 2 Schematic diagram of measuring and calculating the actual frequency value of the signal to be measured;
[0031] Figure 4 for Figure 2 Schematic diagram of the steps of measuring the signal to be measured; DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] The present invention discloses a signal frequency measurement method, which is implemented based on a counting method. For signals within a wide frequency range from low frequency to high frequency, the method can not only automatically measure their frequencies and obtain similar signal frequency measurement accuracy, but also improve the signal measurement speed.
[0034] A signal frequency measurement method comprises the following steps:
[0035] S1. Obtain the signal to be tested;
[0036] S2. Perform preliminary measurement on the signal to be measured, obtain the number of pulses of the signal to be measured within the reference measurement time, and determine the frequency range of the signal to be measured according to the number of pulses;
[0037] S21. Set the benchmark measurement duration T, T = 10 -n s, n are integers;
[0038] S22, obtaining the number of pulses L of the signal to be measured within the reference measurement time T;
[0039] S23, compare the pulse number L and the decision threshold m, and when L>m, determine the frequency range of the signal to be tested When L≤m, the benchmark measurement time T is expanded according to a predetermined ratio K. In order to facilitate rapid measurement, K is 10, and the cycle is repeated X times until the benchmark measurement time K X The number of pulses of the signal to be measured within T is L>m, X is a positive integer, and its frequency range is obtained Wherein m is a positive integer, and m=k-1, and m is 9.
[0040] S3. According to the frequency range and measurement accuracy, the signal to be measured is subjected to virtual frequency division or frequency multiplication processing. Based on the measurement speed, the measurement accuracy is 0.1-1%. That is, when nx>1, for example, when the frequency range is greater than 1000Hz and less than 10000Hz, based on the measurement speed and accuracy requirements, the signal to be measured is subjected to 10 virtual frequency division processing, and the reference measurement time T is 0.1s; when nx≤1, the signal to be measured is subjected to frequency multiplication processing. For example, when the frequency range is greater than 10Hz and less than 100Hz, based on the measurement speed and accuracy requirements, the reference measurement time T is 1s, the signal to be measured is subjected to 10 frequency multiplication processing, and the ratio of the signal to be measured to be subjected to frequency multiplication processing or virtual frequency division processing is P=10. 1-(n-x) .
[0041] S4. Measure the signal to be measured after the virtual frequency division or frequency multiplication processing, obtain the measurement result, and calculate the actual frequency of the signal to be measured according to the measurement result. The calculation method of the actual frequency is F=Q / P.
[0042] When the frequency of the signal to be measured is between 100 Hz and 1 KHz, the measurement accuracy is 0.1 to 1%, the reference measurement time is 1 second, and the frequency of the signal to be measured is measured, and the frequency measurement time is about 1 second.
[0043] When the frequency of the signal to be measured is between 1KHz and 10KHz, the measurement accuracy is 0.1% to 1%, the reference measurement time is 0.1s, and the frequency of the signal to be measured is measured, and the frequency measurement time is about 0.1s.
[0044] When the frequency of the signal to be measured is between 10KHz and 100KHz, the measurement accuracy is 0.1-1%, the reference measurement time is 0.01s, and the frequency of the signal to be measured is measured, and the frequency measurement time is about 0.01s.
[0045] When the frequency of the signal to be measured is between 100KHz and 1MHz, the measurement accuracy is 0.1-1%, the reference measurement time is 0.001s, and the frequency of the signal to be measured is measured, and the frequency measurement time is about 0.001s.
[0046] When the frequency of the signal to be measured is between 10Hz and 100Hz, the measurement accuracy is 0.1% to 1%. Since the count value is small, the frequency measurement error is large. Therefore, when the signal frequency is between 10Hz and 100Hz, the signal to be measured is multiplied by 10 to 100Hz to 1KHz. The benchmark measurement time is 1s. The frequency is measured and divided by 10 to obtain the actual frequency and display it. The frequency measurement time is approximately 1s.
[0047] When the frequency of the signal to be measured is between 1Hz and 10Hz, the measurement accuracy is 0.1% to 1%. Since the count value is small and the frequency measurement error is large, the signal to be measured is multiplied by 100 to 100Hz to 1KHz. The benchmark measurement time is 1s. The frequency is measured and divided by 100 to obtain the actual frequency. The frequency measurement time is approximately 1s.
[0048] When the frequency of the signal to be measured is between 0.1Hz and 1Hz, the measurement accuracy is 0.1% to 1%. Since the count value is small and the frequency measurement error is large, the signal to be measured is multiplied by 1000 to 100Hz to 1KHz. The benchmark measurement time is 1s. The measured frequency is divided by 1000 to obtain the actual frequency. The frequency measurement time is approximately 1s.
[0049] A signal frequency measurement system involved in this embodiment includes an acquisition module for acquiring a signal to be measured, the acquisition module includes a phase-locked loop; a measurement module, which acquires the frequency range of the signal to be measured according to the number of pulses of the signal to be measured within a reference measurement time, the measurement module includes a timing counter, a first dual-synchronous adder counter, a second dual-synchronous adder counter and two timers; a processing module, which performs frequency multiplication or virtual frequency division processing on the signal to be measured according to the frequency range, the processing module includes a first analog switch, a second analog switch, a first dual-synchronous adder counter and a second dual-synchronous adder counter;
[0050] The calculation module multiplies the measurement result by the inverse of the frequency multiplication or division to calculate the actual frequency value of the signal to be measured. The calculation module includes a processor.
[0051] The input channel of the phase-locked loop and the input channel of the first analog switch are both electrically connected to the signal source of the signal to be measured, the output channel of the phase-locked loop and the input channel of the first dual synchronous adder counter are both electrically connected to the input channel of the first analog switch, the input channel of the second dual synchronous adder counter and the input channel of the second analog switch are both electrically connected to the output channel of the first dual synchronous adder counter, the output channel of the second dual synchronous adder counter is also electrically connected to the input channel of the second analog switch, and the first analog switch and the second analog switch are both electrically connected to the processor.
[0052] In this embodiment, Figure 1 As shown, the system uses a single-chip microcomputer of model STC89C52 as the control core, wherein the STC89C52 single-chip microcomputer has built-in timer 0, timer 2, timer counter 1 and processor, the first analog switch and the second analog switch are both models CD4052, the phase-locked loop model is CD4046, and the first dual synchronous adder counter and the second dual synchronous adder counter are models CD4518.
[0053] The signal to be tested is connected to the channel input pin X0 of the first analog switch CD4052, and is also connected to the SIGNAL IN signal input pin of the phase-locked loop CD4046; the signal output pin VCO OUT of the phase-locked loop CD4046 is connected to the channel input pin X1 of the first analog switch CD4052, and is also connected to the clock input pin 1CP of the first dual synchronous adder counter CD4518; the first dual synchronous adder counter CD4518 integrates two synchronous adder binary-decimal counters, namely counter 1 and counter 2; the second dual synchronous adder counter also integrates two synchronous adder binary-decimal counters, namely counter 1 and counter 2; each counter outputs 4-bit binary numbers Q0~Q3. The counter reset pins 1CR and 2CR of the two synchronous adder counters CD4518 are both connected to the pin P0.5 of the single-chip microcomputer, so that the counter of the single-chip microcomputer can reset the counter before counting.
[0054] The enable pin 1EN of counter 1 of the first dual synchronous adder counter CD4518 is connected to the high level +5V, the highest bit output pin 1Q3 of counter 1 is connected to the enable pin 2EN of adder 2, and the clock pin of counter 2 is connected to the ground, so that counter 1 is a decimal counter, and pin 1Q3 is the 10-division signal it outputs; counter 1 and counter 2 are cascaded into a 100-division counter, and pin 2Q3 is the 100-division signal it outputs.
[0055] The highest output pin 2Q3 of the first dual synchronous adder counter CD4518 is connected to the counter 1 enable pin 1EN of the second dual synchronous adder counter, and is also connected to the channel input pin X1 of the first analog switch CD4052; the adder 1 clock pin 1CP of the second dual synchronous adder counter is connected to the ground; thereby, the counter 1 of the second dual synchronous adder counter and the counter 1 and counter 2 of the first dual synchronous adder counter are cascaded to form a 1000 division counter.
[0056] From the above circuit, it can be seen that the input clock signal of counter 1 of the first dual synchronous adder counter is the output signal from the phase-locked loop, the highest bit output signal 1Q3 of counter 1 is a 10-divided signal of the phase-locked loop output signal, the highest bit output signal 2Q3 of counter 2 is a 100-divided signal of the phase-locked loop output signal, and the highest bit output signal 1Q3 of counter 1 of the second dual synchronous adder counter is a 1000-divided signal of the phase-locked loop output signal.
[0057] The highest bit output signal 1Q3 of counter 1 of the first dual synchronous adder counter, the highest bit output signal 2Q3 of counter 2 and the highest bit output signal 1Q3 of counter 1 of the second dual synchronous adder counter are respectively connected to the channel input pins X0, X1 and X2 of the second analog switch CD4052; the inhibit input pin INH of the second analog switch CD4052 is connected to the ground level, thereby enabling the analog switch; the common channel output pin X of the second analog switch is connected to the comparison signal input pin COMPARATOR IN of the phase-locked loop CD4046; the address pins A and B of the second analog switch are respectively connected to the pins P0.3 and P0.4 of the single-chip microcomputer, so that the single-chip microcomputer can control its pins P0.3 and P0.4 to select, that is, the output signal VCO of the phase-locked loop CD4046 The 10-frequency division signal, 100-frequency division signal or 1000-frequency division signal of OUT is fed back to the comparison input pin COMPARATORIN of the phase-locked loop CD4046, so that the phase-locked loop CD4046 becomes a frequency multiplier to achieve 10 times, 100 times or 1000 times the frequency of the signal to be measured.
[0058] As can be seen from the above, the signal to be measured and the output signal VCO OUT of the phase-locked loop CD4046 are respectively connected to the channel input pins X0 and X1 of the first analog switch CD4052; the inhibit input pin INH of the first analog switch CD4052 is connected to the ground level, thereby enabling the analog switch; the common channel output pin X of the first analog switch is connected to the timer 0 count input pin T0 of the single-chip microcomputer; the address pins A and B of the first analog switch are respectively connected to the pins P0.0 and P0.1 of the single-chip microcomputer, so that the single-chip microcomputer can control its pins P0.0 and P0.1 to select, and connect the signal to be measured, or the frequency-multiplied signal of the signal to be measured, to the timer 0 count input pin T0 of the single-chip microcomputer.
[0059] Pins P1.0 to P1.2 of the microcontroller are respectively connected to the enable pin LCDEN, data / command pin RS, and read / write pin R / W of the liquid crystal module LCD12864 to display the frequency of the signal to be measured.
[0060] like Figure 2 , 3 , 4, in order to further speed up the calculation speed, different modes are set Mode = 0, Mode = 1, Mode = 2, Mode = 3, Mode = 4, Mode = 5 and Mode = 6, where the benchmark measurement time of Mode = 6 is 0.0001s, and the ratio of virtual frequency division processing is 10 -3 , and Mode=6 is used as the initial variable; the benchmark measurement time of Mode=5 is 0.001s, and the ratio of virtual frequency division processing is 10 -2 ; Mode = 4, the benchmark measurement duration is 0.01s, and the ratio of virtual frequency division processing is 10 -1 ; The benchmark measurement time of Mode=0 is 0.1s, and the ratio of virtual frequency division processing is 100; the benchmark measurement time of Mode=1 is 0.1s, and the ratio of frequency multiplication processing is 10; the benchmark measurement time of Mode=2 is 0.1s, and the ratio of frequency multiplication processing is 100; the benchmark measurement time of Mode=3 is 0.1s, and the ratio of frequency multiplication processing is 1000.
[0061] Based on the signal frequency measurement method, the implementation steps of the signal frequency measurement method with built-in different modes are as follows: first, Mode=6 is used as the initial variable, and the corresponding pulse number count within 0.0001s is obtained. If the count value count is greater than 9 and mode=6, the setting mode=6 is retained; if the count value count is less than 9, the mode is mode=5, the benchmark measurement time is 0.001s, and the corresponding pulse number count within 0.001s is obtained. If the count value count is greater than 9 and the mode is mode=5, the setting mode=5 is retained; if the count value count is less than 9, the mode is mode=4, the benchmark measurement time is 0.01s, and the corresponding pulse number c within 0.01s is obtained. ount, if the count value count is greater than 9 and the mode is mode=4, then keep setting mode=4; if the count value count is less than or equal to 9, take the mode as Mode=0, the benchmark measurement duration is 0.1s, obtain the number of pulses count corresponding to 0.1s, if the count value count is less than or equal to 9, the mode is Mode=0, then set the mode to Mode1; if the count value count is less than or equal to 9 and the mode is Mode=1, then set the mode to Mode=2, thereby selecting the 100 times frequency measurement frequency of the signal to be measured; if the count value count is not greater than 9 and the mode is Mode=2 or Mode=3, then set the mode to Mode=3, thereby selecting the 1000 times frequency measurement frequency of the signal to be measured.
[0062] According to different modes, the corresponding actual frequency value is calculated, F=Q / P. When the mode is Mode=6, P is 0.001, F=Q×1000; when the mode is Mode=5, P is 0.01, F=Q×100; when the mode is Mode=4, P is 0.1, F=Q×10; when the mode is Mode=0, P is 1, F=Q; when the mode is Mode=1, P is 10, F=Q / 10; when the mode is Mode=2, P is 100, F=Q / 100; when the mode is Mode=3, P is 1000, F=Q / 1000.
[0063] like Figure 4 The actual measurement based on the signal frequency measurement system shown is as follows:
[0064] The frequency of a signal to be measured is 500Hz. It is input into the measurement system. First, if the 0.0001s count value of timer 2 is count<9 and Mode=6, then Mode=5 is set and timer 2 is a 0.001s timer. After timer 2 is interrupted again, the count value is count<9 and Mode=5, then Mode=4 is set and timer 2 is a 0.01s timer. After timer 2 is interrupted again, the count value is count<9 and Mode=4, then Mode=0 is set and timer 2 is a 0.1s timer. After timer 2 is interrupted again, the count value is count=50>9, then timer 0 is set to a 1s timer, timer 0 is turned on and timer 2 is turned off. After timer 0 is interrupted, the frequency value is Q=500 and the frequency F=Q, which is the signal frequency. The measurement time is approximately 1s and the measurement accuracy is
[0065] The frequency of a signal to be measured is 5KHz, the 0.0001s count value of timer 2 is count<9, and Mode=6, then set Mode=5, and timer 2 is a 0.001s timer; after timer 2 is interrupted again, the count value is count<9, and Mode=5, then set Mode=4, and timer 2 is a 0.01s timer; after timer 2 is interrupted again, the count value is count=50>9, then set timer 0 to a 0.1s timer, turn on timer 0, and turn off timer 2; after timer 0 is interrupted, the frequency value is Q=500, and the frequency F=Q×10=5KHz, which is the signal frequency. The measurement time is approximately 0.1s, and the measurement accuracy is
[0066] The frequency of a signal to be measured is 50KHz, the 0.0001s count value of timer 2 is count<9, and Mode=6, then set Mode=5, and timer 2 is a 0.001s timer; after timer 2 is interrupted again, the count value count=50>9, then set timer 0 to a 0.01s timer, turn on timer 0, and turn off timer 2; after timer 0 is interrupted, the frequency value Q=500, the frequency F=Q×100=50KHz, which is the signal frequency. The measurement time is approximately 0.01s, and the measurement accuracy is
[0067] The frequency of a signal to be measured is 500KHz, the 0.0001s count value of timer 2 count=50>9, and Mode=6, then set timer 0 as a 0.001s timer, turn on timer 0, and turn off timer 2; after timer 0 is interrupted, the frequency value Q=500, the frequency f=Q×1000=500KHz, which is the signal frequency. The measurement time is approximately 0.001s, and the measurement accuracy is
[0068] The frequency of a signal to be measured is 50Hz, the 0.0001s count value of timer 2 is count<9, and Mode=6, then Mode=5 is set, and timer 2 is a 0.001s timer; after timer 2 is interrupted again, the count value is count<9, and Mode=5, then Mode=4 is set, and timer 2 is a 0.01s timer; after timer 2 is interrupted again, the count value is count<9, and Mode=4, then Mode=0 is set, and timer 2 is a 0.1s timer; after timer 2 is interrupted again, the count value is count<9, and Mode=0, then Mode=1 is set, and the signal to be measured is measured after 10 times; after timer 2 is interrupted again, the count value is count=50>9, then timer 0 is set to a 1s timer; timer 0 is turned on and timer 2 is turned off; after timer 0 is interrupted, the frequency value is Q=500, and the frequency F=Q / 10=50Hz, which is the signal frequency. The measurement time is approximately 1s, and the measurement accuracy is
[0069] When the frequency of the signal to be measured is between 10Hz and 100Hz, the frequency measurement error is large due to the small count value. Therefore, when the signal frequency is between 10Hz and 100Hz, in the interrupt of timer 2, set Mode = 1, multiply the frequency of the signal to be measured by 10 to 100Hz ~ 1KHz, measure the frequency, divide it by 10 to get the actual frequency and display it. The frequency measurement time is 1s, and the measurement accuracy is 0.1 ~ 1%;
[0070] The frequency of a signal to be measured is 5Hz, the 0.0001s count value of timer 2 count<9, and Mode=6, then Mode=5 is set, and timer 2 is a 0.001s timer; after timer 2 is interrupted again, the count value count<9, and Mode=5, then Mode=4 is set, and timer 2 is a 0.01s timer; after timer 2 is interrupted again, the count value count<9, and Mode=4, then Mode=0 is set, and timer 2 is a 0.1s timer; after timer 2 is interrupted again, the count value count<9, and Mode=0, then Mode=1 is set, and the signal to be measured is measured after 10 times of frequency; after timer 2 is interrupted again, the count value count<9, and Mode=1, then Mode=2 is set, and the signal to be measured is measured after 100 times of frequency; after timer 2 is interrupted again, the count value count=50>9, then timer 0 is set to a 1s timer; timer 0 is turned on, and timer 2 is turned off; after timer 0 is interrupted, the frequency value Q=500, and the frequency F=Q / 100=50Hz, which is the signal frequency. The measurement time is approximately 1s and the measurement accuracy is
[0071] The frequency of a signal to be tested is 0.5Hz, the 0.0001s count value of timer 2 is count<9, and Mode=6, then Mode=5 is set, and timer 2 is a 0.001s timer; after timer 2 is interrupted again, the count value is count<9, and Mode=5, then Mode=4 is set, and timer 2 is a 0.01s timer; after timer 2 is interrupted again, the count value is count<9, and Mode=4, then Mode=0 is set, and timer 2 is a 0.1s timer; after timer 2 is interrupted again, the count value is count<9, and Mode=0, then Mode=1 is set, and timer 2 is a 0.1s timer. The signal to be measured is measured after 10 cycles; after timer 2 is interrupted again, the count value count<9, and Mode=1, then set Mode=2, and measure the signal to be measured after 100 cycles; after timer 2 is interrupted again, the count value count<9, and Mode=2, then set Mode=3, and measure the signal to be measured after 1000 cycles; after timer 2 is interrupted again, the count value count=50>9, then set timer 0 as a 1s timer; turn on timer 0 and turn off timer 2; after timer 0 is interrupted, the frequency value Q=500, the frequency F=Q / 1000=0.50Hz, which is the signal frequency. The measurement time is approximately 1s, and the measurement accuracy is
Claims
1. A signal frequency measurement method, comprising the steps of: S1. Obtain the signal to be tested; S2, perform preliminary measurement on the signal to be measured, obtain the number of pulses of the signal to be measured within the reference measurement time, and determine the frequency range of the signal to be measured according to the number of pulses; S2 includes steps S21, S22 and S23, S21. Set the benchmark measurement duration T, T=10 -n s, n are integers; S22, obtaining the number of pulses L of the signal to be measured within the reference measurement time T; S23, compare the pulse number L and the decision threshold m, and when L>m, determine the frequency range of the signal to be tested Q =[10 n+1 ,10 n+2 ], when L≤m, the reference measurement time T is expanded according to the predetermined ratio K, where K is 10, and it is cycled X times until the number of pulses of the signal to be measured within the reference measurement time KXT is L>m, where X is a positive integer, and its frequency range is obtained Q =[10 n-x+1 ,10 n-x+2 ], where m is a positive integer and m=k-1; S3, performing virtual frequency division or frequency multiplication processing on the signal to be measured according to the frequency range and measurement accuracy; S4. Measure the signal to be measured after the virtual frequency division or frequency multiplication processing, obtain the measurement result, and calculate the actual frequency of the signal to be measured according to the measurement result.
2. A signal frequency measurement method according to claim 1, characterized in that: The specific method of S3 is: the measurement accuracy is 0.1-1%, when nx>1, the signal to be measured is processed by virtual frequency division; when nx≤1, the signal to be measured is processed by frequency doubling.
3. A signal frequency measurement method according to claim 2, characterized in that: The ratio of the measured signal frequency multiplication or virtual frequency division is P =10 1-(n-x) .
4. A signal frequency measurement method according to claim 3, characterized in that: The actual frequency in S4 is calculated as F=Q / P.
5. A signal frequency measurement system, used to implement a signal frequency measurement method as claimed in any one of claims 1 to 4, characterized in that: The system comprises: An acquisition module, used for acquiring a signal to be tested; The measuring module obtains the frequency range of the signal to be measured according to the number of pulses of the signal to be measured within the reference measuring time; The processing module performs frequency multiplication or virtual frequency division processing on the signal to be tested according to the frequency range; The calculation module multiplies the measurement result by the inverse of the frequency multiplication or division to calculate the actual frequency value of the signal to be measured.
6. A signal frequency measurement system according to claim 5, characterized in that: The acquisition module includes a phase-locked loop, the measurement module includes a timing counter, a first dual-synchronous adder counter, a second dual-synchronous adder counter and two timers; the processing module includes a first analog switch, a second analog switch, a first dual-synchronous adder counter and a second dual-synchronous adder counter; the calculation module includes a processor.
7. The signal frequency measurement system according to claim 6, characterized in that: The input channel of the phase-locked loop and the input channel of the first analog switch are both electrically connected to the signal source of the signal to be measured, the output channel of the phase-locked loop and the input channel of the first dual synchronous adder counter are both electrically connected to the input channel of the first analog switch, the input channel of the second dual synchronous adder counter and the input channel of the second analog switch are both electrically connected to the output channel of the first dual synchronous adder counter, the output channel of the second dual synchronous adder counter is also electrically connected to the input channel of the second analog switch, and the first analog switch and the second analog switch are both electrically connected to the processor.
8. A signal frequency measurement system according to claim 5, characterized in that: It also includes a display module for displaying the actual frequency value of the signal to be measured.
Citation Information
Patent Citations
Device and method for improving frequency measurement sensitivity
CN112730977A