CN103902291A - Method for implementing hysteresis comparator via software - Google Patents
Method for implementing hysteresis comparator via software Download PDFInfo
- Publication number
- CN103902291A CN103902291A CN201410114639.2A CN201410114639A CN103902291A CN 103902291 A CN103902291 A CN 103902291A CN 201410114639 A CN201410114639 A CN 201410114639A CN 103902291 A CN103902291 A CN 103902291A
- Authority
- CN
- China
- Prior art keywords
- section
- uov
- uuv
- hysteresis
- interval
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Disclosed is a method for implementing a hysteresis comparator via software. The method includes: setting a state to be static variable when a main program starts to enable judgment on whether the main programs is within a section (Uuv, Uov) or not, if not, calling a subprogram in a search section to search the section, and finally entering corresponding processing programs; searching a subprogram in the section, returning a value to represent the section and finishing searching of the section via a loop statement; enlarging the section (Uuv, Uov) to be (Uuv-B1, Uov+B2) to form a hysteresis section by judging whether the subprogram is within a certain section. The method for implementing the hysteresis comparator via the software has the advantages that by adding two threshold values and two subprograms for searching and judging, the hysteresis section is formed, noise interference in the hysteresis section can be prevented, and the method is simple, flexible, efficient and easy to implement.
Description
Technical field
The present invention relates to a kind of method of hysteresis comparator, relate in particular to a kind of software and realize the method for hysteresis comparator.
Background technology
Hysteresis comparator claims again Schmidt trigger, hysteresis loop comparator, the feature of this comparer is as input signal U(t), when increasing gradually or reducing gradually, it has two threshold values, and unequal, and its transport property has the shape of " hysteresis " curve.Because it can obtain utilization very widely by filtering interfering noise in some applications, for example electrical quantity protection (overvoltage, under-voltage, overcurrent, overfrequency and under-frequency etc.) in comparator circuit, common hardware is realized and can be realized by multiple amplifiers unit, but a function can only be realized in one group of unit, such as overvoltage and under-voltage protection are just respectively with two groups of unit, one group of unit arranges overvoltage protection value Uov, another group unit arranges under-voltage protection value Uuv, 3 interval judgements can be realized in these two groups of unit, (0, Uuv), [Uuv, Uov] and (Uov, Uov+δ).Read input signal U(t when changing by A/D) laggard row data processing, but common condition judgment still can be subject to the impact of signal fluctuation, finally causes the undesired switching of output state.
Summary of the invention
The object of the present invention is to provide a kind of software to realize the method for hysteresis comparator, the method simply, flexibly, efficiently, easily realize, can prevent the noise within the scope of hysteresis.
The present invention is achieved like this, and searches and judges and form hysteresis district by increasing by two threshold values and two subroutines, it is characterized in that method step is:
(1) master routine starts state and is set to static variable, and the program that at every turn enters is all first judged whether in [Uuv, Uov] interval, if do not existed, calls between the subroutine seek area between seek area, finally all enters corresponding handling procedure;
(2) subroutine between seek area, between rreturn value Representative Region, by loop statement, completes searching interval;
(3) judge whether in certain interval subroutine, can interval [Uuv, Uov] be enlarged into [Uuv-B by this subroutine judgement
1, Uov+B
2], B wherein
1and B
2for threshold values constant, form hysteresis district.
Advantage of the present invention is: search and judge and form hysteresis district by increasing by two threshold values and two subroutines, can prevent the noise within the scope of hysteresis.Method simply, flexibly, efficiently, easily realize.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of master routine of the present invention.
Fig. 2 is the subroutine flow chart between seek area of the present invention.
Fig. 3 is of the present invention judging whether at certain interval subroutine flow chart.
Embodiment
Below in conjunction with accompanying drawing explanation, embodiments of the invention are described in further detail, but the present embodiment is not limited to the present invention, every employing analog structure of the present invention and similar variation thereof, all should list protection scope of the present invention in.
Concrete methods of realizing describes (take C language as example) from following two aspects:
1, relevant variable and macro definition:
(1) 3 length of an interval shaping array constant:
typedef struct
{
long MixVolt;
long MaxVolt;
}Volt_Field;
const Volt_Field VoltField[3]={{0,Uuv},{Uuv,Uov},{Uov
,9990000}};
Uuv wherein and Uov are constant.
(2) two threshold values constant: B
1and B
2.
(3) 3 interval definition:
1. the state value of interval (0, Uuv) represents with 0;
2. the state value of interval [Uuv, Uov] represents with 1;
3. the state value of interval (Uov, Uov+δ) represents with 2.
2, software judges subroutine:
As shown in Figure 1, master routine starts state and is set to static variable, and the program that at every turn enters is all first judged whether in [Uuv, Uov] interval, if do not existed, calls between the subroutine seek area between seek area, finally all enters corresponding handling procedure.
As shown in Figure 2, subroutine between seek area: between rreturn value Representative Region, if rreturn value is that 0 expression is illustrated in (0, Uuv) interval, rreturn value is that 1 expression is illustrated in [Uuv, Uov] interval, rreturn value is that 2 expressions are illustrated in (Uov, 9990000) interval, passes through loop statement, complete the searching of interval, the process flow diagram that this subroutine realizes is as Fig. 2:
As shown in Figure 3, judge whether in certain interval subroutine: can interval [Uuv, Uov] be enlarged into [Uuv-B by this subroutine judgement
1, Uov+B
2], B wherein
1and B
2for threshold values constant, form hysteresis district, prevent the noise within the scope of hysteresis.
Complete the setting of 3 length of an interval shaping array constants by definition structure body variable:
typedef struct
{
long MixVolt;
long MaxVolt;
}Volt_Field;
const Volt_Field VoltField[3]={{0,Uuv},{Uuv,Uov },{Uov
,9990000}};
Uuv wherein and Uov are constant.
Claims (1)
1. software is realized a method for hysteresis comparator, searches and judges and form hysteresis district by increasing by two threshold values and two subroutines, it is characterized in that method step is:
(1) master routine starts state and is set to static variable, and the program that at every turn enters is all first judged whether in [Uuv, Uov] interval, if do not existed, calls between the subroutine seek area between seek area, finally all enters corresponding handling procedure;
(2) subroutine between seek area, between rreturn value Representative Region, by loop statement, completes searching interval;
(3) judge whether in certain interval subroutine, can interval [Uuv, Uov] be enlarged into [Uuv-B by this subroutine judgement
1, Uov+B
2], B wherein
1and B
2for threshold values constant, form hysteresis district.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410114639.2A CN103902291A (en) | 2014-04-30 | 2014-04-30 | Method for implementing hysteresis comparator via software |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410114639.2A CN103902291A (en) | 2014-04-30 | 2014-04-30 | Method for implementing hysteresis comparator via software |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103902291A true CN103902291A (en) | 2014-07-02 |
Family
ID=50993634
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410114639.2A Pending CN103902291A (en) | 2014-04-30 | 2014-04-30 | Method for implementing hysteresis comparator via software |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103902291A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070112990A1 (en) * | 2005-11-15 | 2007-05-17 | Matsushita Electric Industrial Co., Ltd. | Iic bus communication system, slave device, and method for controlling iic bus communication |
CN101093983A (en) * | 2006-06-21 | 2007-12-26 | 夏普株式会社 | Comparing circuit and infrared receiver |
CN103677914A (en) * | 2013-12-10 | 2014-03-26 | 广州中海达卫星导航技术股份有限公司 | Device and method for easy switching and guiding starting of media of embedded system |
-
2014
- 2014-04-30 CN CN201410114639.2A patent/CN103902291A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070112990A1 (en) * | 2005-11-15 | 2007-05-17 | Matsushita Electric Industrial Co., Ltd. | Iic bus communication system, slave device, and method for controlling iic bus communication |
CN101093983A (en) * | 2006-06-21 | 2007-12-26 | 夏普株式会社 | Comparing circuit and infrared receiver |
CN103677914A (en) * | 2013-12-10 | 2014-03-26 | 广州中海达卫星导航技术股份有限公司 | Device and method for easy switching and guiding starting of media of embedded system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Ansari et al. | Fixed point theorems on b-metric spaces for weak contractions with auxiliary functions | |
Kumar et al. | An approximate method for numerical solution of fractional differential equations | |
CN103365699B (en) | System API based on APK and the extracting method of character string and system when running | |
WO2008074382A8 (en) | Obfuscating computer program code | |
US10623426B1 (en) | Building a ground truth dataset for a machine learning-based security application | |
CN109143043B (en) | Controller IO input anti-shake detection method, system, device and storage medium | |
CN103902291A (en) | Method for implementing hysteresis comparator via software | |
KR102147355B1 (en) | Method and apparatus for converting programs | |
CN104615048B (en) | A kind of AD acquisition methods and device | |
CN109656946A (en) | A kind of multilist relation query method, device and equipment | |
US20150346751A1 (en) | Power Supply Control Method and Device | |
Benhammouda et al. | Analytical solutions for systems of partial differential–algebraic equations | |
CN112420066A (en) | Noise reduction method, noise reduction device, computer equipment and computer readable storage medium | |
CN103440122B (en) | A kind of static function recognition methods using reverse expansion controlling stream graph | |
CN102288835A (en) | Signal detection circuit and method | |
CN103064973A (en) | Method and device for searching extreme values | |
CN103544317A (en) | Dimension table data processing method and device | |
US9395706B2 (en) | Noise determination device | |
Singh et al. | Common Fixed Point Theorems for Compatible Mappings in Metric Spaces | |
Yang et al. | Quenching analysis for nonlinear Volterra integral equations | |
Wu et al. | Robust H-infinity estimation for linear time-delay systems: an improved LMI approach | |
CN106353587B (en) | Power sensor data processing method and system | |
CN106897616A (en) | A kind of processing method and processing device of program file | |
Basak et al. | Snakes and perturbed random walks | |
ATE245291T1 (en) | OPTIMIZER |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20140702 |
|
WD01 | Invention patent application deemed withdrawn after publication |