An equal-precision frequency solving device and solving method
Through the combination of the cycle counting method acquisition module and the calculation program, using FPGA and CPU for frequency acquisition and calculation, the problem of jumps and inconsistent accuracy of the frequency solution results in the cycle counting frequency measurement method is solved, and equal-precision frequency measurement is achieved. Suitable for a wide range of and highly reliable application scenarios.
Patent Information
- Application Number
- CN202111024168.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-01
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-09-01
AI Technical Summary
The existing cycle-counting frequency measurement method has problems such as jumps in the frequency solution and inconsistent measurement accuracy in the frequency solution. Especially when the frequency of the measured signal is high, the accuracy is low, and the solution result is affected by the system clock frequency. Influence.
An equal-precision frequency solution device is designed, including a frequency acquisition unit and an equal-precision solution unit. The input square wave signal is counted through the cycle counting method acquisition module on the FPGA, and the counting results are stored in the data storage FIFO module. , the solving program on the CPU calculates the frequency based on the average of multiple counting results, ensuring the smoothness and accuracy of the frequency solving results within one operating cycle.
It effectively solves the problem of inconsistency in frequency calculation errors, achieves equal-precision frequency measurement in a wide range, improves anti-interference capability and measurement stability, and is suitable for high-reliability application scenarios.
Smart Images

Figure CN113740602B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital circuit technology, but is not limited to it, and in particular to an equal-precision frequency solving device and solving method. Background Art
[0002] At present, the "cycle counting method" is often used in the field of industrial frequency measurement to accurately measure the frequency of the signal. Its principle is to obtain the number of counts of the system clock in a single cycle of the collected signal, and then calculate the frequency of the collected signal through the system clock frequency and the number of counts.
[0003] In general, the above-mentioned "cycle counting method" has a high acquisition accuracy because the frequency of the system clock is much higher than the frequency of the collected signal. However, there are two problems with the conventional cycle counting system: (i) only one cycle counting result is involved in the frequency solution, and the solution result has poor smoothness and poor anti-interference ability, which is manifested as a jump in the measured frequency; (ii) the measurement accuracy is not equal. The higher the frequency of the measured signal, the lower the measurement accuracy. Especially when the frequency of the measured signal is close to the system clock, the accuracy of the solution result is very low. Summary of the invention
[0004] The purpose of the present invention is: in order to solve the problems in the background technology, the embodiments of the present invention propose an equal-precision frequency solving device and solving method to solve the problems that the existing cycle counting and frequency measurement method uses a single counting number for solving, the measurement frequency may jump, and the measurement accuracy is affected by the frequency of the measured signal.
[0005] The technical solution of the present invention is as follows: the embodiment of the present invention provides an equal-precision frequency solving device, comprising: a frequency acquisition unit and an equal-precision solving unit;
[0006] The frequency acquisition unit includes: a cycle counting acquisition module and a data storage FIFO module built on an FPGA, and a system clock is configured in the FPGA;
[0007] The frequency acquisition unit is used to use the cycle counting acquisition module to count each cycle of the input square wave signal according to the system clock, and store the counting result of each cycle of the square wave signal in the data storage FIFO module in sequence;
[0008] The equal-precision solving unit is a solving program configured on the CPU, and the solving program is pre-configured with a fixed operating cycle; the equal-precision solving unit is used to read the counting results from the data storage FIFO module, and solve the average frequency of the square wave signal within an operating cycle based on the read counting results, the number of counting results and the system clock.
[0009] Optionally, in the equal-precision frequency solving device as described above, the depth of the data storage FIFO module is determined according to the operation period Period of the solving program and the maximum frequency Fre of the input square wave signal. max The configured depth is:
[0010] Depth=Period×Fre max .
[0011] Optionally, in the equal-precision frequency solving device as described above,
[0012] The data storage FIFO module is also configured with a FIFO empty flag, which is used to be set to 1 when there is no counting result in the data storage FIFO module, and is set to 0 to indicate that it is not empty.
[0013] Optionally, in the equal-precision frequency solving device as described above, the equal-precision solving unit comprises: a data driving module and a frequency solving module;
[0014] The data driving module is configured with an array for storing counting results and a counting amount for counting the number of counting results, and is used to determine whether the data storage FIFO module is empty by reading the FIFO empty flag, and when it is not empty, read the counting results in the data storage FIFO module in sequence and store them in the array, and the counting amount is increased by 1 for each counting result stored;
[0015] The frequency calculation module is used to calculate the average frequency of the square wave signal within an operation cycle according to each counting result in the array, the counting amount and the system clock when the counting amount is not 0.
[0016] Optionally, in the above-mentioned equal-precision frequency solving device, the frequency solving module solves the average frequency of the square wave signal in one operation cycle, including:
[0017] According to each counting result in the array and the count amount of the counting result, the average value of all the counting results is calculated, and according to the average value of all the counting results and the system clock, the average frequency of the square wave signal in the operation cycle is solved.
[0018] Optionally, in the equal-precision frequency solving device as described above,
[0019] The data driving module is also used for, when it is determined that the data storage FIFO module is empty by reading the FIFO empty flag, the count amount of the counting result in its array is 0, so that the frequency solving module outputs the frequency solving result of the previous operation cycle.
[0020] The embodiment of the present invention further provides an equal-precision frequency solving method, which is performed by using the equal-precision frequency solving device as described in any one of the above items, and the method comprises: counting the period of the input square wave signal, and the solving program solving the frequency of the input signal in each operation thereof;
[0021] The counting of the cycle of the input square wave signal comprises: counting each cycle of the input square wave signal according to the system clock, recording the counting result of each cycle of the square wave signal and storing it in a data storage FIFO module;
[0022] The solver performs frequency solving on the input signal in each of its runs, including:
[0023] The counting result is read from the data storage FIFO module, and the average frequency of the square wave signal within one operation cycle of the solving program is solved according to the read counting result, the counting amount of the counting result and the system clock.
[0024] Optionally, in the equal-precision frequency solving method as described above, the solving program performs frequency solving on the input signal in each operation thereof, including: a data-driven process running through a data-driven module, and a frequency solving process running through a frequency solving module;
[0025] The data-driven process includes:
[0026] Step 11, initializing the array for storing counting results in the data driver module, and setting the number of counting results to 0;
[0027] Step 12, reading the FIFO empty flag in the data storage FIFO module, and determining whether the data storage FIFO module is empty;
[0028] Step 13, if it is determined in step 12 that the data storage FIFO module is not empty, then read the counting result, store the counting result in an array, add 1 to the counting amount of the counting result in the array, and proceed to step 12; if it is determined in step 12 that the data storage FIFO module is empty, then end the data driving process and proceed to the frequency solving process;
[0029] The frequency solution process includes:
[0030] Step 21, determine whether the count amount of the counting result is equal to 0; if it is determined that the count amount is 0, then output the frequency solution result of the previous operation cycle, and the solution process ends; if it is determined that the count amount is not 0, then go to step 22;
[0031] Step 22, according to all the counting results and the counted amounts in the array, calculate the average value of all the counting results;
[0032] Step 23, according to the average value of the counting result and the system clock of the FPGA, the average frequency of the square wave signal is calculated and output.
[0033] The beneficial effects of the present invention are as follows: an embodiment of the present invention proposes an equal-precision frequency solving device and solving method, which effectively solves the problem of inconsistent frequency accuracy within the full-scale range of conventional frequency solving methods; first of all, it is explained that the cause of the frequency solving error is due to the synchronization error from the input square wave signal to the system clock domain, and the synchronization error is less than or equal to one system clock cycle. The conventional method solves the frequency based only on a system clock counting result of the input square wave signal. When the frequency of the input square wave signal is high, the ratio of the synchronization error to the input square wave signal cycle is large, and the frequency accuracy is low. When the frequency of the input square wave signal is low, the ratio of the synchronization error to the input square wave signal cycle is small, and the frequency accuracy is high. The above is the reason why equal-precision solving cannot be achieved in the conventional frequency solving method. The accuracy of the solved frequency is affected by the frequency of the input square wave signal. Therefore, the conventional frequency solving method is unequal-precision frequency solving. The equal-precision frequency solving device and solving method provided by the embodiments of the present invention solve the frequency based on the sum of all system clock counting results of the input square wave signal within one operation cycle of the software. When the software operation cycle remains unchanged, no matter how the frequency of the input square wave signal changes, the sum of the counting results is roughly equal, and the ratio of the synchronization error to the sum of the counting results remains unchanged, thereby ensuring that the equal-precision requirements of the frequency solution within the full-scale range can be applied to wide-range, equal-precision, and high-reliability application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A schematic diagram of the structure of an equal-precision frequency solving device provided by an embodiment of the present invention;
[0035] Figure 2 , which is a schematic diagram of the working process of the medium-precision solving unit of the equal-precision frequency solving device provided in an embodiment of the present invention;
[0036] Figure 3 This is a schematic diagram of the principle of synchronization error caused by the traditional "cycle counting and frequency measurement method" used in conventional frequency resolution methods;
[0037] Figure 4 The present invention is a schematic diagram of the principle of performing frequency calculation using the equal-precision frequency calculation device and calculation method provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the present invention more clear, the embodiments of the present invention will be described in detail with reference to the accompanying drawings. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other arbitrarily without conflict.
[0039] As described in the above background technology, the "cycle counting method" calculates the frequency of the collected signal through the system clock frequency and the number of counts. Since only one cycle of the count number is involved in the frequency calculation, there is a problem that the measurement frequency may jump and the measurement accuracy is affected by the frequency of the measured signal.
[0040] In application scenarios such as aerospace that require wide range, equal precision and high reliability frequency measurement, designing a highly robust equal precision frequency solution implementation method has important application value. In response to the above requirements, the embodiment of the present invention proposes an equal precision frequency solution device and solution method, which are particularly suitable for wide range equal precision frequency measurement scenarios.
[0041] The present invention provides the following specific embodiments which can be combined with each other. The same or similar concepts or processes may not be described in detail in some embodiments.
[0042] Figure 1 The following is a schematic diagram of the structure of an equal-precision frequency solving device provided by an embodiment of the present invention. Figure 1 As shown, the equal-precision frequency solving device in the embodiment of the present invention may include: a frequency acquisition unit and an equal-precision solving unit.
[0043] like Figure 1 In the structure of the equal-precision frequency solving device shown, the frequency acquisition unit may include: a cycle counting acquisition module and a data storage FIFO module built on the FPGA, and a system clock is configured in the FPGA.
[0044] Based on the structure of the frequency acquisition unit in the embodiment of the present invention, the function of the frequency acquisition unit is: using the cycle counting acquisition module to count each cycle of the input square wave signal according to the system clock, and storing the counting result of each cycle of the square wave signal in the data storage FIFO module in sequence.
[0045] The equal-precision solving unit in the embodiment of the present invention is a solving program configured on the CPU, and the solving program is pre-configured with a fixed operating cycle; based on the configuration form and content of the equal-precision solving unit, the function of the equal-precision solving unit is: reading the counting result from the data storage FIFO module, and solving the average frequency of the square wave signal within an operating cycle based on the read counting result, the number of counting results and the system clock.
[0046] It should be noted that the cycle counting acquisition module and the data storage FIFO module in the frequency acquisition unit of the embodiment of the present invention are implemented based on FPGA.
[0047] In the embodiment of the present invention, the depth (Depth) of the data storage FIFO module in the frequency acquisition unit is determined according to the operation period Period of the solution program and the maximum frequency Fre of the input square wave signal. max In a specific implementation, the depth of the data storage FIFO module can be:
[0048] Depth=Period×Fre max .
[0049] In the embodiment of the present invention, the data storage FIFO module in the frequency acquisition unit is also configured with a FIFO empty flag. Specifically, the FIFO empty flag is set to 1 when there is no counting result in the data storage FIFO module, and is set to 0 when the counting result of the data storage FIFO module is not empty.
[0050] like Figure 1 In the structure of the equal-precision frequency solving device shown in FIG. 1 , the equal-precision solving unit may include: a data driving module and a frequency solving module, and it should be noted that the data driving module and the frequency solving module are implemented based on a CPU. Figure 2 As shown, it is a schematic diagram of the working process of the medium-precision solving unit of the equal-precision frequency solving device provided in an embodiment of the present invention; wherein, the data driving module executes the data driving process, and the frequency solving module executes the frequency solving process.
[0051] In an embodiment of the present invention, the data driving module is configured with an array for storing counting results and a counting number for counting the number of counting results. The data driving module is used to determine whether the data storage FIFO module is empty by reading the FIFO empty flag, and when it is not empty, the counting results in the data storage FIFO module are read out and stored in the array in sequence. Each time a counting result is stored, the counting number is increased by 1.
[0052] The frequency calculation module in the embodiment of the present invention is used to calculate the average frequency of the square wave signal within an operation cycle according to each counting result in the array, the counting amount and the system clock when the counting amount is not 0.
[0053] It can be seen from the working process of the above-mentioned equal-precision solving unit that the data storage FIFO module in the embodiment of the present invention not only provides the counting result (i.e. the counting value of the system clock within one cycle of the input square wave signal) to the data driving module, but also provides a FIFO empty flag indicating that the FIFO module is empty, which is used for data driving and frequency solving of the equal-precision solving unit.
[0054] In an implementation of the embodiment of the present invention, the specific implementation method of the frequency calculation module calculating the average frequency of the square wave signal within an operation cycle may include:
[0055] According to each counting result in the array and the count amount of the counting result, the average value of all the counting results is calculated, and according to the average value of all the counting results and the system clock, the average frequency of the square wave signal in the operation cycle is solved.
[0056] In a specific implementation of the embodiment of the present invention, the data driving module is also used to determine that the data storage FIFO module is empty by reading the FIFO empty flag. Since the count amount of the counting result in its array is 0, at this time, the frequency solving module outputs the frequency solving result of the previous operation cycle.
[0057] Based on the equal-precision frequency solving device provided by the above-mentioned embodiments of the present invention, an embodiment of the present invention further provides an equal-precision frequency solving method, which is executed by using the equal-precision frequency solving device provided by the above-mentioned embodiments of the present invention. The method mainly includes two parts: one part is: counting the period of the input square wave signal; the other part is: the solving program solves the frequency of the input signal in each operation thereof.
[0058] In the equal-precision frequency resolution method provided by an embodiment of the present invention, the specific implementation method of counting the period of the input square wave signal may include: counting each period of the input square wave signal according to the system clock, recording the counting result of each period of the square wave signal and storing it in a data storage FIFO module.
[0059] In the equal-precision frequency solving method provided in the embodiment of the present invention, the specific implementation of the solving program for solving the frequency of the input signal in each operation thereof may include:
[0060] The counting result is read from the data storage FIFO module, and the average frequency of the square wave signal within one operation cycle of the solving program is solved according to the read counting result, the counting amount of the counting result and the system clock.
[0061] Furthermore, in the embodiment of the present invention, the frequency of the input signal is solved by the solving program in each operation thereof, which specifically includes two parts: data driving and frequency solving, namely, including: a data driving process running through a data driving module, and a frequency solving process running through a frequency solving module;
[0062] Refer to the above Figure 2 The workflow of the equal-precision solving unit shown in the figure, in which the data-driven process may include the following specific steps:
[0063] Step 11, initializing the array for storing counting results in the data driver module, and setting the number of counting results to 0, that is, count=0;
[0064] Step 12, reading the FIFO empty flag in the data storage FIFO module, and determining whether the data storage FIFO module is empty;
[0065] Step 13, if it is determined in step 12 that the data storage FIFO module is not empty, then read the counting result, store the counting result in the array, add 1 to the counting result in the array, and go to step 12; if it is determined in step 12 that the data storage FIFO module is empty, then end the data drive process and go to the frequency solution process. At this time, the frequency of the input square wave signal is less than the software running frequency, and the following situation may exist: because the square wave signal cycle is greater than the CPU running cycle, after the CPU last collected the counting result in the FIFO, the cycle counting acquisition module has not yet stored the new counting result in the FIFO, so the amount of data in the FIFO is 0.
[0066] Refer to the above Figure 2 The work flow of the equal precision solving unit shown in the figure, wherein the frequency solving process may include the following specific steps:
[0067] Step 21, determine whether the count amount of the counting result is equal to 0. If it is 0, it means that the period of the square wave information is large. At this time, the counting result in the FIFO module is not updated, and the frequency solution result of the previous operation cycle is output, and the solution process ends; otherwise, go to step 22;
[0068] Step 22, according to all the counting results and the counted amounts in the array, calculate the average value of all the counting results;
[0069] Step 23, according to the average value of the counting result and the system clock of the FPGA, the average frequency of the square wave signal is calculated and output.
[0070] The equal-precision frequency solving device and solving method provided by the embodiment of the present invention effectively solve the problem of inconsistent frequency accuracy within the full-scale range of the conventional frequency solving method; first of all, it should be noted that the cause of the frequency solving error is due to the synchronization error from the input square wave signal to the system clock domain, and the synchronization error is less than or equal to one system clock cycle. The conventional method solves the frequency based on only one system clock counting result of the input square wave signal. When the frequency of the input square wave signal is high, the ratio of the synchronization error to the input square wave signal cycle is large, and the frequency accuracy is low. When the frequency of the input square wave signal is low, the ratio of the synchronization error to the input square wave signal cycle is small, and the frequency accuracy is high. The above is the reason why equal-precision solving cannot be achieved in the conventional frequency solving method. The accuracy of the solved frequency is affected by the frequency of the input square wave signal. Therefore, the conventional frequency solving method is unequal-precision frequency solving. The equal-precision frequency solving device and solving method provided by the embodiments of the present invention solve the frequency based on the sum of all system clock counting results of the input square wave signal within one operation cycle of the software. When the software operation cycle remains unchanged, no matter how the frequency of the input square wave signal changes, the sum of the counting results is roughly equal, and the ratio of the synchronization error to the sum of the counting results remains unchanged, thereby ensuring that the equal-precision requirements of the frequency solution within the full-scale range can be applied to wide-range, equal-precision, and high-reliability application scenarios.
[0071] The following is a detailed description of the synchronization error of the traditional "cycle counting and frequency measurement method" used in the conventional frequency solution method, including the following two cases:
[0072] Figure 3 This is a schematic diagram of the principle of synchronization error caused by the traditional "cycle counting and frequency measurement method" used in conventional frequency resolution methods. Figure 3 As shown in the figure, the traditional "cycle counting method" counts the period of the input square wave signal according to the system clock. The synchronization errors Δ1 and Δ2 are the main factors causing the frequency acquisition error. When the system clock frequency is f system , then the frequency value calculated based on the single-cycle counting result is: Where N is the counting result, and the frequency of the actual input square wave signal can be expressed as: Where |Δ1-Δ2| is less than one system clock cycle P system , so the frequency error is: It can be seen that the frequency error is related to the cycle counting result N. When N is larger, the frequency error is smaller, and when N is smaller, the frequency error is larger.
[0073] Figure 4 The schematic diagram is a principle diagram of frequency calculation using the equal-precision frequency calculation device and calculation method provided by the embodiment of the present invention. Figure 4As shown, in the embodiment of the present invention, the frequency is solved according to all the counting results of the square wave signal input by the software within an operation period Period and the count amount count of the counting results, and the frequency solution value obtained is Among them, N i is the i-th counting result, f system is the system clock frequency, and the actual frequency value is: Among them, Δ is the acquisition error of the input square wave signal in the corresponding counting result, where |Δ1-Δ count |Less than one system clock cycle P system , so the frequency error is: and It can be seen that the frequency error has nothing to do with the frequency of the input square wave signal, but is only related to the gate time and the standard signal frequency, that is, the embodiment of the present invention achieves equal-precision measurement of the entire test frequency band.
[0074] Based on the above analysis, if Figure 4 As shown, the acquisition error of the first counting result of the input square wave signal is Δ1-Δ2, the acquisition error of the second counting result is Δ2-Δ3, and the acquisition error of the third counting result is Δ3-Δ4. The cumulative error of the three counting results is (Δ1-Δ2)+(Δ2-Δ3)+(Δ3-Δ4)=Δ1-Δ4. It can be seen that by using the device and method provided by the embodiment of the present invention to perform frequency resolution, the synchronization error of multiple consecutive counting is also less than one system clock cycle P system , that is, the equal-precision frequency solution is achieved.
[0075] In an optional implementation of an embodiment of the present invention, a cycle counting method is implemented for the square wave signal output by the conditioning circuit based on a cycle counting method acquisition module, and the counting result is stored in a data storage FIFO module of a specified size. The CPU periodically reads the empty data storage FIFO module, sorts the counting results, and after eliminating the maximum and minimum values, calculates the average value of the counting results, and solves the frequency based on the average value of the counting results.
[0076] The specific implementation of the equal-precision frequency solving device and solving method provided by the embodiment of the present invention is described below through a specific implementation example.
[0077] like Figure 1 As shown, the equal-precision frequency solving device provided in this specific embodiment specifically includes: a frequency acquisition unit and an equal-precision solving unit; wherein the frequency acquisition unit specifically includes: a cycle counting acquisition module and a data storage FIFO module, and the frequency acquisition unit specifically includes: a data driving module and a frequency solving module.
[0078] In the specific implementation, the cycle counting acquisition module and the data storage FIFO module are implemented based on FPGA; the data driving module and the frequency solving module are implemented based on CPU.
[0079] The measured signal is conditioned and compared with hysteresis to generate a frequency-maintained square wave signal, which is input to the cycle counting acquisition module through the FPGA pin. The cycle counting acquisition module synchronizes the input square wave signal in the system clock domain through a two-stage D flip-flop, and generates a single pulse signal indicating the rising edge of the input square wave signal through calculation. The single pulse signal is used as an enable signal to trigger the system clock count of a single cycle of the frequency input signal, and as an enable signal to trigger the storage process of the counting result; the data storage FIFO module is used to store the counting result of the single cycle system clock of the input method signal, and its width is equal to the counter width of the cycle counting acquisition module, and its depth Depth can be based on the software operation period Period of the data driving module and the frequency solving module and the maximum frequency Fre of the measured signal. max Configuration, specifically Depth = Period × Fre max In addition, the data storage FIFO module also includes a FIFO empty flag indicating whether it is empty.
[0080] The data driver module in this specific embodiment maintains an array and a count number count. At the beginning of the software cycle, the array and count are cleared to 0, and the empty flag empty of the data storage FIFO module is read. If empty is equal to 1, it means that the data storage FIFO module is empty, then the data driver process ends and the frequency resolution process is transferred to. Otherwise, the counting result is read in a loop, and the count number count is increased by 1 until empty is 1. The data resolution module in this specific embodiment determines whether the count number count is 0. If it is 0, it means that the frequency has not been updated, and the frequency resolution result of the previous software cycle is directly output. If it is not 0, the counting result is averaged and filtered, and then the frequency is resolved and output. If the average value of the counting result is Code avg , the system clock frequency is Fre system , then the frequency solution result Fre result =Fre system / Code avg .
[0081] Although the embodiments disclosed in the present invention are as above, the contents described are only embodiments adopted to facilitate understanding of the present invention and are not intended to limit the present invention. Any technician in the field to which the present invention belongs can make any modifications and changes in the form and details of implementation without departing from the spirit and scope disclosed in the present invention, but the patent protection scope of the present invention shall still be subject to the scope defined in the attached claims.
Claims
1. An equal-precision frequency solving device, It is characterized in that include: Frequency acquisition unit and equal precision solving unit; The frequency acquisition unit includes: a cycle counting acquisition module and a data storage FIFO module built on an FPGA, and a system clock is configured in the FPGA; The frequency acquisition unit is used to use the cycle counting acquisition module to count each cycle of the input square wave signal according to the system clock, and store the counting result of each cycle of the square wave signal in the data storage FIFO module in sequence; The equal-precision solving unit executes a solving program configured on the CPU, and the solving program is pre-configured with a fixed operation cycle; the equal-precision solving unit is used to read the counting result from the data storage FIFO module, and solve the average frequency of the square wave signal within an operation cycle according to the read counting result, the number of counting results and the system clock; the solving method specifically includes: The frequency is calculated based on all the counting results and the number of counts of the counting results in the square wave signal input within an operation period Period. The frequency solution value is: Among them, N i is the i-th counting result, f system is the system clock frequency; The actual frequency value is: Among them, Δ is the acquisition error of the input square wave signal in the corresponding counting result, where |Δ 1 -Δ count |Less than one system clock cycle P system , so the frequency error is: because The frequency error has nothing to do with the frequency of the input square wave signal, but is only related to the gate time and the standard signal frequency, that is, the equal-precision measurement of the entire test frequency band is achieved; The acquisition error of the first counting result of the input square wave signal is Δ 1 -Δ 2 , the collection error of the second counting result is Δ 2 -Δ 3 , the collection error of the third counting result is Δ 3 -Δ 4 , then the cumulative error of the three counting results is: (D 1 -D 2 )+(D 2 -D 3 )+(D 3 -D 4 )=D 1 -D 4 ; The synchronization error of performing multiple consecutive counting by using the equal-precision frequency solving device is less than one system clock cycle P. system , which can achieve equal-precision frequency solution.
2. The equal-precision frequency solving device according to claim 1, It is characterized in that The depth of the data storage FIFO module is determined by the operation period Period of the solution program and the maximum frequency Fre of the input square wave signal. max The configured depth is: Depth=Period×Fre max 。 3. The equal-precision frequency solving device according to claim 2, It is characterized in that The data storage FIFO module is also configured with a FIFO empty flag, which is used to be set to 1 when there is no counting result in the data storage FIFO module, and is set to 0 to indicate that it is not empty.
4. The equal-precision frequency solving device according to claim 3, It is characterized in that The equal-precision solving unit comprises: a data driving module and a frequency solving module; The data driving module is used to store an array of counting results and a counting amount for counting the number of counting results, and is used to determine whether the data storage FIFO module is empty by reading the FIFO empty flag, and when it is not empty, read the counting results in the data storage FIFO module in sequence and store them in the array, and the counting amount is increased by 1 for each counting result stored; The frequency calculation module is used to calculate the average value of all counting results according to the counting results in the array and the counting amount of the counting results when the counting amount is not 0, and calculate the average frequency of the square wave signal in one operation cycle according to the average value of all counting results and the system clock.
5. The equal-precision frequency solving device according to claim 4, It is characterized in that The data driving module is also used for, when it is determined that the data storage FIFO module is empty by reading the FIFO empty flag, the count amount of the counting result in its array is 0, so that the frequency solving module outputs the frequency solving result of the previous operation cycle.
6. A method of equal-precision frequency calculation, It is characterized in that The equal-precision frequency solving method is performed by using the equal-precision frequency solving device as described in any one of claims 1 to 5, the method comprising: counting the period of the input square wave signal, and the solving program solving the frequency of the input square wave signal in each operation cycle thereof, the solving program being pre-configured with a fixed operation cycle; The counting of the cycle of the input square wave signal comprises: counting each cycle of the input square wave signal according to the system clock, recording the counting result of each cycle of the square wave signal and storing them in the data storage FIFO module in sequence; The solving program performs frequency solving on the input square wave signal in each operation cycle thereof, including: The counting result is read from the data storage FIFO module, and the average frequency of the square wave signal in one operation cycle is solved according to the read counting result, the counting amount of the counting result and the system clock; the solving method specifically includes: The frequency is calculated based on all the counting results and the number of counts of the counting results in the square wave signal input within an operation period Period. The frequency solution value is: Among them, N i is the i-th counting result, f system is the system clock frequency; The actual frequency value is: Among them, Δ is the acquisition error of the input square wave signal in the corresponding counting result, where |Δ 1 -Δ count |Less than one system clock cycle P system , so the frequency error is: because The frequency error has nothing to do with the frequency of the input square wave signal, but is only related to the gate time and the standard signal frequency, that is, the equal-precision measurement of the entire test frequency band is achieved; The acquisition error of the first counting result of the input square wave signal is Δ 1 -Δ 2 , the collection error of the second counting result is Δ 2 -Δ 3 , the collection error of the third counting result is Δ 3 -Δ 4 , then the cumulative error of the three counting results is: (D 1 -D 2 )+(D 2 -D 3 )+(D 3 -D 4 )=D 1 -D 4 ; The equal-precision frequency solving method performed by the equal-precision frequency solving device is adopted, by performing multiple consecutive counting with a synchronization error less than one system clock cycle P system , which can achieve equal-precision frequency solution.
7. The equal-precision frequency solving method according to claim 6, It is characterized in that The solving program performs frequency solving on the input signal in each operation thereof, including: a data driving process running through a data driving module, and a frequency solving process running through a frequency solving module; The data-driven process includes: Step 11, initializing the array for storing counting results in the data driver module, and setting the number of counting results to 0; Step 12, reading the FIFO empty flag in the data storage FIFO module, and determining whether the data storage FIFO module is empty; Step 13, if it is determined in step 12 that the data storage FIFO module is not empty, then read the counting result, store the counting result in an array, add 1 to the counting amount of the counting result in the array, and proceed to step 12; if it is determined in step 12 that the data storage FIFO module is empty, then end the data driving process and proceed to the frequency solving process; The frequency solution process includes: Step 21, determine whether the count amount of the counting result is equal to 0; if it is determined that the count amount is 0, then output the frequency solution result of the previous operation cycle, and the frequency solution process ends; if it is determined that the count amount is not 0, then go to step 22; Step 22, when the count amount is not 0, calculate the average value of all counting results according to the count amount of each counting result in the array, and calculate the average frequency of the square wave signal in one operation cycle according to the average value of all counting results and the system clock.
Citation Information
Patent Citations
High-precision frequency acquisition method and device based on FPGA
CN110954745A
