Resistance adjusting method, sensor, device and equipment
By using an adjustable resistor module composed of parallel digital potentiometers, combined with binary search and local search, the problems of accuracy and flexibility in resistance adjustment in sensor circuits are solved, achieving efficient and low-cost resistance adjustment.
Patent Information
- Application Number
- CN202511505682.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-21
- Publication Date
- 2026-02-10
AI Technical Summary
In the existing technology, the resolution of a single digital potentiometer is limited, making it difficult to meet the ultra-fine adjustment requirements of sensor circuits. In addition, high-precision dedicated potentiometers are expensive and have limited models, making it difficult to flexibly adapt to diverse circuit designs.
An adjustable resistor module consisting of a first digital potentiometer and a second digital potentiometer connected in parallel is used to form a set of resistance ranges. By combining binary search and local search, the target resistance value is quickly approximated, achieving high-precision resistance adjustment.
While ensuring adjustment accuracy, it significantly reduces the number of adjustments and communication overhead, lowers system costs, enhances circuit design flexibility, and achieves fast and accurate resistance adjustment.
Smart Images

Figure CN121501083A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic circuit technology, specifically to a resistance adjustment method, sensor, device, and equipment. Background Technology
[0002] In electronic circuit design, especially in sensor-related circuits, digital potentiometers are widely used for precise fine-tuning in calibration, biasing, and threshold setting. The accuracy and stability of a sensor directly depend on the fineness of these adjustments. However, the resolution of a single digital potentiometer is inherently limited by the number of segments in its internal resistor array, and its minimum step value often falls short of meeting such ultra-fine adjustment requirements.
[0003] Traditional solutions utilize dedicated high-precision digital potentiometers with higher resolution and more ranges. These dedicated devices directly reduce the minimum step value of the potentiometer by increasing the number of segments in the internal resistor array, thereby achieving higher adjustment accuracy on a single device.
[0004] However, these high-precision dedicated potentiometers not only have significantly higher procurement costs than general-purpose models, making them unsuitable for deployment in cost-sensitive sensor products, but their available models and resistance value ranges are also relatively limited, making it difficult to flexibly adapt to diverse sensor circuit designs. Therefore, how to achieve high-precision resistance adjustment while maintaining low cost and high flexibility has become an urgent technical problem to be solved. Summary of the Invention
[0005] In view of the above problems, this application provides a resistance adjustment method, sensor, device and equipment to solve the above technical problems.
[0006] In a first aspect, this application provides a resistance adjustment method applied to an adjustable resistance module composed of a first digital potentiometer and a second digital potentiometer connected in parallel, wherein the adjustable resistance module has multiple resistance level combinations, each resistance level combination corresponding to an equivalent resistance value of the adjustable resistance module; the resistance adjustment method includes: The plurality of resistance range combinations are monotonically arranged according to their corresponding equivalent resistance values to form a resistance range set. The adjustable resistor module is configured according to the resistance range combination at the middle position of the resistance range set, and the first parameter generated by the adjustable resistor module is obtained. Compare the target parameter with the first parameter, and perform a binary search in the first or second sub-interval of the resistance range set according to the comparison result. In each binary search, set the adjustable resistor module according to the selected resistance range combination until the second parameter generated by the adjustable resistor module that meets the preset conditions is obtained. Centered on the resistance range combination corresponding to the second parameter, a set number of adjacent resistance range combinations are selected from the resistance range set to form a local search range; The adjustable resistor module is set according to all resistance range combinations within the local search range, all parameters generated by the adjustable resistor module are obtained, and the resistance range combination corresponding to the parameter closest to the target parameter is selected to set the adjustable resistor module. Wherein, the first sub-interval is: all resistance range combinations from the start position to the middle position of the resistance range set; the second sub-interval is: all resistance range combinations from the middle position to the end position of the resistance range set; the preset condition is: the deviation between the second parameter and the target parameter is within a preset allowable range.
[0007] In some embodiments, the step of monotonically arranging the plurality of resistance range combinations according to their corresponding equivalent resistance values to form a resistance range set includes: Enumerate all resistance range combinations of the adjustable resistor module and obtain the equivalent resistance value corresponding to each resistance range combination; Based on the target resistance adjustment range, select all resistance range combinations that conform to the target resistance adjustment range from all the equivalent resistance values; Remove redundant resistance range combinations with repeated equivalent resistance values, and arrange all remaining resistance range combinations in ascending or descending order according to their corresponding equivalent resistance values to form the resistance range set.
[0008] In some embodiments, in the step of setting the adjustable resistor module according to the resistance range combination at the middle position of the resistance range set and obtaining the first parameter generated by the adjustable resistor module, When the resistor range set includes an even number of resistor range combinations, select any one of the two resistor range combinations in the middle position of the resistor range set to set the adjustable resistor module. When the resistance range set includes an odd number of resistance range combinations, the adjustable resistor module is set by selecting a resistance range combination in the middle of the resistance range set.
[0009] In some embodiments, the step of performing a binary search in the first sub-interval or the second sub-interval of the resistance range set based on the comparison result includes: When the resistance range set is arranged in ascending order according to the equivalent resistance values corresponding to the resistance range combinations, then: When the target parameter is greater than the first parameter, perform a binary search in the second sub-interval; When the target parameter is less than the first parameter, perform a binary search in the first sub-interval; When the resistance range set is arranged in descending order according to the equivalent resistance values corresponding to the resistance range combinations, then: When the target parameter is greater than the first parameter, perform a binary search in the first sub-interval; When the target parameter is less than the first parameter, a binary search is performed in the second sub-interval.
[0010] In some embodiments, in the step of selecting a predetermined number of adjacent resistance range combinations from the resistance range set, centered on the resistance range combination corresponding to the second parameter, to form a local search range... The set quantity is configured such that the range of parameters corresponding to all resistance level combinations within the local search range is greater than the preset allowable range.
[0011] In some embodiments, in the step of selecting a predetermined number of adjacent resistance range combinations from the resistance range set, centered on the resistance range combination corresponding to the second parameter, to form a local search range, the predetermined number is determined in the following way: Obtain the changing trend of parameters among multiple resistance range combinations adjacent to the resistance range combination corresponding to the second parameter; Based on the changing trend and the preset allowable range, determine the required set quantity.
[0012] In some embodiments, the parameters generated by the adjustable resistor module include: The equivalent resistance value corresponding to the resistance range combination or the voltage value generated by the equivalent resistance value corresponding to the resistance range combination.
[0013] Secondly, this application provides a sensor including an adjustable resistance module consisting of a first digital potentiometer and a second digital potentiometer connected in parallel, wherein the sensor is configured to adjust the equivalent resistance value of the adjustable resistance module by means of a resistance adjustment method as described in any of the first aspects.
[0014] Thirdly, this application provides a resistance adjustment device applied to an adjustable resistance module composed of a first digital potentiometer and a second digital potentiometer connected in parallel, wherein the adjustable resistance module has multiple resistance range combinations, each resistance range combination corresponding to an equivalent resistance value of the adjustable resistance module; the resistance adjustment device includes: The pre-configuration module is used to monotonically arrange the multiple resistance level combinations according to their corresponding equivalent resistance values to form a resistance level set. An initial adjustment module is used to set the adjustable resistor module according to the resistance range combination at the middle position of the resistance range set, and to obtain the first parameter generated by the adjustable resistor module. An iterative search module is used to compare the target parameter and the first parameter, perform a binary search in the first or second sub-interval of the resistance range set according to the comparison result, and set the adjustable resistor module according to the selected resistance range combination in each binary search until the second parameter generated by the adjustable resistor module that meets the preset conditions is obtained. The range determination module is used to select a set number of adjacent resistance range combinations in the resistance range set, centered on the resistance range combination corresponding to the second parameter, to form a local search range; The result determination module is used to set the adjustable resistor module according to all resistance range combinations within the local search range, obtain all parameters generated by the adjustable resistor module, and select the resistance range combination corresponding to the parameter closest to the target parameter to set the adjustable resistor module. Wherein, the first sub-interval is: all resistance range combinations from the start position to the middle position of the resistance range set; the second sub-interval is: all resistance range combinations from the middle position to the end position of the resistance range set; the preset condition is: the deviation between the second parameter and the target parameter is within a preset allowable range.
[0015] Fourthly, this application provides an electronic device, including a memory and a processor, wherein: The memory is used to store computer programs; The processor is used to read the computer program in the memory and execute the steps of the resistance adjustment method as described in any of the first aspects.
[0016] The resistance adjustment method, sensor, device, and equipment provided in this application involve pre-sorting all resistance range combinations of two parallel digital potentiometers according to their equivalent resistance values to form an ordered resistance range set. A binary search method is then used based on this resistance range set to quickly approximate the target parameter. The initial binary search compares the target parameter with a first parameter to determine the search direction for subsequent binary searches. The deviation between the target parameter and the second parameter is then used as the termination condition for the binary search, achieving rapid convergence in a nonlinear and non-uniform resistance range set. After reaching the termination condition, a traversal search is performed within a local range centered on the current resistance range combination to determine the optimal solution. This application solves the technical problems of high system cost and poor design flexibility caused by using high-cost, fixed-model dedicated high-precision potentiometers. It significantly reduces the number of adjustments and communication overhead required during the adjustment process while maintaining adjustment accuracy close to that of dedicated high-precision potentiometers, thereby achieving fast and accurate resistance adjustment, significantly reducing system cost, and enhancing circuit design flexibility.
[0017] These or other aspects of this application will become more apparent in the following description of the embodiments. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A flowchart of the resistance adjustment method provided in an embodiment of this application is shown.
[0020] Figure 2 A detailed flowchart of step S100 provided in an embodiment of this application is shown.
[0021] Figure 3 A flowchart illustrating the determination of a set quantity in the resistance adjustment method provided in this application embodiment is shown.
[0022] Figure 4 A schematic diagram of the apparatus provided in an embodiment of this application is shown.
[0023] Figure 5 A schematic diagram of an electronic device provided in an embodiment of this application is shown.
[0024] Figure 6 A schematic diagram of a computer storage medium provided in an embodiment of this application is shown. Detailed Implementation
[0025] To enable those skilled in the art to better understand the solutions of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0026] In the embodiments of this application, it should be noted that, in this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0027] Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0028] Furthermore, in the embodiments of this application, "multiple" refers to two or more. Therefore, in the embodiments of this application, "multiple" can also be understood as "at least two". "At least one" can be understood as one or more, such as one, two, or more. For example, including at least one means including one, two, or more, and is not limited to which ones are included. For example, including at least one of A, B, and C, then it could include A, B, C, A and B, A and C, B and C, or A and B and C.
[0029] This application provides a resistance adjustment method applied to an adjustable resistor module composed of a first digital potentiometer and a second digital potentiometer connected in parallel. Specifically, the adjustable resistor module has multiple resistance range combinations, each corresponding to an equivalent resistance value of the adjustable resistor module. Optionally, the adjustable resistor module of this application can be directly used to construct various circuit structures such as voltage divider circuits, current limiting circuits, and feedback networks for precise control of the voltage at specific nodes or the current in branches within the circuit. Particularly in sensor-related circuits, the sensor output signal can be adjusted by regulating the equivalent resistance value of the adjustable resistor module, ensuring the accuracy and stability of the sensor output signal.
[0030] Figure 1 A flowchart of the resistance adjustment method provided in an embodiment of this application is shown, as follows: Figure 1 As shown, the resistance adjustment method provided in this application includes: Step S100: Arrange multiple resistance range combinations monotonically according to their corresponding equivalent resistance values to form a resistance range set. Optionally, step S100 calculates the equivalent resistance values of the first and second digital potentiometers connected in parallel under all possible range combinations, establishes a mapping relationship between these resistance range combinations and their calculated equivalent resistance values, and finally sorts them uniformly according to the magnitude of the equivalent resistance values to form an ordered data set, laying the foundation for the subsequent resistance adjustment process.
[0031] Step S200: Set the adjustable resistor module according to the resistor range combination in the middle of the resistor range set, and obtain the first parameter generated by the adjustable resistor module. Optionally, at the start of adjustment, select the resistor range combination located in the middle position from the sorted resistor range set.
[0032] Step S300: Compare the target parameter and the first parameter. Based on the comparison result, perform a binary search within the first or second sub-interval of the resistance range set. In each binary search, set the adjustable resistor module according to the selected resistance range combination until a second parameter generated by the adjustable resistor module that meets the preset conditions is obtained. Optionally, step 300 is an iterative convergence process based on the search direction determined by the comparison result in step S200. The binary search continues within the selected sub-interval. In each iteration, the resistance range combination at the middle position of the current sub-interval is selected to set the adjustable resistor module. The termination condition of this iteration process is whether the deviation between the parameter generated by the current adjustable resistor module and the target parameter is within a preset allowable range. If this accuracy condition is met, the binary search is immediately terminated, and the parameter generated by the current adjustable resistor module is determined as the second parameter; otherwise, the interval is divided at the current parameter position, and the next binary iteration is performed according to the initially determined search direction until the above preset conditions are met.
[0033] Step S400: Centered on the resistance range combination corresponding to the second parameter, select a set number of adjacent resistance range combinations in the resistance range set to form a local search range. Optionally, after the binary search in step S30 terminates due to meeting a preset condition, the system uses the current final resistance range combination's position in the set as a reference, selecting several adjacent resistance range combinations forward and backward to jointly form a local range to be finely searched.
[0034] Step S500: Set the adjustable resistor module according to all resistance range combinations within the local search range, obtain all parameters generated by the adjustable resistor module, and select the resistance range combination corresponding to the parameter closest to the target parameter. Optionally, the system traverses the local search range determined in step S400. That is, each resistance range combination within the range is sequentially set to the adjustable resistor module, and the actual output parameter corresponding to each resistance range combination is recorded simultaneously. After traversing all candidate combinations, the system finds the output parameter closest to the target parameter by comparison, and determines the resistance range combination that generates this parameter as the final solution, completing this high-precision adjustment.
[0035] The first sub-interval is: all resistance range combinations from the start position to the middle position of the resistance range set; the second sub-interval is: all resistance range combinations from the middle position to the end position of the resistance range set; the preset condition is: the deviation between the second parameter and the target parameter is within the preset allowable range.
[0036] It is understood that in this embodiment, the adjustable resistor module is connected to a main control module, such as a microcontroller, single-chip microcomputer, or central processing unit, to enable the main control module to set the equivalent resistance value of the adjustable resistor module. Specifically, the main control module sends configuration commands to the first and second digital potentiometers, which contain the target range information to be set for each, to configure the two digital potentiometers to the state specified by the resistance range combination in a synchronous or sequential manner, thereby setting the equivalent resistance value of the adjustable resistor module. For example, the adjustable resistor module can communicate with the main control module via an IIC bus, and the main control module adjusts the resistance range of the first and second digital potentiometers by sending IIC commands to them.
[0037] The resistance adjustment method provided in this application pre-sorts all resistance range combinations of two parallel digital potentiometers according to their equivalent resistance values to form an ordered resistance range set. Based on this resistance range set, a binary search method is used to quickly approximate the target parameter. The initial binary search determines the search direction for subsequent binary searches by comparing the target parameter and a first parameter. The termination condition for the binary search is whether the deviation between the target parameter and the second parameter falls within a preset allowable range, achieving rapid convergence in a nonlinear and non-uniform resistance range set. After reaching the termination condition, the search then iterates through a local area centered on the current resistance range combination to determine the optimal solution. This application solves the technical problems of high system cost and poor design flexibility caused by using high-cost, fixed-model dedicated high-precision potentiometers. It significantly reduces the number of adjustments and communication overhead required during the adjustment process while maintaining adjustment accuracy close to that of dedicated high-precision potentiometers, thereby achieving fast and accurate resistance adjustment, significantly reducing system cost, and enhancing circuit design flexibility.
[0038] In some embodiments, Figure 2 A detailed flowchart of step S100 provided in an embodiment of this application is shown, as follows: Figure 2 As shown, step S100: the step of monotonically arranging multiple resistance range combinations according to their corresponding equivalent resistance values to form a resistance range set includes: Step S110: Enumerate all resistance range combinations of the adjustable resistor module and obtain the equivalent resistance value corresponding to each resistance range combination.
[0039] Step S120: Select all resistance range combinations that meet the target resistance adjustment range from all equivalent resistance values according to the target resistance adjustment range.
[0040] Step S130: Remove redundant resistance range combinations with repeated equivalent resistance values, and arrange all remaining resistance range combinations in ascending or descending order according to their corresponding equivalent resistance values to form a resistance range set.
[0041] Optionally, steps S110 to S130 constitute the process of constructing the resistance range set. Step S110 iterates through all resistance range combinations of the first and second digital potentiometers, calculating the corresponding equivalent resistance value for each combination using the parallel resistance formula. Step S120 then selects suitable resistance range combinations from all calculated equivalent resistance values based on the required resistance range for the actual application. When all resistance range combinations need to be applied, step S120 can be skipped. In step S130, the selected range combinations are further optimized by removing redundant combinations that produce the same equivalent resistance value. The remaining unique combinations are then arranged in order according to the magnitude of their equivalent resistance values, ultimately forming the resistance range set.
[0042] It is understood that this application does not limit the specific construction method of the resistance range set. In actual implementation, those skilled in the art can adopt different implementation methods according to specific needs and resource conditions. For example, a detailed comparison table of resistance range combinations and equivalent resistance values can be manually created to manually complete the enumeration, filtering, and sorting work in steps S110 to S130; alternatively, software can be programmed to automatically complete the entire process of enumerating all resistance range combinations, calculating equivalent resistance values, filtering target ranges, and finally sorting. These two implementation methods, as well as other implementation methods that can achieve the same technical effect, all fall within the protection scope of this application.
[0043] The resistance adjustment method provided in this application provides an optimized data foundation for subsequent resistance adjustment by constructing the resistance range set as described above, thereby improving the resistance adjustment efficiency.
[0044] In some embodiments, in step S200: setting the adjustable resistor module according to the resistor range combination at the middle position of the resistor range set, and obtaining the first parameter generated by the adjustable resistor module... When the resistance range set includes an even number of resistance range combinations, select any one of the two resistance range combinations in the middle of the resistance range set to set the adjustable resistance module.
[0045] When the resistance range set includes an odd number of resistance range combinations, select the resistance range combination in the middle of the resistance range set to set the adjustable resistance module.
[0046] Optionally, in this embodiment, the method of selecting the middle position is the standard starting point of the binary search method. The aim is to select a combination of positions that is as close as possible to the theoretical center as the search starting point, regardless of whether the number of elements in the set is odd or even, thereby ensuring that the binary search process can evenly narrow the search range and improve search efficiency.
[0047] In some embodiments, step S300, the step of performing a binary search in the first sub-interval or the second sub-interval of the resistance range set based on the comparison result, includes: When the resistance range set is arranged in ascending order according to the equivalent resistance values corresponding to the resistance range combinations, then: When the target parameter is greater than the first parameter, perform a binary search in the second sub-interval.
[0048] When the target parameter is less than the first parameter, perform a binary search in the first sub-interval.
[0049] When the resistance range set is arranged in descending order according to the equivalent resistance value corresponding to the resistance range combination, then: When the target parameter is greater than the first parameter, perform a binary search in the first sub-interval.
[0050] When the target parameter is less than the first parameter, perform a binary search in the second sub-interval.
[0051] Optionally, in this embodiment, the logic for setting the search direction ensures that the search process always proceeds in the direction that makes the current parameter approach the target parameter. When the set is sorted in ascending order, increasing the index corresponds to an increase in the equivalent resistance value; if the target parameter is greater than the current parameter, it means that the resistance needs to be increased, so the search should continue in the second half of the interval (the second sub-interval) representing the larger resistance value, and vice versa. The logic is reversed when the set is sorted in descending order.
[0052] In some embodiments, in step S400, which involves selecting a predetermined number of adjacent resistance range combinations from the resistance range set to form a local search range, centered on the resistance range combination corresponding to the second parameter, the predetermined number is configured such that the range of parameters corresponding to all resistance range combinations within the local search range is greater than a preset allowable range. Optionally, configuring the parameter range of the local search range to be greater than the preset allowable range is to ensure that the local range can sufficiently "cover" the area where the target parameter may exist. Since the change in the equivalent resistance value after the first and second digital potentiometers are connected in parallel is non-linear, the optimal solution may not be found at the final location by the bisection method, but rather at its neighboring location. In view of this, the embodiments of this application ensure that the local range is sufficient to accommodate a range combination whose difference from the target parameter is within the allowable range by configuring a predetermined number, thereby avoiding the risk of missing the optimal solution due to an excessively small range and improving the reliability of successful adjustment.
[0053] The resistance adjustment method provided in this application effectively overcomes the search failure that may be caused by the nonlinearity of the resistance increment by setting scientific judgment criteria for the local search range, and significantly improves the accuracy and reliability of the final adjustment result.
[0054] In some embodiments, Figure 3 A flowchart illustrating the determination of a set quantity in the resistance adjustment method provided in this application is shown, such as... Figure 3 As shown, in step S400: selecting a set number of adjacent resistance range combinations from the resistance range set to form a local search range, with the resistance range combination corresponding to the second parameter as the center, the set number is determined in the following way: Step S410: Obtain the changing trend of parameters among multiple resistance range combinations adjacent to the resistance range combination corresponding to the second parameter.
[0055] Step S420: Determine the required setting quantity based on the changing trend and the preset allowable range.
[0056] Optionally, in step S410, by checking the parameter values corresponding to several resistance range combinations before and after the current resistance range combination, the approximate rate of change of the parameter in this region can be calculated, i.e., the trend of change (e.g., whether it is rising rapidly, falling slowly, or remaining basically stable). Step S420 then performs calculations based on this trend: if the parameter changes drastically, a smaller sequence number span will lead to a larger parameter change (i.e., a large range), in which case a smaller quantity can be set; conversely, if the parameter changes smoothly (the trend of change is gentle), a larger quantity needs to be set to ensure that the range of the expanded local range exceeds the preset allowable range.
[0057] For example, suppose the preset allowable range is a voltage of 0 to 0.1V. Near the endpoint of the bisection method, it is found that the voltage changes by approximately 0.05V for each step shift. Therefore, to ensure that the voltage range within the local area is greater than 0.1V, it is necessary to expand the range by at least two steps forward and two steps backward (a total of five steps). If the voltage change reaches 0.5V for each step shift (a drastic trend), then only one step forward and one step backward is needed (a total of three steps), and the range will reach 1.0V, still meeting the requirement. This method achieves adaptive determination of the size of the local search range.
[0058] The resistance adjustment method provided in this application embodiment adaptively determines the size of the local search range, which can minimize unnecessary traversal while ensuring that the optimal solution is found, thus balancing adjustment accuracy and adjustment efficiency.
[0059] In some embodiments, the parameters generated by the adjustable resistor module in the resistance adjustment method provided in this application include: the equivalent resistance value corresponding to the resistance range combination or the voltage value generated by the equivalent resistance value corresponding to the resistance range combination. Optionally, this design flexibility allows the method to adapt to different application scenarios and hardware configurations. When the circuit design allows direct resistance measurement, the equivalent resistance value itself can be used as both the target parameter and the feedback parameter. In more common scenarios, potentiometers are usually part of the circuit, and changes in their equivalent resistance value directly translate into changes in the output voltage. In this case, acquiring the voltage value as a parameter is more direct. Both methods are essentially feedback on the state of the adjustable resistor module, and the core adjustment logic remains consistent.
[0060] The resistance adjustment method provided in this application enhances the applicability and flexibility of the technical solution in different application scenarios and broadens its application scope by supporting both resistance and voltage parameter types.
[0061] This application also provides a sensor comprising an adjustable resistor module consisting of a first digital potentiometer and a second digital potentiometer connected in parallel, wherein the sensor is configured to adjust the equivalent resistance value of the adjustable resistor module by means of the resistance adjustment method described in the above embodiments.
[0062] For further details regarding the implementation of the above-mentioned technical solution by the sensor, please refer to the description of the resistance adjustment method provided in the above-mentioned embodiments of the invention, which will not be repeated here.
[0063] Based on the above resistance adjustment method, this application provides a resistance adjustment device. The resistance adjustment device is applied to an adjustable resistance module composed of a first digital potentiometer and a second digital potentiometer connected in parallel. The adjustable resistance module has multiple resistance range combinations, and each resistance range combination corresponds to an equivalent resistance value of the adjustable resistance module. Figure 4A schematic diagram of the resistance adjustment device provided in an embodiment of this application is shown, such as... Figure 4 As shown, the resistance adjustment device includes: The pre-configuration module 100 is used to monotonically arrange multiple resistance range combinations according to their corresponding equivalent resistance values to form a resistance range set.
[0064] The initial adjustment module 200 is used to set the adjustable resistor module according to the resistance range combination at the middle position of the resistance range set and to obtain the first parameter generated by the adjustable resistor module.
[0065] The iterative search module 300 is used to compare the target parameter and the first parameter, and perform a binary search in the first or second sub-interval of the resistance range set according to the comparison result. In each binary search, the adjustable resistor module is set according to the selected resistance range combination until the second parameter generated by the adjustable resistor module that meets the preset conditions is obtained.
[0066] The range determination module 400 is used to select a set number of adjacent resistance range combinations in the resistance range set, centered on the resistance range combination corresponding to the second parameter, to form a local search range.
[0067] The result determination module 500 is used to set the adjustable resistor module according to all resistance range combinations within the local search range, obtain all parameters generated by the adjustable resistor module, and select the resistance range combination corresponding to the parameter closest to the target parameter to set the adjustable resistor module.
[0068] The first sub-interval is: all resistance range combinations from the start position to the middle position of the resistance range set; the second sub-interval is: all resistance range combinations from the middle position to the end position of the resistance range set; the preset condition is: the deviation between the second parameter and the target parameter is within the preset allowable range.
[0069] For other details regarding the implementation of the above technical solution by each module in the above resistance adjustment device, please refer to the description of the resistance adjustment method provided in the above-mentioned embodiments of the invention, which will not be repeated here.
[0070] Based on the above resistance adjustment method, this application also provides an electronic device. Figure 5 A schematic diagram of an electronic device provided in an embodiment of this application is shown, such as... Figure 5 As shown, the electronic device provided in this embodiment includes a processor 51 and a memory 52 coupled to the processor 51. The memory 52 stores a computer program, which, when executed by the processor 51, causes the processor 51 to perform the steps of the resistance adjustment method in the above embodiment.
[0071] For other details regarding the implementation of the above technical solution by the processor 51 in the above electronic device, please refer to the description of the resistance adjustment method provided in the above embodiments of the invention, which will not be repeated here.
[0072] The processor 51 can also be called a CPU (Central Processing Unit). The processor 51 may be an integrated circuit chip with signal processing capabilities. The processor 51 can also be a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor, or the processor 51 can be any conventional processor.
[0073] Based on the above-described electronic regulation method, embodiments of this application also provide a computer-readable storage medium. Figure 6 A schematic diagram of a computer storage medium provided in an embodiment of this application is shown, such as... Figure 6 As shown, the storage medium stores a readable computer program 61. This computer program 61 can be stored in the storage medium as a software product, including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks or optical disks, ROM (Read-Only Memory), RAM (Random Access Memory), or terminal devices such as computers, servers, mobile phones, and tablets.
[0074] The above description, in conjunction with specific embodiments, provides a further detailed explanation of this application and should not be construed as limiting the specific implementation of this application to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of this application, and all such modifications and substitutions should be considered within the scope of protection of this application.
Claims
1. A method for adjusting resistance, characterized in that, An adjustable resistor module is applied to a system consisting of a first digital potentiometer and a second digital potentiometer connected in parallel. The adjustable resistor module has multiple resistance level combinations, each corresponding to an equivalent resistance value of the adjustable resistor module. The resistance adjustment method includes: The plurality of resistance range combinations are monotonically arranged according to their corresponding equivalent resistance values to form a resistance range set. The adjustable resistor module is configured according to the resistance range combination at the middle position of the resistance range set, and the first parameter generated by the adjustable resistor module is obtained. Compare the target parameter with the first parameter, and perform a binary search in the first or second sub-interval of the resistance range set according to the comparison result. In each binary search, set the adjustable resistor module according to the selected resistance range combination until the second parameter generated by the adjustable resistor module that meets the preset conditions is obtained. Centered on the resistance range combination corresponding to the second parameter, a set number of adjacent resistance range combinations are selected from the resistance range set to form a local search range; The adjustable resistor module is set according to all resistance range combinations within the local search range, all parameters generated by the adjustable resistor module are obtained, and the resistance range combination corresponding to the parameter closest to the target parameter is selected to set the adjustable resistor module. Wherein, the first sub-interval is: all resistance range combinations from the start position to the middle position of the resistance range set; the second sub-interval is: all resistance range combinations from the middle position to the end position of the resistance range set; the preset condition is: the deviation between the second parameter and the target parameter is within a preset allowable range.
2. The resistance adjustment method as described in claim 1, characterized in that, The step of monotonically arranging the plurality of resistance range combinations according to their corresponding equivalent resistance values to form a resistance range set includes: Enumerate all resistance range combinations of the adjustable resistor module and obtain the equivalent resistance value corresponding to each resistance range combination; Based on the target resistance adjustment range, select all resistance range combinations that conform to the target resistance adjustment range from all the equivalent resistance values; Remove redundant resistance range combinations with repeated equivalent resistance values, and arrange all remaining resistance range combinations in ascending or descending order according to their corresponding equivalent resistance values to form the resistance range set.
3. The resistance adjustment method as described in claim 1, characterized in that, In the step of setting the adjustable resistor module according to the resistance range combination at the middle position of the resistance range set, and obtaining the first parameter generated by the adjustable resistor module... When the resistor range set includes an even number of resistor range combinations, select any one of the two resistor range combinations in the middle position of the resistor range set to set the adjustable resistor module. When the resistance range set includes an odd number of resistance range combinations, the adjustable resistor module is set by selecting a resistance range combination in the middle of the resistance range set.
4. The resistance adjustment method as described in claim 1, characterized in that, The step of performing a binary search in the first or second sub-interval of the resistance range set based on the comparison result includes: When the resistance range set is arranged in ascending order according to the equivalent resistance values corresponding to the resistance range combinations, then: When the target parameter is greater than the first parameter, perform a binary search in the second sub-interval; When the target parameter is less than the first parameter, perform a binary search in the first sub-interval; When the resistance range set is arranged in descending order according to the equivalent resistance values corresponding to the resistance range combinations, then: When the target parameter is greater than the first parameter, perform a binary search in the first sub-interval; When the target parameter is less than the first parameter, a binary search is performed in the second sub-interval.
5. The resistance adjustment method as described in claim 1, characterized in that, In the step of selecting a predetermined number of adjacent resistance range combinations from the resistance range set, centered on the resistance range combination corresponding to the second parameter, to form a local search range... The set quantity is configured such that the range of parameters corresponding to all resistance level combinations within the local search range is greater than the preset allowable range.
6. The resistance adjustment method as described in claim 5, characterized in that, In the step of selecting a predetermined number of adjacent resistance range combinations from the resistance range set, centered on the resistance range combination corresponding to the second parameter, to form a local search range, the predetermined number is determined in the following way: Obtain the changing trend of parameters among multiple resistance range combinations adjacent to the resistance range combination corresponding to the second parameter; Based on the changing trend and the preset allowable range, determine the required set quantity.
7. The resistance adjustment method as described in claim 1, characterized in that, The parameters generated by the adjustable resistor module include: The equivalent resistance value corresponding to the resistance range combination or the voltage value generated by the equivalent resistance value corresponding to the resistance range combination.
8. A sensor, characterized in that, The device includes an adjustable resistor module consisting of a first digital potentiometer and a second digital potentiometer connected in parallel, wherein the sensor is configured to adjust the equivalent resistance value of the adjustable resistor module by means of the resistance adjustment method as described in any one of claims 1 to 7.
9. A resistance adjustment device, characterized in that, An adjustable resistor module is applied to a system consisting of a first digital potentiometer and a second digital potentiometer connected in parallel. The adjustable resistor module has multiple resistance range combinations, each corresponding to an equivalent resistance value of the adjustable resistor module. The resistance adjustment device includes: The pre-configuration module is used to monotonically arrange the multiple resistance level combinations according to their corresponding equivalent resistance values to form a resistance level set. An initial adjustment module is used to set the adjustable resistor module according to the resistance range combination at the middle position of the resistance range set, and to obtain the first parameter generated by the adjustable resistor module. An iterative search module is used to compare the target parameter and the first parameter, perform a binary search in the first or second sub-interval of the resistance range set according to the comparison result, and set the adjustable resistor module according to the selected resistance range combination in each binary search until the second parameter generated by the adjustable resistor module that meets the preset conditions is obtained. The range determination module is used to select a set number of adjacent resistance range combinations in the resistance range set, centered on the resistance range combination corresponding to the second parameter, to form a local search range; The result determination module is used to set the adjustable resistor module according to all resistance range combinations within the local search range, obtain all parameters generated by the adjustable resistor module, and select the resistance range combination corresponding to the parameter closest to the target parameter to set the adjustable resistor module. Wherein, the first sub-interval is: all resistance range combinations from the start position to the middle position of the resistance range set; the second sub-interval is: all resistance range combinations from the middle position to the end position of the resistance range set; the preset condition is: the deviation between the second parameter and the target parameter is within a preset allowable range.
10. An electronic device, characterized in that, Includes memory and processor, wherein: The memory is used to store computer programs; The processor is used to read the computer program in the memory and execute the steps of the resistance adjustment method as described in any one of claims 1 to 7.