Automatic gain control method
Through the automatic gain control method, the previous and subsequent gains of the magnetic sensor amplification unit are adjusted, and the problem of induced signal fluctuation is solved and the output signal is stabilized.
Patent Information
- Application Number
- CN202510222174.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-06-27
AI Technical Summary
The induction signal of the magnetic sensor fluctuates greatly due to changes in detection distance, resulting in unstable output signal.
Through the automatic gain control method, a preset coarse adjustment and fine adjustment threshold window is provided to adjust the pre-stage and subsequent gains of the automatic gain amplification unit, so that the real-time output signal is maintained in the preset threshold window.
It realizes accurate adjustment of the amplitude of the magnetic sensor induction signal, ensuring the stability of the real-time output signal of the automatic gain amplification unit.
Smart Images

Figure CN120222997A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of gain adjustment, and more particularly to a method for controlling automatic gain. Background Art
[0002] With the rapid development of integrated circuits and the rise of the Internet of Things, magnetic sensors are widely used in various fields. A magnetic sensor can convert a weak magnetic signal into an electrical signal, thereby indirectly detecting physical quantity information related to a magnetic field.
[0003] A magnetic sensor has characteristics such as high sensitivity and a wide dynamic range. However, the induction signal of the magnetic sensor is a weak voltage signal, so an amplifier is required to amplify the weak voltage signal to generate an amplified voltage signal for detecting the weak voltage signal.
[0004] However, because the magnetic sensor has the characteristic of non-contact measurement, its induction signal will fluctuate greatly due to changes in the detection distance. At this time, if the gain of the amplifier remains unchanged, the output signal output by the amplifier after amplifying the fluctuating induction signal is also fluctuating, resulting in an unstable output signal. Summary of the Invention
[0005] The present invention provides a method for controlling automatic gain to solve at least one of the above technical problems.
[0006] The technical solution of the present invention for solving the above technical problems is as follows: A method for controlling automatic gain includes:
[0007] Providing a preset coarse adjustment threshold window;
[0008] Judging whether a real-time output signal provided by an automatic gain amplification unit is within the preset coarse adjustment threshold window;
[0009] When the real-time output signal is not within the preset coarse adjustment threshold window, adjusting the front-stage gain of the automatic gain amplification unit to decrease or increase so that the real-time output signal is within the preset coarse adjustment threshold window;
[0010] Providing a preset fine adjustment threshold window;
[0011] Judging whether the real-time output signal is within the preset fine adjustment threshold window;
[0012] When the real-time output signal is not within the preset fine adjustment threshold window, corresponding to the adjustment process of the front-stage gain, adjusting the post-stage gain of the automatic gain amplification unit to decrease or increase so that the real-time output signal is within the preset fine adjustment threshold window.
[0013] Based on the above technical solution, the present invention can also be improved as follows.
[0014] Further, when the real-time output signal is not within the preset coarse adjustment threshold window, adjusting the pre-stage gain of the automatic gain amplification unit to decrease or increase, such that during the process of bringing the real-time output signal within the preset coarse adjustment threshold window, specifically includes:
[0015] When the real-time output signal is less than the lower limit value of the preset coarse adjustment threshold window, then gradually adjust and increase the pre-stage gain;
[0016] If the real-time output signal is not less than the lower limit value of the preset coarse adjustment threshold window, then stop adjusting and increasing the pre-stage gain.
[0017] Further, during the process of stopping adjusting and increasing the pre-stage gain when the real-time output signal is not less than the lower limit value of the preset coarse adjustment threshold window, it further includes:
[0018] When adjusting the pre-stage gain, if the real-time output signal is always less than the lower limit value of the preset coarse adjustment threshold window, then gradually adjust and increase the pre-stage gain to the maximum value and keep it unchanged.
[0019] Further, when the real-time output signal is not within the preset coarse adjustment threshold window, adjusting the pre-stage gain of the automatic gain amplification unit to decrease or increase, such that during the process of bringing the real-time output signal within the preset coarse adjustment threshold window, specifically includes:
[0020] When the real-time output signal is greater than the upper limit value of the preset coarse adjustment threshold window, then gradually adjust and decrease the pre-stage gain;
[0021] If the real-time output signal is not greater than the upper limit value of the preset coarse adjustment threshold window, then stop adjusting and decreasing the pre-stage gain.
[0022] Further, during the process of stopping adjusting and decreasing the pre-stage gain when the real-time output signal is not greater than the upper limit value of the preset coarse adjustment threshold window, it further includes:
[0023] When adjusting the pre-stage gain, if the real-time output signal is always greater than the upper limit value of the preset coarse adjustment threshold window, then gradually adjust and decrease the pre-stage gain to the minimum value and keep it unchanged.
[0024] Further, when the real-time output signal is not within the preset fine adjustment threshold window, corresponding to the adjustment process of the pre-stage gain, adjusting the post-stage gain of the automatic gain amplification unit to decrease or increase, such that during the process of bringing the real-time output signal within the preset fine adjustment threshold window, specifically includes:
[0025] When the real-time output signal is less than the lower limit value of the preset fine adjustment threshold window, then gradually adjust and increase the post-stage gain;
[0026] If the real-time output signal is not less than the lower limit value of the preset fine-tuning threshold window, stop adjusting and increasing the post-stage gain.
[0027] Further, if the real-time output signal is not less than the lower limit value of the preset fine-tuning threshold window, during the process of stopping adjusting and increasing the post-stage gain, it further includes:
[0028] When adjusting the post-stage gain, if the real-time output signal is always less than the lower limit value of the preset fine-tuning threshold window, gradually adjust the post-stage gain to the maximum value and keep it unchanged.
[0029] Further, after gradually adjusting the post-stage gain to the maximum value and keeping it unchanged when adjusting the post-stage gain, it further includes:
[0030] When the pre-stage gain has not reached the maximum value, adjust the post-stage gain to a first preset gain value and gradually adjust and increase the pre-stage gain until the real-time output signal is not less than the lower limit value of the preset fine-tuning threshold window;
[0031] When the pre-stage gain reaches the maximum value, do not adjust the pre-stage gain and the post-stage gain.
[0032] Further, when the real-time output signal is not within the preset fine-tuning threshold window, during the process of adjusting the post-stage gain corresponding to the adjustment process of the pre-stage gain to decrease or increase the real-time output signal to be within the preset fine-tuning threshold window, it specifically includes:
[0033] When the real-time output signal is greater than the upper limit value of the preset fine-tuning threshold window, gradually adjust and decrease the post-stage gain;
[0034] If the real-time output signal is not greater than the upper limit value of the preset fine-tuning threshold window, stop adjusting and decreasing the post-stage gain;
[0035] If the real-time output signal is not greater than the upper limit value of the preset fine-tuning threshold window, during the process of stopping adjusting and decreasing the post-stage gain, it further includes:
[0036] When adjusting the post-stage gain, if the real-time output signal is always greater than the upper limit value of the preset fine-tuning threshold window, gradually adjust the post-stage gain to the minimum value and keep it unchanged.
[0037] Further, after gradually adjusting the post-stage gain to the minimum value and keeping it unchanged when adjusting the post-stage gain, it further includes:
[0038] When the pre-stage gain has not reached the minimum value, the post-stage gain is adjusted to increase to a second preset gain value, and the pre-stage gain is gradually adjusted to decrease until the real-time output signal is not greater than the upper limit value of the preset fine-tuning threshold window;
[0039] When the pre-stage gain reaches the minimum value, neither the pre-stage gain nor the post-stage gain is adjusted.
[0040] The beneficial effects of the present invention are as follows: An automatic gain control method provided by the present invention adjusts the pre-stage gain of the automatic gain amplification unit by determining that the real-time output signal provided by the automatic gain amplification unit is not within the preset coarse-tuning threshold window to achieve coarse gain adjustment; further, when it is determined that the real-time output signal provided by the automatic gain amplification unit is not within the preset fine-tuning threshold window, the post-stage gain of the automatic gain amplification unit is adjusted to achieve fine gain adjustment. In this way, precise adjustment of the induction signal amplitude can be achieved through the combination of coarse and fine gain adjustments. Therefore, even if the induction signal fluctuates greatly due to changes in the detection distance of the magnetic sensor, the stability of the real-time output signal of the automatic gain amplification unit can be ensured through gain adjustment. Description of the Drawings
[0041] Figure 1 is a flowchart of an automatic gain control method of the present invention;
[0042] Figure 2 is a flowchart of adjusting the pre-stage gain;
[0043] Figure 3 is another flowchart of adjusting the pre-stage gain;
[0044] Figure 4 is a flowchart of adjusting the post-stage gain;
[0045] Figure 5 is another flowchart of adjusting the post-stage gain;
[0046] Figure 6 is a schematic diagram of an automatic gain control method of the present invention. Detailed Embodiments
[0047] The principles and features of the present invention are described below with reference to the accompanying drawings. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0048] As Figure 1 shown, an automatic gain control method includes:
[0049] S1, providing a preset coarse-tuning threshold window;
[0050] S2, determine whether the real-time output signal provided by the automatic gain amplification unit is within the preset coarse adjustment threshold window;
[0051] S3, when the real-time output signal is not within the preset coarse adjustment threshold window, adjust the pre-stage gain of the automatic gain amplification unit to decrease or increase, so that the real-time output signal is within the preset coarse adjustment threshold window;
[0052] S4, provide a preset fine adjustment threshold window;
[0053] S5, determine whether the real-time output signal is within the preset fine adjustment threshold window;
[0054] S6, when the real-time output signal is not within the preset fine adjustment threshold window, corresponding to the adjustment process of the pre-stage gain, adjust the post-stage gain of the automatic gain amplification unit to decrease or increase, so that the real-time output signal is within the preset fine adjustment threshold window.
[0055] In a method for controlling automatic gain in the present invention, the automatic gain amplification unit is an amplification device for amplifying the induction signal of a magnetic sensor, which includes a cascaded pre-stage amplifier and a post-stage amplifier. The gain of the pre-stage amplifier is called the pre-stage gain A1, and the gain of the post-stage amplifier is called the post-stage gain A2. The gain is a device parameter related to the amplification multiple of the amplifier; among them, the amplification multiple of the pre-stage amplifier is larger, the amplification multiple of the post-stage amplifier is smaller, and the amplification multiple of the pre-stage amplifier is greater than that of the post-stage amplifier. The method of the present invention adjusts the pre-stage gain of the automatic gain amplification unit by judging that the real-time output signal provided by the automatic gain amplification unit is not within the preset coarse adjustment threshold window to achieve coarse adjustment of the gain; further, when it is judged that the real-time output signal provided by the automatic gain amplification unit is not within the preset fine adjustment threshold window, the post-stage gain of the automatic gain amplification unit is adjusted to achieve fine adjustment of the gain. In this way, precise adjustment of the amplitude of the induction signal can be achieved through the combination of coarse and fine gain adjustments. Therefore, even if the induction signal fluctuates greatly due to changes in the detection distance of the magnetic sensor, the stability of the real-time output signal of the automatic gain amplification unit can be ensured through gain adjustment.
[0056] In some embodiments, as Figure 6 shown, before adjusting the pre-stage gain of the automatic gain amplification unit according to the real-time output signal of the automatic gain amplification unit, it includes: initializing the pre-stage gain A1 and the post-stage gain A2.
[0057] Specifically, the pre-stage gain A1 and the post-stage gain A2 in the automatic gain amplification unit have a certain range. The pre-stage gain A1 can be adjusted between the minimum value A1min of the pre-stage gain and the maximum value A1max of the pre-stage gain, and the post-stage gain A2 can be adjusted between the minimum value A2min of the post-stage gain and the maximum value A2max of the post-stage gain. Before adjusting the pre-stage gain A1, it is necessary to initialize the pre-stage gain A1 and the post-stage gain A2, that is, it is necessary to assign certain initial values to the pre-stage gain A1 and the post-stage gain A2. Since the present invention adjusts the pre-stage gain A1 first, it is best to ensure that the post-stage gain A2 has a reasonable value before adjusting the pre-stage gain A1 to simplify the subsequent gain adjustment process; in this embodiment, before adjusting the pre-stage gain A1, the post-stage gain A2 can be set to the intermediate value a2 of the post-stage gain, that is, set A2 = a2; the intermediate value a2 of the post-stage gain is the intermediate value between the minimum value A2min of the post-stage gain and the maximum value A2max of the post-stage gain. In addition, for the initialization of the pre-stage gain A1, the pre-stage gain A1 can be set to any preset pre-stage gain value a1 between the minimum value A1min of the pre-stage gain and the maximum value A1max of the pre-stage gain according to experience, that is, the pre-stage gain A1 is reasonably set according to needs.
[0058] In some embodiments, such as Figure 2 shown, when the real-time output signal is not within the preset coarse adjustment threshold window, adjusting the pre-stage gain of the automatic gain amplification unit to decrease or increase, so that in the process of making the real-time output signal within the preset coarse adjustment threshold window, specifically includes:
[0059] S31, when the real-time output signal is less than the lower limit value of the preset coarse adjustment threshold window, then gradually adjust and increase the pre-stage gain;
[0060] S32a, if the real-time output signal is not less than the lower limit value of the preset coarse adjustment threshold window, then stop adjusting and increasing the pre-stage gain.
[0061] Specifically, the preset coarse adjustment threshold window has a lower limit value target1 min and an upper limit value target1 max . In the process of adjusting the pre-stage gain, as Figure 6 shown, it is first necessary to determine whether the real-time output signal Vout is within the preset coarse adjustment threshold window, that is, to determine whether target1 min ≤Vout≤target1 max holds. If target1 min ≤Vout≤target1 maxIt holds, which indicates that the current pre-stage gain A1 setting is reasonable. Then, the pre-stage gain A1 is not adjusted, that is, the pre-stage gain A1 remains unchanged, which can be expressed by the formula as A1 = A1.
[0062] If target1 min ≤ Vout ≤ target1 max does not hold, it means that the current pre-stage gain A1 setting is unreasonable, and the pre-stage gain A1 needs to be adjusted. Whether to increase or decrease the pre-stage gain A1 depends on whether the real-time output signal Vout is less than the lower limit value target1 of the preset coarse adjustment threshold window min or greater than the upper limit value target1 of the preset coarse adjustment threshold window max ; Therefore, after determining whether target1 min ≤ Vout ≤ target1 max holds, it is also necessary to determine whether the real-time output signal Vout is less than the lower limit value of the preset coarse adjustment threshold window, that is, to determine whether Vout < target1 min holds. In another embodiment, it can also be determined whether the real-time output signal Vout is greater than the upper limit value target1 of the preset coarse adjustment threshold window max , that is, to determine whether Vout < target1 min holds.
[0063] When Vout < target1 min holds, it means that the current pre-stage gain A1 is small. Therefore, it is necessary to increase the pre-stage gain A1. Before increasing the pre-stage gain A1, it is also necessary to determine whether there is room to increase the pre-stage gain A1. In this embodiment, it is determined whether there is room to increase the pre-stage gain A1 by determining whether the pre-stage gain A1 is less than the maximum pre-stage gain A1max, that is, to determine whether A1 < A1max holds; if A1 < A1max does not hold, it means that the current pre-stage gain A1 is the maximum pre-stage gain A1max, and it does not have room to increase, so the pre-stage gain A1 remains unchanged, that is, A1 = A1; if A1 < A1max holds, it means that the current pre-stage gain A1 has room to increase, then the pre-stage gain A1 is increased by a preset step, that is, A1 = A1 + 1; after increasing the pre-stage gain A1 by a preset step, then return to the beginning to re-determine whether target1 min ≤ Vout ≤ target1 max holds.
[0064] Through the above loop judgment and adjustment, a pre-stage gain A1 can be quickly and easily found, so that the real-time output signal Vout less than the lower limit value target1 of the preset coarse adjustment threshold window min is within the preset coarse adjustment threshold window.
[0065] Since the amplification factor of the pre - amplifier is relatively large, when adjusting the pre - stage gain A1 in a preset step, the amplitude of the real - time output signal Vout can change significantly. Therefore, the adjustment of the pre - stage gain A1 is the coarse gain adjustment of the entire automatic gain amplification unit.
[0066] By comparing the real - time output signal Vout with the preset coarse - adjustment threshold window, it is possible to quickly determine whether the pre - stage gain A1 needs to be adjusted and the adjustment direction of the pre - stage gain A1; during the process of adjusting the pre - stage gain A1, gradually adjusting in a preset step can prevent the pre - stage gain A1 from being adjusted too large and ensure the accuracy of the adjustment of the pre - stage gain A1.
[0067] In some embodiments, as Figure 2 shown, when the real - time output signal is not less than the lower limit value of the preset coarse - adjustment threshold window, during the process of stopping adjusting and increasing the pre - stage gain, it further includes:
[0068] S32b, when adjusting the pre - stage gain, if the real - time output signal is always less than the lower limit value of the preset coarse - adjustment threshold window, then gradually adjust and increase the pre - stage gain to the maximum value and keep it unchanged.
[0069] Specifically, even if a pre - stage gain A1 cannot be found such that the real - time output signal Vout less than the lower limit value target1 of the preset coarse - adjustment threshold window is within the preset coarse - adjustment threshold window, the pre - stage gain A1 also needs to be adjusted to the maximum pre - stage gain A1max so that the real - time output signal Vout is as close as possible to the lower limit value target1 of the preset coarse - adjustment threshold window min min min .
[0070] After completing the adjustment of the pre - stage gain A1, the post - stage gain adjustment process can be entered.
[0071] In some embodiments, as Figure 3 shown, when the real - time output signal is not within the preset coarse - adjustment threshold window, adjusting the pre - stage gain of the automatic gain amplification unit to decrease or increase so that the real - time output signal is within the preset coarse - adjustment threshold window specifically includes:
[0072] S31′, when the real - time output signal is greater than the upper limit value of the preset coarse - adjustment threshold window, then gradually adjust and decrease the pre - stage gain;
[0073] S32a′, if the real - time output signal is not greater than the upper limit value of the preset coarse - adjustment threshold window, then stop adjusting and decreasing the pre - stage gain.
[0074] Specifically, it has been described above that the real-time output signal Vout is less than the lower limit value target1 of the preset coarse adjustment threshold window min In this case, of course, there is also a situation where the real-time output signal Vout is greater than the upper limit value target1 of the preset coarse adjustment threshold window max In this case
[0075] When the real-time output signal Vout is greater than the upper limit value target1 of the preset coarse adjustment threshold window max it indicates that the current pre-stage gain A1 is relatively large. Therefore, it is necessary to reduce the pre-stage gain A1. Before reducing the pre-stage gain A1, it is also necessary to determine whether there is room to reduce the pre-stage gain A1. As Figure 6 shown, in this embodiment, it is determined whether there is room to reduce the pre-stage gain A1 by determining whether the pre-stage gain A1 is greater than the minimum value of the pre-stage gain A1, that is, by determining whether A1 > A1 min holds; if A1 > A1 min does not hold, it means that the current pre-stage gain A1 is the minimum value A1min of the pre-stage gain, and it does not have room to be reduced. The pre-stage gain A1 cannot be reduced any further. Therefore, the pre-stage gain A1 remains unchanged, that is, A1 = A1; if A1 > A1 min holds, it means that the current pre-stage gain A1 has room to be reduced. Then the pre-stage gain A1 is reduced by a preset step, that is, A1 = A1 - 1; after reducing the pre-stage gain A1 by a preset step, it returns to the beginning to re-determine whether min target1 ≤ Vout ≤ target1 max holds
[0076] Through the above loop judgment and adjustment, a pre-stage gain A1 can be quickly and easily found to make the real-time output signal Vout greater than the upper limit value target1 max within the preset coarse adjustment threshold window
[0077] Since the amplification factor of the pre-stage amplifier is relatively large, when adjusting the pre-stage gain A1 by a preset step, the amplitude of the real-time output signal Vout can change significantly. Therefore, the adjustment of the pre-stage gain A1 is the coarse gain adjustment of the entire automatic gain amplification unit
[0078] By comparing the real-time output signal Vout with the preset coarse adjustment threshold window, it can be quickly determined whether it is necessary to adjust the pre-stage gain A1 and the adjustment direction of the pre-stage gain A1; during the process of adjusting the pre-stage gain A1, it is gradually adjusted by a preset step, which can avoid excessive adjustment of the pre-stage gain A1 and ensure the accuracy of the adjustment of the pre-stage gain A1
[0079] In some embodiments, such as Figure 3As shown, if the real-time output signal is not greater than the upper limit value of the preset coarse adjustment threshold window, during the process of stopping the adjustment and reducing the pre-stage gain, it further includes:
[0080] S32b′, when adjusting the pre-stage gain, if the real-time output signal is always greater than the upper limit value of the preset coarse adjustment threshold window, then gradually reduce the pre-stage gain to the minimum value and keep it unchanged.
[0081] Specifically, even if a pre-stage gain A1 greater than the upper limit value target1 of the preset coarse adjustment threshold window cannot be found max such that the real-time output signal Vout is within the preset coarse adjustment threshold window, the pre-stage gain A1 also needs to be adjusted to the minimum pre-stage gain A1min to make the real-time output signal Vout as close as possible to the upper limit value target1 of the preset coarse adjustment threshold window max .
[0082] After completing the adjustment of the pre-stage gain A1, the post-stage gain adjustment process can be entered.
[0083] In some embodiments, as Figure 4 shown, when the real-time output signal is not within the preset fine adjustment threshold window, corresponding to the adjustment process of the pre-stage gain, adjust the post-stage gain of the automatic gain amplifier unit to decrease or increase, so that during the process of making the real-time output signal within the preset fine adjustment threshold window, it specifically includes:
[0084] S61, when the real-time output signal is less than the lower limit value of the preset fine adjustment threshold window, then gradually adjust and increase the post-stage gain;
[0085] S62a, if the real-time output signal is not less than the lower limit value of the preset fine adjustment threshold window, then stop adjusting and increasing the post-stage gain.
[0086] Specifically, the preset fine adjustment threshold window has a lower limit value target2 min and an upper limit value target2 max . During the process of adjusting the post-stage gain A2, as Figure 6 shown, first it is necessary to determine whether the real-time output signal Vout is within the preset fine adjustment threshold window, that is, to determine whether target2 min ≤Vout≤target2 max holds. If target2 min ≤Vout≤target2 max holds, at this time it indicates that the current setting of the post-stage gain A2 is reasonable, then the post-stage gain A2 is not adjusted, that is, the post-stage gain A2 is kept unchanged, which is expressed by the formula as A2 = A2.
[0087] If target2min target2 ≤ Vout ≤ target2 max If it does not hold, it means that the current setting of the post-stage gain A2 is unreasonable, and the post-stage gain A2 needs to be adjusted. Whether to increase or decrease the post-stage gain A2 depends on whether the real-time output signal Vout is less than the lower limit value target2 of the preset fine-tuning threshold window min or greater than the upper limit value target2 of the preset fine-tuning threshold window max ; Therefore, after determining whether target2 min ≤ Vout ≤ target2 max holds, it is also necessary to determine whether the real-time output signal Vout is less than the lower limit value target2 of the preset fine-tuning threshold window min , that is, to determine whether Vout < target2 min holds; In another embodiment, it is also possible to determine whether the real-time output signal Vout is greater than the upper limit value target2 of the preset fine-tuning threshold window max .
[0088] When Vout < target2 min holds, it means that the current post-stage gain A2 is small, so the post-stage gain A2 needs to be increased. Before increasing the post-stage gain A2, it is also necessary to determine whether there is room to increase the post-stage gain A2. In this embodiment, it is determined whether there is room to increase the post-stage gain by determining whether the post-stage gain A2 is less than the maximum post-stage gain A2max, that is, to determine whether A2 < A2max holds; If A2 < A2max does not hold, it means that the current post-stage gain A2 is the maximum post-stage gain A2max, and it does not have room to increase, and the post-stage gain A2 cannot be increased anymore. Therefore, the pre-stage gain A1 and the post-stage gain A2 need to be adjusted comprehensively according to the pre-stage gain A1; If A2 < A2max holds, it means that the current post-stage gain A2 has room to increase, then the post-stage gain A2 is increased by a preset step, that is, A2 = A2 + 1; After increasing the post-stage gain A2 by a preset step, return to the beginning to re-determine whether min target2 ≤ Vout ≤ target2 max holds.
[0089] Through the above loop judgment and adjustment, it is easy and fast to find a post-stage gain A2 such that the real-time output signal Vout less than the lower limit value target2 of the preset fine-tuning threshold window min is within the preset fine-tuning threshold window.
[0090] Since the amplification factor of the post-stage amplifier is small, when adjusting the post-stage gain A2 in a preset step, the amplitude of the real-time output signal Vout can change slightly. Therefore, the adjustment of the post-stage gain A2 is the fine gain adjustment of the entire automatic gain amplification unit.
[0091] By comparing the real-time output signal Vout with the preset fine-tuning threshold window, it can be quickly determined whether the post-stage gain A2 needs to be adjusted and the adjustment direction of the post-stage gain A2; during the process of adjusting the post-stage gain A2, gradually adjusting in a preset step can prevent the post-stage gain A2 from being adjusted too much and ensure the accuracy of the adjustment of the pre-stage gain A2.
[0092] In some embodiments, as Figure 4 shown, if the real-time output signal is not less than the lower limit value of the preset fine-tuning threshold window, during the process of stopping adjusting and increasing the post-stage gain, it further includes:
[0093] S62b, when adjusting the post-stage gain, if the real-time output signal is always less than the lower limit value of the preset fine-tuning threshold window, then gradually adjust the post-stage gain to the maximum value and keep it unchanged.
[0094] Specifically, even if a post-stage gain cannot be found such that the real-time output signal Vout less than the lower limit value target2 of the preset fine-tuning threshold window is within the preset fine-tuning threshold window, the post-stage gain A2 also needs to be adjusted to the maximum post-stage gain value A2max to make the real-time output signal Vout as close as possible to the lower limit value target2 of the preset fine-tuning threshold window min min min .
[0095] In some embodiments, as Figure 4 shown, after gradually adjusting the post-stage gain to the maximum value and keeping it unchanged when adjusting the post-stage gain, it further includes:
[0096] S63a, when the pre-stage gain has not reached the maximum value, then adjust the post-stage gain to a first preset gain value and gradually increase the pre-stage gain until the real-time output signal is not less than the lower limit value of the preset fine-tuning threshold window;
[0097] S63b, when the pre-stage gain reaches the maximum value, then do not adjust the pre-stage gain and the post-stage gain.
[0098] Specifically, when the post-stage gain A2 is gradually increased to the maximum post-stage gain value A2max, the post-stage gain A2 no longer has room to increase. If the real-time output signal Vout is still less than the lower limit value of the preset fine-tuning threshold window at this time, that is, Vout < target2 min, it is necessary to comprehensively adjust the pre-stage gain A1 and the post-stage gain A2 according to the pre-stage gain A1. The specific process of comprehensively adjusting the pre-stage gain A1 and the post-stage gain A2 according to the pre-stage gain A2 is as Figure 6 shown. First, it is necessary to determine whether the pre-stage gain A1 reaches the pre-stage gain maximum value A1max. In this embodiment, it is determined whether the pre-stage gain A1 reaches the pre-stage gain maximum value A1max by determining whether the pre-stage gain A1 is less than the pre-stage gain maximum value A1max, that is, to determine whether A1 < A1max holds.
[0099] If A1 < A1max holds, it means that the pre-stage gain A1 has room for increasing. Then, the pre-stage gain A1 is increased by a preset step, that is, A1 = A1 + 1, to compensate for the deficiency in the adjustment of the post-stage gain A2; since the adjustment of the pre-stage gain A1 is a coarse gain adjustment, increasing the pre-stage gain A1 by a preset step at this time will cause the gain to change too much, and further make the real-time output signal Vout greater than the upper limit value target2 of the preset fine-tuning threshold window max , therefore, in order to avoid excessive compensation caused by adjusting the pre-stage gain A1 during the process of adjusting the post-stage gain A2, while increasing the pre-stage gain A1 by a preset step, the post-stage gain A2 also needs to be reduced to the first preset gain value a3, that is, A2 = a3.
[0100] If A1 < A1max does not hold, it means that the pre-stage gain A1 is already the pre-stage gain maximum value A1max and it has no room for increasing; therefore, the pre-stage gain A1 and the post-stage gain A2 are kept unchanged. At this time, the pre-stage gain A1 is the pre-stage gain maximum value A1max, and the post-stage gain A2 is the post-stage gain maximum value A2max.
[0101] In some embodiments, as Figure 5 shown, when the real-time output signal is not within the preset fine-tuning threshold window, corresponding to the adjustment process of the pre-stage gain, adjusting the post-stage gain of the automatic gain amplification unit to decrease or increase, so that during the process of making the real-time output signal within the preset fine-tuning threshold window, specifically includes:
[0102] S61′, when the real-time output signal is greater than the upper limit value of the preset fine-tuning threshold window, then gradually adjust to decrease the post-stage gain;
[0103] S62a′, if the real-time output signal is not greater than the upper limit value of the preset fine-tuning threshold window, then stop adjusting to decrease the post-stage gain.
[0104] Specifically, it has been explained above that the real-time output signal Vout is less than the lower limit value target2 of the preset fine-tuning threshold window min of the situation. Of course, there is also the situation where the real-time output signal Vout is greater than the upper limit value target2 of the preset fine-tuning threshold window maxCase.
[0105] When the real-time output signal Vout is greater than the upper limit value target2 of the preset fine-tuning threshold window max it indicates that the current post-stage gain A2 is relatively large. Therefore, it is necessary to reduce the post-stage gain A2. Before reducing the post-stage gain A2, it is also necessary to determine whether there is room to reduce the post-stage gain A2. As Figure 6 shown, in this embodiment, it is determined whether there is room to reduce the post-stage gain A2 by determining whether the post-stage gain A2 is greater than the minimum post-stage gain A2min, that is, by determining whether A2 > A2 min holds; if A2 > A2 min does not hold, it means that the current post-stage gain A2 is the minimum post-stage gain A2 min , and it does not have room to be reduced. The post-stage gain A2 cannot be further reduced. Therefore, subsequently, it is necessary to comprehensively adjust the pre-stage gain A1 and the post-stage gain A2 according to the pre-stage gain A1; if A2 > A2 min holds, it means that the current post-stage gain A2 has room to be reduced. Then, the post-stage gain A2 is reduced by a preset step, that is, A2 = A2 - 1; after reducing the post-stage gain A2 by a preset step, it returns to the beginning to re-determine whether min target2 ≤ Vout ≤ target2 max holds.
[0106] Through the above loop judgment and adjustment, it is possible to easily and quickly find a post-stage gain A2 such that the real-time output signal Vout greater than the upper limit value target2 of the preset fine-tuning threshold window max is within the preset fine-tuning threshold window.
[0107] Since the amplification factor of the post-stage amplifier is small, when adjusting the post-stage gain A2 by a preset step, the amplitude of the real-time output signal Vout can change slightly. Therefore, the adjustment of the post-stage gain A2 is the gain fine-tuning of the entire automatic gain amplification unit.
[0108] By comparing the real-time output signal Vout with the preset fine-tuning threshold window, it is possible to quickly determine whether it is necessary to adjust the post-stage gain A2 and the adjustment direction of the post-stage gain A2; during the process of adjusting the post-stage gain A2, adjusting step by step with a preset step can avoid excessive adjustment of the post-stage gain A2 and ensure the accuracy of the adjustment of the pre-stage gain A2.
[0109] In some embodiments, as Figure 5 shown, if the real-time output signal is not greater than the upper limit value of the preset fine-tuning threshold window, during the process of stopping the adjustment to reduce the post-stage gain, it further includes:
[0110] S62b′, when adjusting the post-stage gain, if the real-time output signal is always greater than the upper limit value of the preset fine-tuning threshold window, then gradually adjust the post-stage gain to decrease to the minimum value and keep it unchanged.
[0111] Specifically, even if a post-stage gain A2 greater than the upper limit value target2 of the preset fine-tuning threshold window cannot be found max and the real-time output signal Vout is within the preset fine-tuning threshold window, the post-stage gain A2 still needs to be adjusted to the minimum post-stage gain A2min so that the real-time output signal Vout is as close as possible to the upper limit value target2 of the preset fine-tuning threshold window. max .
[0112] In some embodiments, as Figure 5 shown, after gradually adjusting the post-stage gain to decrease to the minimum value and keep it unchanged when adjusting the post-stage gain, it further includes:
[0113] S63a′, when the pre-stage gain has not reached the minimum value, then adjust the post-stage gain to increase to the second preset gain value, and gradually adjust and decrease the pre-stage gain until the real-time output signal is not greater than the upper limit value of the preset fine-tuning threshold window;
[0114] S63b′, when the pre-stage gain reaches the minimum value, then do not adjust the pre-stage gain and the post-stage gain.
[0115] Specifically, when the post-stage gain A2 is gradually adjusted to the minimum post-stage gain, the post-stage gain A2 no longer has room to be adjusted downward. If the real-time output signal Vout is still greater than the upper limit value target2 of the preset fine-tuning threshold window at this time max , then it is necessary to comprehensively adjust the pre-stage gain A1 and the post-stage gain A2 according to the pre-stage gain A1. The specific process of comprehensively adjusting the pre-stage gain A1 and the post-stage gain A2 according to the pre-stage gain A1 is as Figure 6 shown. First, it is necessary to determine whether the pre-stage gain A1 has reached the minimum pre-stage gain A1min. In this embodiment, it is determined whether the pre-stage gain A1 has reached the minimum pre-stage gain A1min by determining whether the pre-stage gain A1 is greater than the minimum pre-stage gain A1min, that is, to determine whether A1 > A1min holds. If A1 > A1min holds, then adjust the pre-stage gain A1 down by a preset step, that is, A1 = A1 - 1, to compensate for the insufficiency of the adjustment of the post-stage gain A2; since the adjustment of the pre-stage gain A1 is a rough gain adjustment, adjusting the pre-stage gain A1 down by a preset step at this time will cause the gain change to be too large, and then the real-time output signal Vout will be less than the lower limit value target2 of the preset fine-tuning threshold window. min, therefore, in order to avoid excessive compensation caused by adjusting the pre-stage gain A1 during the process of adjusting the post-stage gain A2, while reducing the pre-stage gain A1 by a preset step, it is also necessary to increase the post-stage gain A2 to a second preset gain value a4.
[0116] If A1 > A1min does not hold, it means that the pre-stage gain A1 is already the minimum pre-stage gain A1min and there is no room for reduction; therefore, keep the pre-stage gain A1 and the post-stage gain A2 unchanged. At this time, the pre-stage gain A1 is the minimum pre-stage gain A1min, and the post-stage gain A2 is the minimum post-stage gain A2max.
[0117] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for controlling automatic gain, characterized in that: include: Provides a preset coarse adjustment threshold window; Determining whether the real-time output signal provided by the automatic gain amplifier unit is within the preset coarse adjustment threshold window; When the real-time output signal is not within the preset coarse adjustment threshold window, adjusting the pre-stage gain of the automatic gain amplification unit to decrease or increase so that the real-time output signal is within the preset coarse adjustment threshold window; Provides preset fine-tuning threshold window; Determining whether the real-time output signal is within the preset fine-tuning threshold window; When the real-time output signal is not within the preset fine-tuning threshold window, the subsequent-stage gain of the automatic gain amplification unit is adjusted to decrease or increase in accordance with the adjustment process of the previous-stage gain, so that the real-time output signal is within the preset fine-tuning threshold window.
2. The automatic gain control method according to claim 1, characterized in that: When the real-time output signal is not within the preset coarse adjustment threshold window, the process of adjusting the pre-stage gain of the automatic gain amplifier unit to decrease or increase so that the real-time output signal is within the preset coarse adjustment threshold window specifically includes: When the real-time output signal is less than the lower limit of the preset coarse adjustment threshold window, the pre-stage gain is gradually adjusted and increased; If the real-time output signal is not less than the lower limit of the preset coarse adjustment threshold window, the adjustment is stopped to increase the pre-stage gain.
3. The automatic gain control method according to claim 2, characterized in that: If the real-time output signal is not less than the lower limit of the preset coarse adjustment threshold window, the process of stopping adjusting and increasing the pre-stage gain also includes: When adjusting the pre-stage gain, if the real-time output signal is always smaller than the lower limit of the preset coarse adjustment threshold window, the pre-stage gain is gradually adjusted to increase to a maximum value and remains unchanged.
4. The automatic gain control method according to claim 1, characterized in that: When the real-time output signal is not within the preset coarse adjustment threshold window, the process of adjusting the pre-stage gain of the automatic gain amplifier unit to decrease or increase so that the real-time output signal is within the preset coarse adjustment threshold window specifically includes: When the real-time output signal is greater than the upper limit of the preset coarse adjustment threshold window, the pre-stage gain is gradually adjusted and reduced; If the real-time output signal is not greater than the upper limit of the preset coarse adjustment threshold window, the adjustment is stopped to reduce the pre-stage gain.
5. The automatic gain control method according to claim 4, characterized in that: If the real-time output signal is not greater than the upper limit of the preset coarse adjustment threshold window, the process of stopping adjusting and reducing the pre-stage gain also includes: When adjusting the pre-stage gain, if the real-time output signal is always greater than the upper limit value of the preset coarse adjustment threshold window, the pre-stage gain is gradually reduced to a minimum value and remains unchanged.
6. The automatic gain control method according to claim 1, characterized in that: When the real-time output signal is not within the preset fine adjustment threshold window, corresponding to the adjustment process of the pre-stage gain, adjusting the post-stage gain of the automatic gain amplification unit to decrease or increase so that the real-time output signal is within the preset fine adjustment threshold window specifically includes: When the real-time output signal is less than the lower limit of the preset fine-tuning threshold window, the subsequent stage gain is gradually adjusted and increased; If the real-time output signal is not less than the lower limit of the preset fine adjustment threshold window, the adjustment is stopped to increase the subsequent stage gain.
7. The automatic gain control method according to claim 6, characterized in that: If the real-time output signal is not less than the lower limit of the preset fine adjustment threshold window, the process of stopping adjusting and increasing the subsequent stage gain also includes: When adjusting the subsequent stage gain, if the real-time output signal is always smaller than the lower limit of the preset fine adjustment threshold window, the subsequent stage gain is gradually adjusted to increase to a maximum value and remains unchanged.
8. The automatic gain control method according to claim 7, characterized in that: When adjusting the latter stage gain, after gradually adjusting the latter stage gain to increase to a maximum value and keeping it unchanged, the method further includes: When the front-stage gain has not reached the maximum value, the rear-stage gain is adjusted to be reduced to a first preset gain value, and the front-stage gain is gradually adjusted to be increased until the real-time output signal is not less than the lower limit value of the preset fine-tuning threshold window; When the front-stage gain reaches the maximum value, the front-stage gain and the rear-stage gain are not adjusted.
9. The automatic gain control method according to claim 1, characterized in that: When the real-time output signal is not within the preset fine adjustment threshold window, corresponding to the adjustment process of the pre-stage gain, adjusting the post-stage gain of the automatic gain amplification unit to decrease or increase so that the real-time output signal is within the preset fine adjustment threshold window specifically includes: When the real-time output signal is greater than the upper limit of the preset fine-tuning threshold window, the subsequent stage gain is gradually adjusted and reduced; If the real-time output signal is not greater than the upper limit of the preset fine-tuning threshold window, then stop adjusting and reduce the subsequent stage gain; If the real-time output signal is not greater than the upper limit of the preset fine adjustment threshold window, the process of stopping adjusting and reducing the subsequent stage gain also includes: When adjusting the subsequent stage gain, if the real-time output signal is always greater than the upper limit value of the preset fine adjustment threshold window, the subsequent stage gain is gradually adjusted to be reduced to the minimum value and remains unchanged.
10. The automatic gain control method according to claim 9, characterized in that: When adjusting the latter stage gain, after gradually adjusting the latter stage gain to a minimum value and keeping it unchanged, the method further includes: When the front-stage gain does not reach the minimum value, the rear-stage gain is adjusted to increase to a second preset gain value, and the front-stage gain is gradually adjusted to decrease until the real-time output signal is no greater than the upper limit value of the preset fine-tuning threshold window; When the front-stage gain reaches the minimum value, the front-stage gain and the rear-stage gain are not adjusted.