A comparator circuit with controllable threshold and hysteresis

By introducing a threshold and hysteresis detection circuit into the comparator circuit and using external inputs to adjust the threshold and hysteresis, the problem of uncontrollable thresholds and hysteresis in the existing technology is solved, and the multi-window function and output stability of the comparator circuit are realized.

CN118316424BActive Publication Date: 2024-10-22BEIJING GALAXY-CAS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410293937.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-14
Publication Date
2024-10-22
Estimated Expiration
2044-03-14

AI Technical Summary

Technical Problem

Existing comparator circuits cannot achieve controllable threshold and hysteresis, which makes the output jump problem difficult to solve in some application scenarios.

Method used

A comparator circuit including an operational amplifier, an output stage and a threshold hysteresis detection circuit is designed. The controllability of the threshold and hysteresis is achieved through the external input of positive and negative threshold values ​​and hysteresis positive and negative input values, using an adder. And the switching circuit adjusts the threshold and hysteresis values ​​to meet the needs of different application scenarios.

Benefits of technology

It achieves the controllability of threshold and hysteresis in the comparator circuit, avoids output jumps, meets the functional requirements of multi-window comparators, and is suitable for various usage scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118316424B_ABST
    Figure CN118316424B_ABST
Patent Text Reader

Abstract

The present invention discloses a comparator circuit with controllable threshold and hysteresis, relates to the technical field of integrated circuits, and is used to solve the problem that the comparator circuit in the prior art cannot realize controllable threshold and hysteresis of the comparator. The comparator circuit comprises: an operational amplifier circuit, an output stage circuit, and a threshold and hysteresis detection circuit; the operational amplifier circuit comprises a first tail current source, a first NMOS tube and a second NMOS tube forming a differential input pair, a first PMOS tube and a second PMOS tube as a load tube; the output stage circuit comprises a third PMOS tube and a fourth PMOS tube as input tubes, a third NMOS tube and a fourth NMOS tube as load tubes; the threshold and hysteresis detection circuit comprises a fifth NMOS tube and a sixth NMOS tube forming a differential input and a second tail current source; the threshold and hysteresis detection circuit introduces a threshold positive input quantity, a threshold negative input quantity, a hysteresis positive input quantity, and a hysteresis negative input quantity of external input, and by changing these input quantities, both the threshold and the hysteresis can realize positive and negative value switching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of integrated circuits, and in particular to a comparator circuit with controllable threshold and hysteresis. Background Art

[0002] A comparator is an electronic component that outputs different voltage results at the output end by comparing the current or voltage at the two input ends. As an important analog module in integrated circuits, comparators are key components in the analog-to-digital conversion process. In the prior art, in certain application scenarios, due to the influence of factors such as noise and input offset, if the differential input of the comparator jumps near the flip threshold, the output of the comparator will also jump. In order to solve this problem, a hysteresis circuit is added to the comparator in the prior art. However, in a general hysteresis comparator, the hysteresis is fixed and it is difficult to cover all application scenarios. That is, the comparator circuit in the prior art cannot achieve controllable threshold and hysteresis of the comparator.

[0003] Therefore, there is an urgent need to provide a more reliable comparator circuit with controllable threshold and hysteresis. Summary of the invention

[0004] The object of the present invention is to provide a comparator circuit with controllable threshold and hysteresis, so as to solve the problem that the comparator circuit in the prior art cannot realize controllable threshold and hysteresis of the comparator.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] In a first aspect, the present invention provides a comparator circuit with controllable threshold and hysteresis, the comparator circuit comprising:

[0007] operational amplifier circuits, output stage circuits, and threshold and hysteresis detection circuits;

[0008] The operational amplifier circuit includes a first NMOS tube, a second NMOS tube, a first PMOS tube, a second PMOS tube and a first tail current source; the first NMOS tube and the second NMOS tube form a differential input pair; the first PMOS tube and the second PMOS tube serve as load tubes;

[0009] The output stage circuit includes a third PMOS tube, a fourth PMOS tube, a third NMOS tube and a fourth NMOS tube; the third PMOS tube and the fourth PMOS tube are used as input tubes; the third NMOS tube and the fourth NMOS tube are used as load tubes;

[0010] The threshold and hysteresis detection circuit includes a fifth NMOS tube, a sixth NMOS tube and a second tail current source; the fifth NMOS tube and the sixth NMOS tube form a differential input pair; the threshold and hysteresis detection circuit introduces an external input voltage; the external input voltage includes a threshold positive input, a threshold negative input, a hysteresis positive input and a hysteresis negative input; by changing the threshold positive input, the threshold negative input, the hysteresis positive input and the hysteresis negative input, the threshold and hysteresis in the comparator circuit are controllable.

[0011] Optionally, the comparator circuit further includes:

[0012] A first adder, a second adder, a first switch, and a second switch;

[0013] The gate voltage of the fifth NMOS tube is generated by the first adder, and the gate voltage of the fifth NMOS tube is equal to the sum of the threshold positive input and the hysteresis positive input by gating the first switch and the second switch; or the gate voltage of the fifth NMOS tube is equal to the sum of the threshold positive input and the hysteresis negative input;

[0014] The gate voltage of the sixth NMOS tube is generated by the second adder, and by enabling the first switch and the second switch, the gate voltage of the sixth NMOS tube is equal to the sum of the threshold negative input and the hysteresis positive input; or, the gate voltage of the sixth NMOS tube is equal to the sum of the threshold negative input and the hysteresis negative input.

[0015] Optionally, the threshold of the comparator circuit is the difference between the threshold positive input and the threshold negative input, and the threshold of the comparator circuit is controlled by adjusting the threshold positive input and the threshold negative input; when the threshold positive input is greater than the threshold negative input, the threshold is a positive value; when the threshold positive input is less than the threshold negative input, the threshold is a negative value.

[0016] Optionally, the comparator circuit further includes:

[0017] Output stage driver;

[0018] The output stage driver shapes the output of the comparator circuit and converts the output into a standard pulse signal; the enabling of the first switch and the second switch is controlled by the standard pulse signal output by the comparator.

[0019] Optionally, the comparator circuit also provides a hysteresis of a flip threshold for the comparator;

[0020] When the output of the comparator circuit is 0, the first switch connects the hysteresis positive input to the first adder, and superimposes the hysteresis positive input on the threshold positive input;

[0021] The second switch connects the hysteresis negative input to the second adder, and superimposes the hysteresis negative input on the threshold negative input. At this time, the threshold at which the output of the comparator flips from 0 to 1 is the sum of the threshold in the comparator circuit and the hysteresis.

[0022] Optionally, when the output of the comparator circuit is 1, the first switch connects the hysteresis positive input to the second adder and superimposes it on the threshold negative input; the second switch connects the hysteresis negative input to the first adder and superimposes it on the threshold positive input. At this time, the threshold at which the comparator output flips from 1 to 0 is the difference between the threshold and hysteresis in the comparator circuit.

[0023] Optionally, the comparator circuit further includes:

[0024] Threshold and hysteresis configuration circuit; the threshold and hysteresis configuration circuit includes a digital control logic module and a digital-to-analog converter; the comparator circuit sets the corresponding comparator threshold and hysteresis according to different requirements; when setting the corresponding comparator threshold and hysteresis, the digital control logic and digital-to-analog converter integrated in the chip are used for configuration.

[0025] Optionally, the input of the digital control logic is the control word of the threshold, hysteresis and the output of the comparator circuit, and the output of the digital control logic is connected to the digital-to-analog converter. The digital-to-analog converter generates a corresponding voltage value to provide voltage bias for the fifth NMOS tube and the sixth NMOS tube to achieve the required threshold and hysteresis.

[0026] Optionally, the digital-to-analog converter is implemented by a resistor array.

[0027] Compared with the prior art, the present invention provides a comparator circuit with controllable threshold and hysteresis, comprising an operational amplifier circuit, an output stage circuit and a threshold and hysteresis detection circuit; the operational amplifier circuit comprises a first tail current source, a first NMOS tube and a second NMOS tube forming a differential input pair, a first PMOS tube and a second PMOS tube as load tubes; the output stage circuit comprises a third PMOS tube and a fourth PMOS tube as input tubes, a third NMOS tube and a fourth NMOS tube as load tubes; the threshold and hysteresis detection circuit comprises a fifth NMOS tube and a sixth NMOS tube forming a differential input and a second tail current source; the threshold and hysteresis detection circuit introduces a threshold positive input quantity, a threshold negative input quantity, a hysteresis positive input quantity and a hysteresis negative input quantity of external inputs, and by changing these input quantities, the threshold and hysteresis can realize positive and negative value switching, that is, the threshold and hysteresis in the comparator circuit can be changed by external control, thereby meeting various usage scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0029] Figure 1 This is a typical comparator circuit structure diagram;

[0030] Figure 2 A is a schematic diagram of the input and output waveforms of the comparator in a typical comparator circuit;

[0031] Figure 2 B is a schematic diagram of the output jump of a comparator without hysteresis in a typical comparator circuit;

[0032] Figure 3 is a schematic diagram of a comparator with hysteresis function;

[0033] Figure 4 The input and output diagram of a multi-window comparator with positive and negative thresholds;

[0034] Figure 5 A schematic diagram of the structure of a comparator circuit with controllable threshold and hysteresis provided by the present invention;

[0035] Figure 6 This is a schematic diagram of a threshold and hysteresis configuration circuit provided by the present invention. DETAILED DESCRIPTION

[0036] In order to clearly describe the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, words such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. For example, the first threshold and the second threshold are only used to distinguish different thresholds, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.

[0037] It should be noted that, in the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0038] In the present invention, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, the combination of a and b, the combination of a and c, the combination of b and c, or the combination of a, b and c, where a, b, c can be single or multiple.

[0039] Figure 1 A typical comparator circuit based on operational amplifier is given. The circuit consists of two parts. Part 1 is a typical operational amplifier circuit, which is composed of differential input pair tubes NM1, NM2, loads PM1, PM2 and tail current source IB1; Part 2 is the output stage circuit of Part 1 operational amplifier, which is composed of input tubes PM3, PM4 and load tubes NM3, NM4; BUF1 shapes the output of the comparator to make it a standard pulse signal for use by subsequent modules.

[0040] exist Figure 1 In the given comparator, the circuit continuously detects the differential input signal V IN,DIFF =V INP -V INN , if V IN,DIFF is greater than the comparator's flip threshold V TH , that is, VIN,DIFF >V TH , the comparator output is logic high, that is, V OUT =1; if V IN,DIFF is less than the comparator's flip threshold V TH , that is, V IN,DIFF <V TH , the comparator output is logic low, that is, V OUT = 0. The above process is as follows Figure 2 As shown in A.

[0041] In actual use, the above circuit has some shortcomings. In some application scenarios, due to the influence of noise, input offset and other factors, if the differential input V IN,DIFF At the flip threshold V TH If a jump occurs near OUT The same jump will occur, such as Figure 2 B, which is not allowed in the actual circuit system. The general solution is to add a hysteresis circuit to the comparator and set the flip threshold of the comparator output from 0 to 1 to V TH1 The flip threshold from 1 to 0 is set to V TH2 , and V TH1 =V TH2 +V HYST ,like Figure 3 As shown, V HYST is the threshold hysteresis of the comparator. However, in a general hysteresis comparator, its hysteresis V HYST It is fixed and difficult to cover all application scenarios.

[0042] Figure 3 The comparator flip threshold V TH The typical value is 0, which will reduce the comparator's differential input voltage V IN,DIFF It is divided into two voltage domains, and is represented by logic 1 and logic 0 respectively. In some applications, taking some analog-to-digital converters ADC as an example, the comparator in it needs to realize the function of "multi-window comparator" at the same time, that is, to realize the positive and negative thresholds +V TH , -V TH , thereby the comparator differential input voltage V IN,DIFF It is divided into three voltage domains and represented by logic 1, logic 0 and logic -1 respectively, such as Figure 4 In actual use, the values ​​of the positive and negative thresholds may change according to circuit requirements.

[0043] To meet the above requirements, this paper proposes a comparator structure, the threshold and hysteresis of which can be changed by external control to meet various usage scenarios.

[0044] First, the names and abbreviations used in this manual are explained:

[0045] Part 1 in the accompanying drawings represents an operational amplifier circuit, Part 2 represents an output stage circuit, Part 3 represents a threshold and hysteresis detection circuit, and Part 4 represents a threshold and hysteresis configuration circuit.

[0046] NM1 represents the first NMOS tube, NM2 represents the second NMOS tube, NM3 represents the third NMOS tube, NM4 represents the fourth NMOS tube, NM5 represents the fifth NMOS tube, and NM6 represents the sixth NMOS tube; PM1 represents the first PMOS tube, PM2 represents the second PMOS tube, PM3 represents the third PMOS tube, and PM4 represents the fourth PMOS tube.

[0047] IB1 represents the first tail current source, and IB2 represents the second tail current source. REFP Represents the threshold positive input quantity, V REFN Represents the threshold negative input quantity, V HYSTP Represents the hysteresis positive input quantity, V HYSTN Indicates the amount of hysteresis negative input.

[0048] A1 represents the first adder, A2 represents the second adder, S1 represents the first switch, S2 represents the second switch, V OUT Represents the output of the comparator circuit, V TH represents the threshold of the comparator circuit, V HYST Represents the hysteresis of the comparator circuit.

[0049] Digital control logic (Digital Control), digital-to-analog converter DAC.

[0050] Next, the solution provided by the embodiments of this specification is described in conjunction with the accompanying drawings:

[0051] like Figure 5 As shown, a comparator circuit with controllable threshold and hysteresis provided by the present invention may specifically include: an operational amplifier circuit, an output stage circuit, and a threshold and hysteresis detection circuit;

[0052] The operational amplifier circuit includes a first NMOS tube, a second NMOS tube, a first PMOS tube, a second PMOS tube and a first tail current source; the first NMOS tube and the second NMOS tube form a differential input pair; the first PMOS tube and the second PMOS tube serve as load tubes;

[0053] The output stage circuit includes a third PMOS tube, a fourth PMOS tube, a third NMOS tube and a fourth NMOS tube; the third PMOS tube and the fourth PMOS tube are used as input tubes; the third NMOS tube and the fourth NMOS tube are used as load tubes;

[0054] The threshold and hysteresis detection circuit includes a fifth NMOS tube, a sixth NMOS tube and a second tail current source; the fifth NMOS tube and the sixth NMOS tube form a differential input pair; the threshold and hysteresis detection circuit introduces an external input voltage; the external input voltage includes a threshold positive input, a threshold negative input, a hysteresis positive input and a hysteresis negative input; by changing the threshold positive input, the threshold negative input, the hysteresis positive input and the hysteresis negative input, the threshold and hysteresis in the comparator circuit are controllable.

[0055] Furthermore, if Figure 5 As shown, the comparator circuit may further include:

[0056] A first adder, a second adder, a first switch, and a second switch;

[0057] The gate voltage of the fifth NMOS tube is generated by the first adder, and the gate voltage of the fifth NMOS tube is equal to the sum of the threshold positive input and the hysteresis positive input by gating the first switch and the second switch; or the gate voltage of the fifth NMOS tube is equal to the sum of the threshold positive input and the hysteresis negative input;

[0058] The gate voltage of the sixth NMOS tube is generated by the second adder, and by enabling the first switch and the second switch, the gate voltage of the sixth NMOS tube is equal to the sum of the threshold negative input and the hysteresis positive input; or, the gate voltage of the sixth NMOS tube is equal to the sum of the threshold negative input and the hysteresis negative input.

[0059] Figure 5 The comparator circuit in may further include:

[0060] The output stage driver, i.e. Figure 5 BUF1 in;

[0061] The output stage driver shapes the output of the comparator circuit and converts the output into a standard pulse signal; the enabling of the first switch and the second switch is controlled by the standard pulse signal output by the comparator.

[0062] Figure 5 The structure in is Figure 1Based on the typical comparator, Part 3 is added, including the differential pair composed of NM5 and NM6 and the tail current source IB2, and the external input voltage V REFP 、V REFN 、V HYSTP and V HYSTN Among them, the gate voltage of NM5 is generated by adder A1, and the gate voltage of NM5 is equal to V by switching on switches S1 and S2. REFP +V HYSTP or V REFP +V HYSTN The gate voltage of NM6 is generated by adder A2, and the gate voltage of NM6 is equal to V by switching switches S1 and S2. REFN +V HYSTP or V REFN +V HYSTN The switches S1 and S2 are enabled by the comparator output V OUT The threshold and hysteresis detection circuit introduces external input threshold positive input, threshold negative input, hysteresis positive input and hysteresis negative input. By changing these inputs, both the threshold and hysteresis can be switched between positive and negative values, that is, the threshold and hysteresis in the comparator circuit can be changed by external control to meet various usage scenarios.

[0063] based on Figure 5 The embodiment of this specification also provides some specific implementation principles and implementation methods of the structure, which are described below.

[0064] In the above circuit, the comparator threshold V TH Will be Figure 1 0 in the circuit shown becomes V REFP With V REFN The difference, V TH =V REFP -V REFN By adjusting V REFP With V REFN The comparator threshold can be controlled by the value of V REFP >V REFN When V REFP <V REFN When , the threshold of the comparator is negative. This can realize the positive and negative thresholds of the comparator.

[0065] The above circuit can also provide hysteresis for the comparator to flip the threshold. OUT = 0, S1 will turn the voltage V HYSTP Connect to A1 and add to V REFP On; S2 will voltage V HYSTN Connect to A2 and add to VREFN At this time, the comparator output flips from 0 to 1, and the threshold becomes V TH1 =V REFP -V REFN +V HYSTP -V HYSTN =V TH +V HYST .

[0066] When the comparator output V OUT =1, S1 will turn the voltage V HYSTP Connect to A2 and add to V REFN On; S2 will voltage V HYSTN Connect to A1 and add to V REFP At this time, the comparator output flips from 1 to 0, and the threshold becomes V TH2 =V REFP -V REFN +V HYSTN -V HYSTP =V TH -V HYST It can be seen that the comparator can achieve V TH1 -V TH2 =2V HYST =2(V HYSTN -V HYSTP ) threshold hysteresis.

[0067] Based on the technical solution provided by the present invention, in the specific practical use process, in order to be able to set the appropriate comparator threshold and hysteresis according to different requirements, the specific application circuit diagram can be set to Figure 6 As shown, Part 4 is added. At this time, the comparator circuit may also include: a threshold and hysteresis configuration circuit; the threshold and hysteresis configuration circuit includes a digital control logic module and a digital-to-analog converter; the comparator circuit sets the corresponding comparator threshold and hysteresis according to different requirements; when setting the corresponding comparator threshold and hysteresis, the digital control logic and digital-to-analog converter integrated in the chip are used for configuration.

[0068] like Figure 6 As shown in Part 4 of the figure. The input of the digital control logic is the threshold, the hysteresis control word and the output V OUT The output of the digital control logic is connected to the DAC. The DAC generates a corresponding voltage value to provide voltage bias for NM5 and NM6 to achieve the required threshold and hysteresis. Figure 6 The DAC in the circuit can generally be realized by means of a resistor array or the like.

[0069] The present invention proposes a comparator circuit with controllable threshold and hysteresis, which generates four different voltage quantities V by integrating digital logic and DAC circuit in the chip with less additional resources.REFP 、V REFN 、V HYSTP 、V HYSTN , generating a suitable voltage input for the newly added differential input pair NM5 and NM6 in the circuit, thereby generating a controllable threshold V TH =V REFP -V REFN and hysteresis 2V HYST =2(V HYSTN -V HYSTP ). The above thresholds and hysteresis can both achieve positive and negative value switching.

[0070] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0071] Although the present invention has been described in conjunction with specific features and embodiments thereof, it is apparent that various modifications and combinations may be made thereto without departing from the spirit and scope of the present invention. Accordingly, this specification and the accompanying drawings are merely exemplary illustrations of the present invention as defined by the appended claims and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present invention. Obviously, those skilled in the art may make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, the present invention is intended to include such modifications and variations if they fall within the scope of the claims of the present invention and their equivalents.

Claims

1. A comparator circuit with controllable threshold and hysteresis, characterized in that: The comparator circuit includes: operational amplifier circuits, output stage circuits, and threshold and hysteresis detection circuits; The operational amplifier circuit includes a first NMOS tube, a second NMOS tube, a first PMOS tube, a second PMOS tube and a first tail current source; the first NMOS tube and the second NMOS tube form a differential input pair; the first PMOS tube and the second PMOS tube serve as load tubes; The output stage circuit includes a third PMOS tube, a fourth PMOS tube, a third NMOS tube and a fourth NMOS tube; the third PMOS tube and the fourth PMOS tube are used as input tubes; the third NMOS tube and the fourth NMOS tube are used as load tubes; The threshold and hysteresis detection circuit includes a fifth NMOS tube, a sixth NMOS tube and a second tail current source; the fifth NMOS tube and the sixth NMOS tube form a differential input pair; the threshold and hysteresis detection circuit introduces an external input voltage; the external input voltage includes a threshold positive input, a threshold negative input, a hysteresis positive input and a hysteresis negative input; by changing the threshold positive input, the threshold negative input, the hysteresis positive input and the hysteresis negative input, the threshold and hysteresis in the comparator circuit are controllable.

2. The comparator circuit with controllable threshold and hysteresis according to claim 1, characterized in that: The comparator circuit further comprises: A first adder, a second adder, a first switch, and a second switch; The gate voltage of the fifth NMOS tube is generated by the first adder, and the gate voltage of the fifth NMOS tube is equal to the sum of the threshold positive input and the hysteresis positive input by gating the first switch and the second switch; or the gate voltage of the fifth NMOS tube is equal to the sum of the threshold positive input and the hysteresis negative input; The gate voltage of the sixth NMOS tube is generated by the second adder, and by enabling the first switch and the second switch, the gate voltage of the sixth NMOS tube is equal to the sum of the threshold negative input and the hysteresis positive input; or, the gate voltage of the sixth NMOS tube is equal to the sum of the threshold negative input and the hysteresis negative input.

3. The comparator circuit with controllable threshold and hysteresis according to claim 1, characterized in that: The threshold of the comparator circuit is the difference between the threshold positive input and the threshold negative input. The threshold of the comparator circuit is controlled by adjusting the threshold positive input and the threshold negative input. When the threshold positive input is greater than the threshold negative input, the threshold is a positive value; when the threshold positive input is less than the threshold negative input, the threshold is a negative value.

4. The comparator circuit with controllable threshold and hysteresis according to claim 2, characterized in that: The comparator circuit further comprises: Output stage driver; The output stage driver shapes the output of the comparator circuit and converts the output into a standard pulse signal; the enabling of the first switch and the second switch is controlled by the standard pulse signal output by the comparator.

5. The comparator circuit with controllable threshold and hysteresis according to claim 4, characterized in that: The comparator circuit also provides hysteresis of the flip threshold for the comparator; When the output of the comparator circuit is 0, the first switch connects the hysteresis positive input to the first adder, and superimposes the hysteresis positive input on the threshold positive input; The second switch connects the hysteresis negative input to the second adder, and superimposes the hysteresis negative input on the threshold negative input. At this time, the threshold at which the output of the comparator flips from 0 to 1 is the sum of the threshold in the comparator circuit and the hysteresis.

6. The comparator circuit with controllable threshold and hysteresis according to claim 4, characterized in that: When the output of the comparator circuit is 1, the first switch connects the hysteresis positive input to the second adder and adds it to the threshold negative input; the second switch connects the hysteresis negative input to the first adder and adds it to the threshold positive input. At this time, the threshold at which the comparator output flips from 1 to 0 is the difference between the threshold and hysteresis in the comparator circuit.

7. The comparator circuit with controllable threshold and hysteresis according to claim 1, characterized in that: The comparator circuit further comprises: Threshold and hysteresis configuration circuit; the threshold and hysteresis configuration circuit includes a digital control logic module and a digital-to-analog converter; The comparator circuit sets corresponding comparator thresholds and hysteresis according to different requirements; when setting the corresponding comparator thresholds and hysteresis, the digital control logic and digital-to-analog converter integrated in the chip are used for configuration.

8. The comparator circuit with controllable threshold and hysteresis according to claim 7, characterized in that: The input of the digital control logic is the control word of the threshold value, hysteresis and the output of the comparator circuit. The output of the digital control logic is connected to the digital-to-analog converter. The digital-to-analog converter generates a corresponding voltage value to provide a voltage bias for the fifth NMOS tube and the sixth NMOS tube to achieve the required threshold value and hysteresis.

9. The comparator circuit with controllable threshold and hysteresis according to claim 7, characterized in that: The digital-to-analog converter is implemented by a resistor array.