Offset voltage adjustment method, magnetic switch, and magnetic switch automatic adjustment system and method
By connecting the same resistor series at both ends of the adjustment object of the magnetic switch and digitizing the adjustment switch string, the calibration difficulties and changes in the threshold reference voltage after the magnetic switch are packaged are solved, and a stable offset voltage adjustment and simplified adjustment process is achieved.
Patent Information
- Application Number
- CN202010877172.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-27
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2040-08-27
AI Technical Summary
The existing magnetic switches are difficult to accurately calibrate after packaging, and the traditional adjustment method will change the total resistance series resistance value, resulting in changes in the threshold reference voltage VREF, which is inconvenient to operate.
An offset voltage adjustment method is proposed. By symmetrically connecting the same first resistor string and the second resistor string in series at both ends of the adjustment object, and digitizing the adjustment switch string for digital adjustment, the total offset voltage is gradually approached, so that the same voltage is superimposed on the reference end to correct the offset of the magnetic switch.
It realizes that the offset voltage of the magnetic switch is adjusted without changing the total resistance series resistance value, maintains the stability of the threshold reference voltage VREF, simplifies the adjustment process, and facilitates the circuit design.
Smart Images

Figure CN114126165B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of measurement and testing, and in particular relates to an offset voltage adjustment method, a magnetic switch, and a magnetic switch automatic adjustment system and method. Technical Background
[0002] A magnetic switch is a position sensor device that uses the mutual conversion characteristics between electric field and magnetic field to easily convert magnetic signals into electrical signals. By changing the positional relationship between the magnetic switch and the magnet, the magnetic field signal is converted into an electrical signal, and the purpose of control or measurement is achieved by setting the magnetic switch threshold.
[0003] Magnetic switches are usually composed of magnetic elements (Hall elements or magnetoresistive elements) and control processing circuits. The magnetic elements can be equivalent to a Wheatstone full bridge or half bridge. However, due to defects in chip manufacturing and packaging technology, the resistance values of the resistors in the Wheatstone full bridge or half bridge usually have errors, and adjustments are required to compensate for the impact of this error. Otherwise, the threshold of the switch signal set according to the ideal situation (i.e., no error influence) will be too high or too low, resulting in incorrect output switch signals and failure to achieve the purpose of accurate control or measurement.
[0004] The existing magnetic switches on the market generally have only three pins, namely the power supply V DD , ground GND and output terminal V out , which makes it difficult to calibrate after packaging. Calibration before chip packaging cannot achieve accurate calibration because the stress during the packaging process will cause the threshold of the magnetic switch to shift.
[0005] In addition, in the traditional adjustment method, the adjustment resistor will change the total resistance of the resistor string, resulting in the threshold reference voltage V originally set before the adjustment when the magnetic switch enters the normal working state after the adjustment. REF If the threshold reference voltage V REF unchanged, then it is also necessary to change the threshold reference voltage V after adjustment REF The tap position makes actual operation very inconvenient. Summary of the invention
[0006] In order to solve the above-mentioned defects, the present invention proposes a trimming circuit, which can gradually approach the total offset voltage and obtain the value of the total offset voltage, so that the same voltage can be superimposed on the reference end to correct the offset of the magnetic switch.
[0007] First, the present invention proposes an offset voltage adjustment method, wherein a first resistor string and a second resistor string having the same structure are symmetrically connected in series at two ends of an adjustment object, wherein the first resistor string and the second resistor string are both composed of a plurality of adjustment resistors connected in series, and each of the adjustment resistors is respectively connected in parallel with an adjustment switch;
[0008] The trimming switches connected in parallel with the trimming resistors in the first resistor string constitute a first switch string, and the trimming switches connected in parallel with the trimming resistors in the second resistor string constitute a second switch string; the two corresponding trimming switches in the first switch string and the second switch string maintain opposite closed / open states, thereby ensuring that the total resistance of the first resistor string and the second resistor string is constant;
[0009] Drawing out the voltage of the second resistor string as a trimming voltage;
[0010] Traversing all the closed / open states of the second switch string to change the value of the trimmed voltage, the closed / open state of the first switch string changing accordingly;
[0011] The magnitudes of the trimming voltage and the offset voltage are compared to determine a final trimming result.
[0012] In the above offset voltage adjustment method, the resistance values of the adjustment resistors in the first resistor string and the second resistor string are respectively set to be in a geometric progression or an arithmetic progression.
[0013] The above offset voltage adjustment method, wherein the first resistor string further comprises a first error adjustment resistor and a first error adjustment switch connected in parallel with the first error adjustment resistor; the second resistor string further comprises a second error adjustment resistor and a second error adjustment switch connected in parallel with the second error adjustment resistor;
[0014] When traversing all the closed / open states of the second switch string, the first error adjustment switch and the second error adjustment switch maintain the original state of one closed and one open;
[0015] If the offset voltage is less than the trimming voltage when the trimming result is finally selected, the state of the second error adjustment switch is adjusted to be closed, and the state of the first error adjustment switch is adjusted to be open;
[0016] If the offset voltage is greater than the trimming voltage when the trimming result is finally selected, the state of the second error adjustment switch is adjusted to be open, and the state of the first error adjustment switch is adjusted to be closed.
[0017] Correspondingly, the present invention also provides a magnetic switch including a trimming circuit, comprising: a magnetic resistance module, a reference resistance module and a comparator, wherein an offset voltage is drawn from the magnetic resistance module, and a trimming voltage is drawn from the reference resistance module; the offset voltage is connected to one input terminal of the comparator, and the trimming voltage is connected to another input terminal of the comparator; the comparator outputs a comparison result between the offset voltage and the trimming voltage;
[0018] The trimming circuit included in the reference resistance module has the following structure:
[0019] Connected in series from power supply to ground; a first resistor string, a first resistor, a second resistor, and a second resistor string; wherein the first resistor string and the second resistor string have the same structure and are formed by connecting the same number of trimming resistors with the same resistance value in series; the resistance value of each trimming resistor is fixed, and each trimming resistor is connected in parallel with a trimming switch;
[0020] The trimming circuit is trimmed in a zero magnetic field environment, the closed / open states of the corresponding trimming switches in the first resistor string and the second resistor string remain mutually opposite, and the trimming voltage is drawn between the first resistor and the second resistor.
[0021] In the above-mentioned magnetic switch including the trimming circuit, the resistance values of the trimming resistors are in a geometric progression relationship.
[0022] In the above-mentioned magnetic switch including the trimming circuit, the resistance values of the first resistor and the second resistor are the same and are N times the maximum value of the trimming resistors, where N is a natural number.
[0023] The above-mentioned magnetic switch including the trimming circuit, wherein the first resistor string and the second resistor string also include an error adjustment resistor and an error adjustment switch respectively connected in parallel therewith, the resistance value of the error adjustment resistor is 1 / 2 of the minimum value of the trimming resistor, and the trimming error is adjusted by changing the closed / open state of the error adjustment switch.
[0024] Based on the same inventive concept, the present invention also provides a magnetic switch automatic adjustment system for calculating an adjustment voltage to eliminate the influence of the magnetic switch offset voltage, comprising: the magnetic switch with the adjustment circuit, a communication control unit, a non-volatile memory and a traversal control unit;
[0025] The non-volatile memory includes a trimming switch status register for storing the trimming result of the trimming switch. When the trimming is completed, the communication control unit writes the trimming result of the trimming switch into the trimming switch status register. Under normal working conditions, the communication control unit reads the trimming switch status register to control the closed / open state of the trimming switch.
[0026] During trimming, the communication control unit receives an instruction from the ergodic control unit to adjust the on / off state of the first switch string and the second switch string, thereby changing the value of the trimming voltage; at the same time, the comparison result is sent to the ergodic control unit through the communication port;
[0027] The traversal control unit selects the closed / open state of the second switch string as the adjustment result according to the comparison result, and saves it to the adjustment switch state register.
[0028] The magnetic switch trimming system mentioned above further includes a trimming / output selection switch, and the non-volatile memory further includes a selection switch state register for storing the state of the trimming / output selection switch;
[0029] The selector switch status register is initialized to the trimming state when production is completed. After the magnetic switch is powered on, the communication control unit reads the selector switch status register and places the trimming / output selector switch in the trimming position, thereby entering the trimming state.
[0030] After the adjustment is completed, the communication control unit modifies the content of the selection switch state register to the output state, and the magnetic switch enters the normal working state after being powered on again.
[0031] In the above-mentioned magnetic switch adjustment system, the communication control unit further includes a query module. Each time the magnetic switch is powered on, the query module queries through the output end of the magnetic switch whether it is necessary to enter the adjustment state. If so, it enters the adjustment state. If there is no response after the timeout, it directly enters the normal working state.
[0032] In the above-mentioned magnetic switch adjustment system, the traversal control unit is arranged outside the magnetic switch, and the traversal process is controlled through the output end of the magnetic switch; or, the traversal control unit is arranged inside the magnetic switch, and the traversal process is controlled through an internal communication bus.
[0033] In the above-mentioned magnetic switch trimming system, the trimming circuit also includes a first error adjustment resistor and a first error adjustment switch connected in parallel therewith, and a second error adjustment resistor and a second error adjustment switch connected in parallel therewith, the resistance values of the first error adjustment resistor and the second error adjustment resistor are 1 / 2 of the minimum value of the trimming resistors, and after determining the state of the second switch string, the first error adjustment switch and the second error adjustment switch are adjusted to adjust the error range of the trimming result.
[0034] Correspondingly, based on the above-mentioned magnetic switch adjustment system, the present invention also provides a magnetic switch automatic adjustment method, wherein the magnetic switch is adjusted in a zero magnetic field environment after power-on, comprising the following steps:
[0035] Setting the first switch string to a fully closed state and the second switch string to a fully open state, and if the offset voltage is greater than the trimming voltage at this time, exiting the trimming process;
[0036] Setting the first switch string to a fully open state and the second switch string to a fully closed state, and if the offset voltage is less than the trimming voltage at this time, exiting the trimming process;
[0037] The closed / open state of the second switch string is adjusted gradually from fully closed to fully open in sequence, and the first switch string is adjusted accordingly. After each adjustment, the trimmed voltage is compared to see whether it is greater than the offset voltage. If so, the trimming is stopped and the current closed / open state or the previous closed / open state of the second switch string is saved as the trimming result. If not, the comparison is continued;
[0038] The trimming result is written into the trimming switch status register.
[0039] The above-mentioned magnetic switch automatic adjustment method reads the selection switch status register in the non-volatile memory after power-on, and determines whether to enter the adjustment state or the output state according to the content of the selection switch status register; after the adjustment is completed, the content of the selection switch status register is modified to the output state.
[0040] The above-mentioned magnetic switch automatic adjustment method queries the adjustment / output status through the communication port during power-on initialization. If the communication port responds, the adjustment state is entered. If the communication port times out without response, the normal working state is entered.
[0041] In the above-mentioned automatic adjustment method for a magnetic switch, the system further comprises a first error adjustment resistor and a first error adjustment switch connected in parallel with the first error adjustment resistor, a second error adjustment resistor and a second error adjustment switch connected in parallel with the second error adjustment resistor, and further comprises the following steps:
[0042] If the current closed / open state of the second switch string is saved, the second error adjustment switch state is adjusted to be closed, and the first error adjustment switch state is adjusted to be open;
[0043] If the previous closed / open state of the second switch string is saved, the second error adjustment switch state is adjusted to open, and the first error adjustment switch state is adjusted to closed.
[0044] Compared with the prior art, the present invention lays a material foundation for digitally adjusting the trimming voltage by connecting a resistor string with the same structure in series at both ends of the trimming object and a switch string connected in parallel therewith. With the corresponding control method, that is, the corresponding switches on the two resistor strings always keep one closed and one closed, forming a push-pull structure, which can keep the total resistance value of all components connected in series, including the trimming object, unchanged. Therefore, when calculating the trimming voltage, the denominator remains unchanged, which brings convenience to the calculation and also solves the problem of pre-tapped threshold reference voltage V in the prior art. REFThe disadvantage of changing after adjustment. At the same time, it also brings a benefit that the threshold reference voltage V REF The resistor string can be tapped at will according to design requirements, which greatly facilitates circuit design.
[0045] The resistance value of each resistor in the resistor string can be set to be different, or even proportional. The process of traversing the closed / open state of the switch string is equivalent to the process of successively adjusting the trimming voltage to make it close to the offset voltage. Therefore, no instrumentation is required for trimming, and only the inherent comparator in the magnetic switch can be used. Therefore, the method is simple and easy.
[0046] After the error adjustment resistor is connected in series between the two resistor strings, the error of the adjustment is adjusted from 1 step to ±0.5 steps, which is more in line with people's acceptance of errors.
[0047] Furthermore, if the magnetic switch adjustment method is fixed in the control module of the magnetic switch in the form of firmware, the magnetic switch can be packaged through a multiplexing pin (for example, the output terminal V out ) performs the adjustment process, which can not only solve the calibration problem, but also does not require additional hardware equipment for adjustment, greatly improving the efficiency of adjustment. This solution realizes the adjustment of the packaged magnetic switch without affecting the conventional 3-pin packaging mode of the existing magnetic switch. For widely used electronic components, if the subsequent new model packaging can be backward compatible, it will be very beneficial to the upgrade of electronic equipment, which can save a lot of money for the manufacturer, avoid repeated research and development, mold opening and other costs, and can greatly improve production efficiency and shorten the product market launch cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A circuit structure diagram of a trimming circuit with resistors arranged in equal proportions in one embodiment of the present invention;
[0049] Figure 2 This is the basic electrical schematic diagram of the magnetic switch;
[0050] Figure 3 Based on Figure 1 The embodiment shown selects a circuit diagram for adjusting specific parameters;
[0051] Figure 4 is a block diagram of a control system in one embodiment of the present invention;
[0052] Figure 5 for Figure 4 An example of a waveform diagram of serial communication in the system shown;
[0053] Figure 6 for Figure 4 A control flow chart of the adjustment method in the system shown;
[0054] Figure 7A schematic diagram of the arrangement of a trimming switch and a trimming resistor in one embodiment of the present invention;
[0055] Figure 8 A circuit structure diagram of a trimming circuit with resistors arranged in equal differences in one embodiment of the present invention;
[0056] Fig. 9 Based on Figure 8 The embodiment shown selects a circuit diagram for adjusting specific parameters;
[0057] Fig.10 Another adjustment circuit diagram for selecting specific parameters according to an embodiment of the present invention. Specific embodiments
[0058] In order to make the purpose and features of the present invention more obvious and easy to understand, the specific embodiments of the present invention are further described below in conjunction with the accompanying drawings. However, the present invention can be implemented in different forms and should not be limited to the described embodiments. Moreover, the embodiments of the present invention and the features in the embodiments are allowed to be combined or replaced with each other in the absence of conflict. The advantages and features of the present invention will become clearer in conjunction with the following description.
[0059] It should be noted that the drawings are all in very simplified form and in non-precise proportions, and are only used to conveniently and clearly assist in explaining the embodiments of the present invention.
[0060] It should also be noted that the purpose of numbering the steps in the present invention is to facilitate reference, rather than to limit the order of precedence. For individual steps that require emphasis on the order, they will be specifically described in the text with special text.
[0061] Figure 2 The following is the basic electrical schematic diagram of the magnetic switch. The magnetic switch will accurately follow the changes in the spatial magnetic flux density and accurately give a switch signal. When the magnetic switch is in a zero magnetic field environment, Figure 2 The two magnetic resistors R in the magnetic resistor module 201 MRA and R MRB The bridge voltage V bridge Theoretically, it should be the power supply voltage V BG half, that is, ideally, the magnetic resistance R MRA and R MRB The values of should be equal. The voltage V drawn between the two resistors R1 and R2 in the reference module 202 com The same should be the power supply voltage V BG That is to say, ideally, the values of resistance R1 and R2 should also be equal. However, in practice, due to defects in chip manufacturing process and chip packaging process, the magnetic resistance R MRA and R MRBAnd the resistors R1 and R2 do not meet the design expectations and cannot accurately divide the voltage, thus introducing an offset voltage. Therefore, in fact, Figure 2 The voltage value input to the non-inverting input terminal of the comparator 203 is equal to the theoretical bridge voltage V bridge and offset voltage V os (It is known to those skilled in the art that the comparator also has the problem of offset voltage. Here, V os All offset voltages are included and are a comprehensive value). Therefore, it is necessary to com A corresponding adjustment voltage V trim , to correct the offset voltage V os The error caused by Figure 2 The voltages in the circuit shown have the following relationship: V bridge +V os =V com +V trim In theory, Figure 2 In the circuit shown, the bridge voltage V bridge and reference voltage V com The value of is equal, therefore, the purpose of the adjustment is to reduce the offset voltage V os and trim voltage V trim The values are adjusted to be consistent (or approximately consistent).
[0062] according to Figure 2 In the circuit shown, the voltage V com The calculation formula is:
[0063]
[0064] Therefore, the voltage V can be adjusted by adjusting the values of the first resistor R1 and the second resistor R2. com , that is, at voltage V com The theoretical value is added to adjust the trimming voltage V trim The idea of the present invention is to design a reasonable trimming circuit to simplify the calculation process, so as to finally obtain a suitable trimming voltage V by a programmed automatic adjustment method. trim The voltage V com .
[0065] Those skilled in the art should know that Figure 2 In the schematic diagram shown, the trim voltage V trim The actual value should be the voltage between the first resistor R1 and the second resistor R2 minus the voltage V com (0.5V BG ); offset voltage V os The actual value should be two magnetic resistance R MRA and R MRBThe voltage between the bridge voltage V bridge (0.5V BG ). It should be noted here that, for the convenience of the following text, the voltage value drawn between the first resistor R1 and the second resistor R2 is uniformly referred to as the adjustment voltage V trim , the two magnetic resistors R MRA and R MRB The voltage between the two is called the offset voltage V os .
[0066] The present invention first sets a symmetrical resistor string and a switch string connected in parallel therewith, and through orderly adjustment of the switches, the denominator in formula (1) is kept constant, so that only the ratio of the numerator to the denominator needs to be concerned. Furthermore, the resistance value in the resistor string is reasonably set so that the numerator and denominator in formula (1) form a proportional relationship. Then, the specific resistance value of the resistor can be further ignored, and only the common ratio of the geometric progression or the tolerance of the arithmetic progression needs to be concerned, which is conducive to the digital control and adjustment process. On this basis, the combination of the open / closed state of the adjustment switch is continuously tried through the control program, which is equivalent to the process of selecting the numerator, which is actually the process of adjusting the adjustment voltage; traversing all the open / closed states of the adjustment switch is the process of the adjustment voltage gradually approaching the offset voltage.
[0067] Please refer to Figure 1 , Figure 1 The first resistor string R 串 and the second resistor string R' 串 The circuit structure diagram of the adjustment circuit in which the resistors are arranged in equal proportion. Based on the above concept, the present invention first proposes an offset voltage adjustment method, which can adjust the offset voltage of the magnetic switch in a zero magnetic field environment. A first resistor string R with the same structure is symmetrically connected in series at both ends of the adjustment object. 串 and the second resistor string R' 串 , the first resistor string R 串 and the second resistor string R' 串 Each of the trimming resistors is connected in series with a trimming switch (S0 to S1). X-1 and S'0~S' X-1 ) in parallel with the first resistor string R 串 The parallel-connected trimming switches form the first switch string S 串 , and the second resistor string R' 串 The parallel-connected trimming switches form the second switch string S' 串 , the first switch string S 串 and the second switch string S' 串 The two corresponding trimming switches (i.e., S0 and S'0, ..., S X-1 With S' X-1) always maintains the opposite closed / open state, thereby ensuring that the first resistor string R 串 and the second resistor string S' 串 The total resistance is constant at 1 / 2×(R 串 +R' 串 )=R 串 =R' 串 The first resistor string R 串 and the second resistor string R' 串 The voltage between is used as the adjustment voltage V trim ,but Figure 1 In the circuit shown, the trimming voltage V trim The adjustable range is
[0068] As described above, the first switch string S 串 and the second switch string S' 串 The two corresponding switches (i.e., S0 and S'0, ... S X-1 With S' X-1 ) maintains the opposite closed / open state, and only the second switch string S' is described below. 串 The closed / open state of the first switch string S 串 The closed / open states of are opposite by default.
[0069] Figure 1 FIG. 1 is an embodiment of the present invention. In this embodiment, the first resistor string R 串 and the second resistor string R' 串 The resistance values in the equation are set as a geometric progression The resistance value of the trimmed object is set to 2NR U , the first switch string S 串 and the second switch string S' 串 The first resistor string R 串 and the second resistor string R' 串 For details on the corresponding relationship, see Figure 1 .
[0070] Combined with reference Figure 1 and Figure 2 , from the half resistance of the adjustment object (i.e. Figure 2 The trimming voltage V is drawn between R1 and R2 in trim , when the second switch string S' 串 When all switches are closed, the trim voltage V trim for This is Figure 1 The minimum trim voltage V in the circuit shown trim , if V os <V trimThis directly exceeds the adjustable range. That is, this embodiment needs to be adjusted from V os >V trim Status starts to adjust, if it is necessary to change from V os <V trim If you start adjusting from the state of Figure 1 The circuit shown is not described here in detail.
[0071] Adjust the second switch string S' 串 If the trimming switch S'0 in the circuit is open and the other trimming switches are closed, the trimming voltage
[0072] The second switch string S' 串 Press the trim switch (S' X-1 , ..., S'0), since the switch has only two values 0 and 1, therefore, the second switch string S' 串 When all switches of the second switch string S' are closed, 串 The state is (0...0), and the second switch string S' is adjusted 串 When S0 is disconnected, the second switch string S' 串 The state of is (0...1). The second switch string S' is traversed in the order of binary numbers from all 0 to all 1. 串 All closed / open states, at this time, the adjustment voltage V trim Gradually increase it and compare it with the offset voltage V os Compare, when V os <V trim When the traversal is stopped, the second switch string S' can be recorded. 串 The current or previous state of the closed / open state. If the current state is selected, the voltage V trim The error range is If the previous state is selected, the voltage V trim The error range is
[0073] The above embodiment is Figure 1 The circuit diagram shown in the figure illustrates a situation where a trimming switch and a trimming resistor are used in combination. A person skilled in the art will appreciate that the trimming switch and the trimming resistor may also be arranged in other structures, for example, Figure 7 As shown, the trimming switches and trimming resistors are still set one-to-one, but one end of all the trimming switches is connected to point A and the other end is connected to one end of the corresponding trimming resistor. In this case, the traversal process of the trimming switches is relatively simple and will not be repeated here.
[0074] It is known to those skilled in the art that Figure 7Different configurations of the trim switch are shown, which can be combined with other embodiments of the present invention to form more other embodiments based on the same inventive concept.
[0075] Please continue to refer to Figure 1 In order to adjust the error range to a more common range with 0 as the center point, it is also possible to add a resistor R 串 and the second resistor string R' 串 The resistance values are set to The first error adjustment resistor and the second error adjustment resistor and the first error adjustment switch S connected in parallel therewith shift and the second error adjustment switch S' shift The first error adjustment switch S shift and the second error adjustment switch S' shift In the first switch string S 串 and the second switch string S' 串 When traversing the open / closed state, randomly keep one closed and one closed state and do not participate in the traversal. When the traversal is completed, according to the selected second switch string S' 串 The open / closed state of the second error adjustment switch S' shift The closed / open state of the first error adjustment switch S shift Specifically, if the second switch string S' 串 The current state, V os <V trim state, then close the second error adjustment switch S' shift , which is equivalent to making the trimming voltage V trim Reduced, thereby achieving the purpose of overall moving error range. If the previous state is selected, that is, V os >V trim state, the second error adjustment switch S' is disconnected shift , which is equivalent to making the trimming voltage V trim Increase, at this time, the error range is moved as a whole in the other direction.
[0076] Preferably, let m=2, then, each time the second error adjustment switch S' is changed shift When the step length is Adjust the first error adjustment switch S shift and the second error adjustment switch S' shift When or Adjust to
[0077] Figure 3 Shown is the Figure 1 The circuit structure shown is applied to Figure 2 An embodiment of the magnetic switch circuit shown in FIG. Figure 3 Circuit replacement Figure 2 The dotted frame part in the middle can be used to adjust the magnetic switch after packaging. Figure 3 V ref After the adjustment is completed, it can be used to set / change the comparator 203 (such as Figure 2 The comparison threshold can be obtained from Figure 2 Any portion of R2 is tapped as shown without being subject to the greater limitations of the prior art.
[0078] In this embodiment, m=2, X=4, that is, the first resistor string R 串 and the second resistor string R' 串 Each of the four trimming resistors has a resistance ratio of 1 / 2, and the trimming switches on the trimming resistors are (S3, S2, S1, S0) and (S'3, S'2, S'1, S'0).
[0079] Combination Figure 2 and Figure 3 The magnetic switch including the trimming circuit disclosed in the present invention comprises a magnetic resistance module 201, a reference resistance module 202 and a comparator 203. An offset voltage V is derived from the magnetic resistance module 201. os , a trimming voltage V is derived from the reference resistor module Vtrim trim ; The offset voltage V os is connected to the non-inverting input terminal of the comparator 203, the trimming voltage V trim is connected to the inverting input terminal of the comparator 203; the comparator 203 outputs the comparison result of the offset voltage and the trimming voltage. Specifically, if V os >V trim , then the output OUT=1, if V os <V trim , then the output OUT=0. Since most of the magnetic switches are packaged with V os >V trim (ie, OUT=1), the trimming process of this embodiment is to gradually increase the trimming voltage V trim , so that it gradually approaches the offset voltage V os , and each time the adjustment voltage V trim After that, the output OUT value is read once. When the output OUT = 0, it means that the current trimming voltage V trim and the previous trimming voltage V trim is closest to the offset voltage V os The absolute values of the errors of the two trimming voltage values are both within Within.
[0080] Figure 2 The circuit in the dotted box is adjusted as follows Figure 3 As shown, the power supply V BG To ground GND, connect the first resistor string R 串 (See Figure 1 ), a first resistor R1 (resistance is NRu), a second resistor R2 (resistance is NRu) and a second resistor string R' 串 (See Figure 1 ). Among them, the first resistor string R 串 and the second resistor string R' 串 Each of the four trimming resistors includes four trimming resistors with resistance values of Ru, 1 / 2Ru, 1 / 4Ru and 1 / 8Ru, and the trimming switches connected in parallel on the four trimming resistors are (S3, S2, S1, S0) and (S'3, S'2, S'1, S'0) respectively. When digital control is performed, the trimming switches can be closed / opened by a 4-bit binary number S'. For example, when S'=0000, the states of the trimming switches (S'3, S'2, S'1, S'0) are all closed, and when S'=0001, S'0 in the trimming switches (S'3, S'2, S'1, S'0) is in an open state.
[0081] More specifically, when S'=0000, the trimming switches (S'3, S'2, S'1, S'0) are all closed, and the corresponding resistors are all short-circuited, which is equivalent to the second resistor string R' 串 None of them are connected to the circuit; and correspondingly, all the trimming switches (S3, S2, S1, S0) are disconnected, that is, all the corresponding resistors are connected to the circuit. This is Figure 3 The minimum value that the circuit shown can achieve is that if at this time, V os <V trim This means that the offset voltage exceeds the adjustable range and the chip is considered to be waste.
[0082] When S'=0001, the trimming switch S'0 is open, and the trimming switches (S'3, S'2, S'1) are closed, that is, the second resistor string R' 串 The resistor with a resistance value of 1 / 8Ru is connected to the circuit, and the other resistors are short-circuited; accordingly, the trimming switch S'0 is closed, and the trimming switches (S'3, S'2, S'1) are opened, that is, the first resistor string R 串 The resistor with a resistance value of 1 / 8Ru is short-circuited, and the other resistors are connected to the circuit. This value is also used to adjust the trimming voltage V in this embodiment. trim The step size is, every time the binary number S' increases by 1, the voltage V is adjusted trim Increase the step length.
[0083] When S'=1111, all the trimming switches (S'3, S'2, S'1, S'0) are disconnected, that is, all the corresponding resistors are connected to the circuit; and correspondingly, all the trimming switches (S3, S2, S1, S0) are closed, and all the corresponding resistors are short-circuited. At this time, This is Figure 3 The maximum measurement value that the circuit shown can achieve is that if at this time, V os Greater than V trim This means that the offset voltage exceeds the adjustment range and the chip can be judged as waste.
[0084] Please continue to refer to Figure 3 , assuming that when S'=1100, that is, the state of the trimming switch (S'3, S'2, S'1, S'0) is (open, open, closed, closed), the value of the output OUT changes from 1 to 0, then the current trimming switch state S'=1100 can be taken as the trimming result, and the trimming voltage at this time The error range is a positive step length; if the previous state S'=1011 is selected as the adjustment result, the adjustment voltage Its error margin is negative one step length.
[0085] The above error range is not suitable for current habits. In order to make the error range plus or minus 0.5 steps, Figure 3 The error adjustment resistor is also included, and its value and setting are as follows Figure 3 As shown. According to the adjustment voltage V trim From the calculation formula, we can know that setting two error adjustment resistors and a parallel error adjustment switch S shift and S' shift In order to adjust the voltage V trim The calculation formula keeps the denominator unchanged; setting its value to half of the minimum value in the resistor string can adjust the half-step length (to be precise, the approximate half-step length).
[0086] Specifically, when adjusting the binary value S', the error adjustment switch S is kept shift Close, error adjustment switch S' shift If S'=1100, the value of output OUT changes from 1 to 0. If S'=1100 is selected as the adjustment result, the error adjustment switch S' shift Set to 0, i.e. closed state, short-circuiting the corresponding resistor. Correspondingly, the error adjustment switch S shift is 1, the effect achieved is to adjust the voltage V trim Decrease the step size by 0.5.
[0087] If you need to select S'=1011 as the adjustment result, when adjusting the binary value S', keep the error adjustment switch S shift Disconnect, error adjustment switch S'shift Close the switch and make sure S'=1011 is selected as the adjustment result. shift Set to 1, that is, disconnected state, accordingly, the error adjustment switch S shift is 0, the effect achieved is to adjust the voltage V trim Increase the step size by 0.5.
[0088] After the above adjustment, the voltage V trim The error range is
[0089] Figure 3 The advantage of using Ru as the basic unit and selecting all resistors in proportion is that the voltage V trim The calculation process of has nothing to do with Ru, and the corresponding control program does not need to obtain the actual value of each resistor, so it is more universal.
[0090] If Figure 1 The first resistor string R in the circuit structure shown 串 and the second resistor string R' 串 The resistance values in are set as an arithmetic progression, and we get Figure 8 The circuit structure diagram of the adjustment circuit with equal-difference resistor settings is shown. Figure 8 and Figure 1 These are two similar technical solutions based on the same inventive concept. The main circuit structure and the control requirements for the trimming switch are consistent. The only difference is that the first resistor string R 串 and the second resistor string R' 串 The different values of , and the resulting differences in the adjustment effects / processes.
[0091] Figure 8 The first resistor string R 串 and the second resistor string R' 串 The X resistors in the first switch string S are set to Ru, Ru+d, ..., Ru+(X-2)d, Ru+(X-1)d in sequence. 串 and the second switch string S' 串 The two corresponding trimming switches (i.e., S0 and S'0, ..., S X-1 With S' X-1 ) always maintains the opposite closed / open state, Figure 8 In the circuit shown, the first resistor string R 串 and the second resistor string S' 串 The total resistance is always constant at 1 / 2×(R 串 +R' 串 )=R 串 =R' 串 Similarly, the first resistor string R串 and the second resistor string R' 串 The voltage between is used as the adjustment voltage V trim ,but Figure 8 In the circuit shown, the trimming voltage V trim The adjustable range is also
[0092] Fig. 9 It is a command Figure 8 An embodiment obtained by combining X = 4 and d = Ru. Figure 2 As shown in the magnetic switch schematic diagram, the power supply V BG To ground GND, connect the first resistor string R 串 (See Figure 1 ), a first resistor R1 (resistance is NRu), a second resistor R2 (resistance is NRu) and a second resistor string R' 串 (See Figure 1 ). Similar to the above, the trimming switches connected in parallel on the four trimming resistors are (S3, S2, S1, S0) and (S'3, S'2, S'1, S'0) in sequence. When digital control is performed, the trimming switches are closed / opened by a 4-bit binary number S' (S). When S'=0000, the trimming switches (S'3, S'2, S'1, S'0) are all closed, and the corresponding resistors are all short-circuited, which is equivalent to the second resistor string R' 串 None of them are connected to the circuit; and correspondingly, all the trimming switches (S3, S2, S1, S0) are disconnected, that is, all the corresponding resistors are connected to the circuit. This is Fig. 9 The minimum value that the circuit shown can achieve is that if at this time, V os <V trim This means that the offset voltage exceeds the adjustable range and the chip is considered to be waste.
[0093] When S'=0001, the trimming switch S'0 is open, and the trimming switches (S'3, S'2, S'1) are closed, that is, the second resistor string R' 串 The resistor with a resistance value of Ru is connected to the circuit, and the other resistors are short-circuited; accordingly, the trimming switch S'0 is closed, and the trimming switches (S'3, S'2, S'1) are opened, that is, the first resistor string R 串 The resistor with a resistance value of Ru is short-circuited, and the other resistors are connected to the circuit. This value is also used to adjust the trimming voltage V in this embodiment. trim The step length.
[0094] When S'=1111, all the trimming switches (S'3, S'2, S'1, S'0) are disconnected, that is, all the corresponding resistors are connected to the circuit; and correspondingly, all the trimming switches (S3, S2, S1, S0) are closed, and all the corresponding resistors are short-circuited. At this time, This is Fig. 9 The maximum measurement value that the circuit shown can achieve is that if at this time, V os Greater than V trim This means that the offset voltage exceeds the adjustment range and the chip can be judged to be a waste.
[0095] and Figure 3 The adjustment process is different in that Fig. 9 The circuit shown has repeated resistance values (i.e., the same V trim ), for example, when S'=0011 and S'=0100, V trim are equal to When S'=0101 and S'=1000, V trim are equal to Therefore, in the case of 4 trimming resistors / trimming switches, there are only 11 valid switch open / closed states. In the case of X trimming resistors / trimming switches, the valid switch open / closed states can be specifically analyzed and will not be described here.
[0096] Please continue to refer to Fig. 9 , assuming that when S'=0111, that is, the state of the trimming switch (S'3, S'2, S'1, S'0) is (closed, open, open, open), the value of the output OUT changes from 1 to 0, then the current trimming switch state S'=0111 can be taken as the trimming result, and the trimming voltage at this time The error range is a positive step length; if the previous state S'=0110 is selected as the adjustment result, the adjustment voltage Its error margin is negative one step length.
[0097] If you want to adjust the error range to plus or minus 0.5 steps, you can do Fig. 9 As shown, the resistance of the error adjustment resistor is set to 0.5Ru, and the corresponding error adjustment switch S shift and S' shift The setting and control methods are as described above. Figure 3 Same description as . Fig. 9 The circuit shown in the figure has an error range of
[0098] If further limited Fig. 9 If the tolerance in is 0, we get Fig.10 The circuit diagram shown. Fig.10In the case of BG To ground GND, connect the first resistor string R 串 (See Figure 1 ), a first resistor R1 (resistance is NRu), a second resistor R2 (resistance is NRu) and a second resistor string R' 串 (See Figure 1 ). Among them, the first resistor string R 串 and the second resistor string R' 串 The resistance of all trimming resistors in is Ru. It can be seen by ordinary technicians in this field that Fig.10 The resistance of the selected trimming resistor is both an arithmetic progression with a tolerance of 0 and a geometric progression with a common ratio of 1. In this case, the valid states of the trimming switch string S' are only 0000, 0001, 0011, 0111 and 1111, and the rest are repeated. Fig.10 In the case of the circuit shown, the adjustment process is simpler. It only needs to traverse 5 states to obtain the adjustment result. The error range adjustment is consistent with the previous description.
[0099] Figure 4 The figure shows a control system block diagram of a magnetic switch automatic adjustment system, the system is used to calculate the adjustment voltage to eliminate the influence of the magnetic switch offset voltage. The system includes hardware and software, which are all or partially solidified in the packaged magnetic switch 100, including: a magnetic switch 3 containing an adjustment circuit, a communication control unit 1, a non-volatile memory 2 and a traversal control unit 12. The traversal control unit 12 can be connected to the communication control unit 1 through a communication port to form a semi-automatic adjustment system, and the adjustment system can temporarily adjust the adjustment content or adjustment method by manually adjusting parameters. At this time, the packaged magnetic switch 100 also includes a selection switch 4 for selecting whether the output end works in a communication state or an output state; the traversal control unit 12 can also be directly set in the communication control unit 1 to form a fully automatic adjustment system, and the adjustment system automatically executes the adjustment method solidified in the communication control unit 1 when the magnetic switch is powered on for the first time after packaging, completes the adjustment work without human intervention, and then automatically enters the normal working state, that is, the state of normal output switch signal.
[0100] Specifically, the adjustment circuit included in the magnetic switch 3 is as follows: Figure 3 As shown, the magnetic switch 3 is controlled by the communication control unit 1, and changes the first switch string S in the trimming circuit according to the trimming switch state. 串 and the second switch string S' 串 The closed / open state of the communication control unit 1 is detected and the comparison result given by the output terminal OUT is fed back to the communication control unit 1.
[0101] The non-volatile memory 2 includes a trimming switch state register 22 for storing the trimming result of the trimming switch, that is, the first switch string S 串 and / or a second switch string S' 串 When the trimming is finished, the communication control unit 1 writes the trimming result of the trimming switch into the trimming switch state register 22. When the packaged magnetic switch 100 is in normal working state, the communication control unit 1 reads the trimming switch state register 22 to control the closed / open state of the trimming switch included in the magnetic switch 3.
[0102] During adjustment, the communication control unit 1 receives the instruction of the traversal control unit 12 through the communication port 11 to adjust the first switch string S 串 and the second switch string S' 串 The closed / open state of the control unit 11 is changed, thereby changing the value of the trimming voltage; at the same time, the comparison result is sent to the traversal control unit 12 through the communication port 11.
[0103] The ergodic control unit 12 selects the second switch string S′ when the trimming voltage is closest to the offset voltage. 串 The closed / open state is taken as the adjustment result and saved in the switch state register 22. The adjustment result includes two possibilities: the adjustment voltage is slightly greater than the offset voltage or the adjustment voltage is slightly less than the adjustment voltage. That is, the second switch string S' is selected when the output terminal OUT jumps 串 The closed / open state of the output terminal OUT is used as the adjustment result, or the second switch string S' before the output terminal OUT jumps is selected. 串 The closed / open state of the two adjustment results is taken as the adjustment result. The error range of the two adjustment results is the same and can be selected arbitrarily.
[0104] There are at least two ways to enable the packaged magnetic switch 100 to enter the trimming state after power-on.
[0105] First, the packaged magnetic switch 100 further includes a trimming / output selection switch 4, and the non-volatile memory 2 further includes a selection switch state register 21. During packaging, the selection switch state register 21 is preset to a trimming state, that is, the output end of the packaged magnetic switch 100 is connected to the internal communication port 11, rather than to the internal analog output (such as Figure 4 As shown), at this time, the communication control unit 1 is connected to the traversal control unit 12 via the communication port 11. Afterwards, the communication control unit 1 and the traversal control unit 12 jointly control the adjustment process to determine the first switch string S 串 and the second switch string S' 串Finally, the selection switch state register 21 needs to be reset to the output state. When the packaged magnetic switch 100 is powered on again, it can enter the normal analog signal output state. In other words, this method is a one-time method. Once the adjustment is confirmed to be completed, it cannot be adjusted again in the future.
[0106] Similarly, in another embodiment where the traversal control unit 12 is included in the communication control unit 1, since there is no trimming / output selection switch 4, there is no need to set the trimming / output selection switch 4 to the trimming state. After the communication control unit 1 reads the selection switch state register 21, it directly controls the traversal control unit 12 to start working.
[0107] Secondly, the adjustment state can also be entered by means of communication confirmation. The initialization program of the communication control unit 1 is modified to include a query module. Each time the power is turned on, the query module queries whether it is necessary to enter the adjustment state through the output end of the packaged magnetic switch 100. If so, it enters the adjustment state. If there is no response after the timeout, it directly enters the normal working state. This method, combined with the structure in which the traversal control unit 12 is set outside the packaged magnetic switch 100, can flexibly enter the adjustment state, and adjust repeatedly for multiple times. It has better adaptability to circuits whose offset voltage changes over time. However, since a query is required each time the power is turned on, a certain time cost is required.
[0108] Figure 5 and Figure 6 A diagram illustrating an automatic adjustment method for a magnetic switch. Figure 5 The protocol waveform of serial communication through an output terminal in one embodiment of the present invention is shown. In this embodiment, the duty cycle of the square wave is used to distinguish 0 and 1. As shown in the figure, a square wave with a duty cycle of 75% represents logic 1, and a square wave with a duty cycle of 25% represents logic 0. The synchronization signal Start required for serial communication is represented by a square wave with a duty cycle of 50%. When the operating frequency of the control system is much greater than the frequency of the square wave, the above protocol can work stably.
[0109] Figure 6 The flowchart of a magnetic switch automatic adjustment method is shown in FIG. Figure 4 When the magnetic switch is powered on, the communication control module 1 first reads the selector switch state register 22, and determines whether to enter the trimming state or the normal working analog output state according to the value therein. If it is the analog output state, the normal working process of the magnetic switch is entered. If it is the trimming state, in a zero magnetic field environment (i.e., no magnetic field or electric field, only the working voltage V BG The offset voltage of the magnetic switch 3 is adjusted according to the state of the magnetic switch 3, which specifically includes the following steps:
[0110] S1. Set the first switch string S 串 is in the fully closed state, the second switch string S' 串 is in the fully disconnected state. If the offset voltage V os A trimming voltage V greater than the trimming voltage trim , the magnetic switch is considered to be a waste piece and the adjustment process is exited;
[0111] S2. Set the first switch string S 串 is in the fully disconnected state, the second switch string S' 串 is in the fully closed state. If the offset voltage V os The trimming voltage V is smaller than the trimming voltage trim , the magnetic switch is considered to be a waste piece and the adjustment process is exited;
[0112] S3, sequentially connect the second switch string S' 串 The closed / open state of the first switch string S is gradually adjusted from fully closed to fully open. 串 Adjust accordingly and compare the offset voltage V after each adjustment. os Is it greater than the trimming voltage V trim If yes, stop adjusting and save the second switch string S' 串 The current closed / open state or the previous closed / open state is used as the adjustment result. If not, continue to compare;
[0113] S4: If the second switch string S' is saved in step S3 串 The current closed / open state, then adjust the second error adjustment switch state to closed, the first error adjustment switch state to open, that is, the adjustment voltage V trim If the previous closed / open state of the second switch string is saved in step S3, the second error adjustment switch state is adjusted to be open, and the first error adjustment switch state is closed, that is, the trimming voltage V trim Turn up;
[0114] S5, writing the adjustment result into the adjustment switch state register, that is, the adjustment switch state register 22 stores not only the second switch string S' 串 The value of the first switch string S 串 The value of and the value of the first error adjustment switch are automatically reversed.
[0115] In addition, after step S5, the communication control module 1 also updates the value in the switch state register 22 to the output state so that the magnetic switch can work normally when powered on next time. Otherwise, the magnetic switch enters the adjustment state every time it is powered on and cannot be used as a real switch.
[0116] It should be added that, in step S3, based on the first resistor string R 串 and the second resistor string R' 串 Due to the different values of the trimming resistor, repeated situations will occur in the process of traversing the closed / open states of the trimming switch. When designing an automatic control program, you can choose to ignore the repeated situations to simplify the control program.
[0117] In another embodiment, the switch status register 22 is not set, but the switch status register 22 is set each time the power is turned on through the pin connected to the communication port 11 (ie Figure 4 The communication / output pin in the communication / output pin) queries whether there is an external response signal. If there is the response signal, it means that the current state is the adjustment state, and enters the above-mentioned steps S1 to S5. If there is no response signal after waiting for a certain period of time, it means that the current state is the output state, and enters the normal working analog signal output process.
[0118] The above-mentioned adjustment circuit, adjustment method, and adjustment system realize the adjustment of the packaged magnetic switch by improving the existing circuit of the magnetic switch and cooperating with the corresponding adjustment method without affecting the conventional 3-pin packaging mode of the existing magnetic switch. For widely used electronic components, if the subsequent new model packaging can be backward compatible, it is very beneficial to the upgrade of electronic equipment, which can save a lot of money for the manufacturer, avoid repeated research and development, mold opening and other expenses, can greatly improve production efficiency, and shorten the cycle of product launch.
[0119] Obviously, those skilled in the art can make various changes and modifications to the invention without departing from the spirit and scope of the invention. Thus, if these modifications and variations of the invention fall within the scope of the claims of the invention and their equivalents, the invention is also intended to include these modifications and variations.
Claims
1. A method for adjusting an offset voltage, characterized in that: A first resistor string and a second resistor string having the same structure are symmetrically connected in series at both ends of the trimming object, wherein the first resistor string and the second resistor string are both composed of a plurality of trimming resistors connected in series, and each of the trimming resistors is respectively connected in parallel with a trimming switch; The trimming switches connected in parallel with the trimming resistors in the first resistor string constitute a first switch string, and the trimming switches connected in parallel with the trimming resistors in the second resistor string constitute a second switch string; the two corresponding trimming switches in the first switch string and the second switch string maintain opposite closed / open states, thereby ensuring that the total resistance of the first resistor string and the second resistor string is constant; Drawing out the voltage of the second resistor string as a trimming voltage; Traversing all the closed / open states of the second switch string to change the value of the trimmed voltage, the closed / open state of the first switch string changing accordingly; The magnitudes of the trimming voltage and the offset voltage are compared to determine a final trimming result.
2. The method according to claim 1, characterized in that The resistance values of the trimming resistors in the first resistor string and the second resistor string are respectively set to be a geometric progression or an arithmetic progression.
3. The method according to claim 2, characterized in that The first resistor string further includes a first error adjustment resistor and a first error adjustment switch connected in parallel with the first error adjustment resistor; the second resistor string further includes a second error adjustment resistor and a second error adjustment switch connected in parallel with the second error adjustment resistor; When traversing all the closed / open states of the second switch string, the first error adjustment switch and the second error adjustment switch maintain the original state of one closed and one open; If the offset voltage is less than the trimming voltage when the trimming result is finally selected, the state of the second error adjustment switch is adjusted to be closed, and the state of the first error adjustment switch is adjusted to be open; If the offset voltage is greater than the trimming voltage when the trimming result is finally selected, the state of the second error adjustment switch is adjusted to be open, and the state of the first error adjustment switch is adjusted to be closed.
4. A magnetic switch comprising a trimming circuit, characterized in that: include: A magnetoresistive module, a reference resistor module and a comparator, wherein an offset voltage is drawn from the magnetoresistive module, and a trimming voltage is drawn from the reference resistor module; the offset voltage is connected to one input terminal of the comparator, and the trimming voltage is connected to another input terminal of the comparator; and the comparator outputs a comparison result between the offset voltage and the trimming voltage; The trimming circuit included in the reference resistance module has the following structure: A first resistor string, a first resistor, a second resistor, and a second resistor string are sequentially connected in series from the power supply to the ground; wherein the first resistor string and the second resistor string have the same structure and are formed by connecting the same number of trimming resistors with the same resistance value in series; the resistance value of each trimming resistor is fixed, and each trimming resistor is connected in parallel with a trimming switch; The trimming circuit is trimmed in a zero magnetic field environment, the closed / open states of the corresponding trimming switches in the first resistor string and the second resistor string remain mutually opposite, and the trimming voltage is drawn between the first resistor and the second resistor.
5. The magnetic switch according to claim 4, characterized in that: The resistance values of the trimming resistors are in a geometric progression or an arithmetic progression relationship.
6. The magnetic switch according to claim 5, characterized in that The common ratio of the geometric progression is 2 or 1 / 2; or, the common difference of the arithmetic progression is 0.
7. The magnetic switch according to claim 4 or 5, characterized in that: The resistance values of the first resistor and the second resistor are the same and are N times the maximum value of the trimming resistor, where N is a natural number.
8. The magnetic switch according to claim 4, characterized in that The first resistor string and the second resistor string also include an error adjustment resistor and an error adjustment switch respectively connected in parallel therewith, the resistance value of the error adjustment resistor is 1 / 2 of the minimum value of the adjustment resistor, and the adjustment error is adjusted by changing the closed / open state of the error adjustment switch.
9. A magnetic switch automatic adjustment system, characterized in that: include: A magnetic switch comprising a trimming circuit, a communication control unit, a non-volatile memory and a traversal control unit as claimed in any one of claims 4 to 8; The non-volatile memory includes a trimming switch status register for storing the trimming result of the trimming switch. When the trimming is completed, the communication control unit writes the trimming result of the trimming switch into the trimming switch status register; In normal working state, the communication control unit reads the trimming switch state register to control the closing / opening state of the trimming switch; During trimming, the communication control unit receives the instruction of the ergodic control unit to adjust the on / off state of the first switch string and the second switch string, thereby changing the value of the trimming voltage; at the same time, the comparison result is sent to the ergodic control unit through the communication port; The traversal control unit selects the closed / open state of the second switch string as the adjustment result according to the comparison result, and saves it to the adjustment switch state register.
10. The system according to claim 9, characterized in that It also includes a trimming / output selection switch, and the non-volatile memory also includes a selection switch state register for storing the state of the trimming / output selection switch; The selector switch status register is initialized to the trimming state when production is completed. After the magnetic switch is powered on, the communication control unit reads the selector switch status register and places the trimming / output selector switch in the trimming position, thereby entering the trimming state. After the adjustment is completed, the communication control unit modifies the content of the selection switch state register to the output state, and the magnetic switch enters the normal working state after being powered on again.
11. The system according to claim 9, characterized in that The communication control unit further includes a query module. Each time the magnetic switch is powered on, the query module queries through the output end of the magnetic switch whether it is necessary to enter the adjustment state. If so, the adjustment state is entered. If there is no response after a timeout, the normal working state is directly entered.
12. The system according to claim 11, characterized in that The traversal control unit is arranged outside the magnetic switch, and controls the traversal process through the output end of the magnetic switch; or, the traversal control unit is arranged inside the magnetic switch, and controls the traversal process through an internal communication bus.
13. The system of claim 9, wherein: The trimming circuit also includes a first error adjustment resistor and a first error adjustment switch connected in parallel therewith, and a second error adjustment resistor and a second error adjustment switch connected in parallel therewith, wherein the resistance values of the first error adjustment resistor and the second error adjustment resistor are 1 / 2 of the minimum value of the trimming resistors, and after determining the state of the second switch string, the first error adjustment switch and the second error adjustment switch are adjusted to adjust the error range of the trimming result.
14. A method for automatically adjusting a magnetic switch, characterized in that: The offset voltage of the magnetic switch is adjusted based on the system according to any one of claims 9 to 13, and the magnetic switch is adjusted in a zero magnetic field environment after power-on, comprising the following steps: Setting the first switch string to a fully closed state and the second switch string to a fully open state, and if the offset voltage is greater than the trimming voltage at this time, exiting the trimming process; Setting the first switch string to a fully open state and the second switch string to a fully closed state, and if the offset voltage is less than the trimming voltage at this time, exiting the trimming process; The closed / open state of the second switch string is adjusted gradually from fully closed to fully open in sequence, and the first switch string is adjusted accordingly. After each adjustment, the trimmed voltage is compared to see whether it is greater than the offset voltage. If so, the trimming is stopped and the current closed / open state or the previous closed / open state of the second switch string is saved as the trimming result. If not, the comparison is continued; The trimming result is written into the trimming switch status register.
15. The method according to claim 14, characterized in that After power-on, read the selection switch status register in the non-volatile memory, and determine whether to enter the trimming state or the output state according to the content of the selection switch status register; After the adjustment is completed, the content of the selection switch state register is modified to the output state.
16. The method according to claim 14, characterized in that During power-on initialization, the trimming / output status is queried through the communication port. If the communication port responds, the trimming state is entered. If the communication port times out without response, the normal working state is entered.
17. The method according to claim 14, characterized in that The system further includes a first error adjustment resistor and a first error adjustment switch connected in parallel with the first error adjustment resistor, a second error adjustment resistor and a second error adjustment switch connected in parallel with the second error adjustment resistor, and further includes the following steps: If the current closed / open state of the second switch string is saved, the second error adjustment switch state is adjusted to be closed, and the first error adjustment switch state is adjusted to be open; If the previous closed / open state of the second switch string is saved, the second error adjustment switch state is adjusted to open, and the first error adjustment switch state is adjusted to closed.
Citation Information
Patent Citations
An implementation circuit of a high-precision absolute voltage comparator
CN109861674A
Magnetic switch comprising trimming circuit and automatic trimming system of magnetic switch
CN212628530U
Cited By
Multilevel voltage detector circuit
US12340854B2