CN115980460A - Method for monitoring PWM signal output safety - Google Patents
Method for monitoring PWM signal output safety Download PDFInfo
- Publication number
- CN115980460A CN115980460A CN202211569900.9A CN202211569900A CN115980460A CN 115980460 A CN115980460 A CN 115980460A CN 202211569900 A CN202211569900 A CN 202211569900A CN 115980460 A CN115980460 A CN 115980460A
- Authority
- CN
- China
- Prior art keywords
- pwm
- output
- monitoring
- signal
- pwm signal
- 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.)
- Withdrawn
Links
- 238000012544 monitoring process Methods 0.000 title claims abstract description 33
- 238000000034 method Methods 0.000 title claims abstract description 27
- 230000002159 abnormal effect Effects 0.000 claims abstract description 7
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Landscapes
- Inverter Devices (AREA)
Abstract
The invention provides a method for monitoring PWM signal output safety, which is carried out according to the following steps: step one, initializing a circuit; step two, configuring two PWM signals which are respectively set as PWM _ A and PWM _ B; step three, finishing initialization; step four, detecting the output end of an exclusive-OR gate in the circuit; and step five, reading the output value and judging the output state of the PWM signal to be detected. Because the exclusive-OR gate is used for monitoring, the system can be interrupted only when the output PWM signal is abnormal, and thus, the system can be greatly reduced in interruption times. Meanwhile, the method reduces the calculation of the frequency and the duty ratio of the PWM output signal by the system. In summary, when the method is used for monitoring the output of the PWM signal, the result can be obtained only by outputting the signals of the PWM _ A and the PWM _ B to the exclusive-OR gate, and the expenses of system interruption and related operation are directly saved.
Description
Technical Field
The invention relates to the field of PWM control, in particular to a method for monitoring PWM signal output safety.
Background
The existing technologies for monitoring and measuring the PWM duty ratio and frequency all utilize an IO port to detect the change of an input signal and simultaneously realize monitoring by combining the functions of interruption, a timer or the capture of an MCU. Specifically, when the input level of the IO changes, the system is triggered to interrupt, the interrupt service function starts a timer, and the current value of the timer is read and recorded after multiple interrupts and the current value of the timer, so as to calculate the duty ratio and the frequency of the PWM output signal.
However, such continuous monitoring of the level change of the input signal of the IO port may cause overhead of frequent generation and processing of interrupts of the system, and meanwhile, certain requirements are imposed on the clock frequency of the interrupt count timer, and certain condition restrictions must be satisfied for the frequency higher than the frequency of the PWM signal.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method for monitoring the output safety of a PWM signal, which aims to solve the problems in the background art, reduce the overhead of frequent interruption of the system and reduce the calculation of the frequency and the duty ratio of the signal output by the PWM by the system.
In order to realize the purpose, the invention is realized by the following technical scheme: a method for monitoring the safety of PWM signal output is carried out according to the following steps: step one, initializing a circuit; step two, configuring two PWM signals which are respectively set as PWM _ A and PWM _ B; step three, finishing initialization; step four, detecting the difference in the circuit
An output of the OR gate; and step five, reading the output value and judging the output state of the PWM signal to be detected.
Further, the PWM _ a and PWM _ B have the same frequency and duty ratio, and the clock sources of PWM _ a and PWM _ B are different.
Further, the PWM _ B signal is used as a monitoring signal, and the PWM _ a signal is used as an output signal.
Furthermore, in the third step, two PWM signals are simultaneously enabled and respectively input to an exclusive or gate for operation.
Furthermore, in the fifth step, when the output of the exclusive or gate is not 0, it indicates that the PWM signal is abnormal in output.
Further, in the fifth step, when the output of the exclusive or gate is 0, it indicates that the PWM signal is normally output.
Further, after the initialization is completed, both PWM _ a and PWM _ B can output PWM square waves.
Further, in the third step, if the initialization is not completed, the first step is returned.
The invention has the beneficial effects that:
1. the method for monitoring the PWM signal output safety reduces the overhead of frequent interrupt entering of the system. The monitoring by the exclusive-OR gate can greatly reduce the interruption frequency, and the interruption can be entered when the output PWM signal is abnormal.
2. The method for monitoring the PWM signal output safety reduces the calculation of the frequency and the duty ratio of the signal output by the PWM by a system. By utilizing the monitoring of the exclusive-OR gate, the continuous operation of the part is directly saved, and the result can be obtained only by outputting the signals of the PWM _ A and the PWM _ B to the exclusive-OR gate.
Drawings
FIG. 1 is a flow chart of a method of PWM signal output safety monitoring according to the present invention;
fig. 2 is a schematic diagram of a method for PWM signal output safety monitoring according to the present invention.
Detailed Description
In order to make the technical means, the creation characteristics, the achievement purposes and the effects of the invention easy to understand, the invention is further described with the specific embodiments.
Referring to fig. 1 to 2, the present invention provides a technical solution: when the PWM signal output function is used, two PWM _ A and PWM _ B which have the same frequency and duty ratio but different clock sources are configured, wherein the PWM _ B is used for monitoring, and the PWM _ A is used for outputting. The two PWM signals are started simultaneously and are respectively input into an exclusive-OR gate for operation, when the output of the exclusive-OR gate is 0, the PWM signals are normally output, otherwise, the PWM signals are judged to be abnormal, and therefore the correctness of the PWM signals can be monitored in real time, and the method is shown in figure 2.
Specifically, the method can reduce the overhead of frequent interrupt entry of the system. The original method for monitoring the output of the PWM signal is to interrupt the PWM signal by detecting the signal change (from low to high or from high to low) of the input IO port, and this monitoring method will cause continuous and frequent interrupts. And the monitoring by using the exclusive-OR gate can greatly reduce the interruption frequency, and the interruption can be carried out when the output PWM signal is abnormal.
In this embodiment, during initialization, the same duty ratio and clock frequency are configured for PWM _ a and PWM _ B, but the clock sources of the two are different, and initialization is completed, that is, both PWM _ a and PWM _ B can output PWM square waves. And monitoring the output end of the exclusive-OR gate, and if the output value is not 0, outputting the abnormal PWM signal, wherein the scheme reduces the calculation of the frequency and the duty ratio of the signal output by the PWM by the system. The original method for monitoring the output of the PWM signal is to calculate the time of high and low levels by combining the interrupt with a timer, thereby calculating the frequency and duty ratio of the PWM signal, and comparing with the originally designed parameters to obtain whether the output PWM signal is normal. And the monitoring of the exclusive-OR gate is utilized, the continuous operation of the part is directly saved, and the result can be obtained only by outputting the signals of the PWM _ A and the PWM _ B to the exclusive-OR gate.
While there have been shown and described what are at present considered the fundamental principles and essential features of the invention and its advantages, it will be apparent to those skilled in the art that the invention is not limited to the details of the foregoing exemplary embodiments, but is capable of other specific forms without departing from the spirit or essential characteristics thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Furthermore, it should be understood that although the present description refers to embodiments, not every embodiment may contain only a single embodiment, and such description is for clarity only, and those skilled in the art should integrate the description, and the embodiments may be combined as appropriate to form other embodiments understood by those skilled in the art.
Claims (8)
1. A method for monitoring the safety of PWM signal output is characterized by comprising the following steps: step one, initializing a circuit; step two, configuring two PWM signals which are respectively set as PWM _ A and PWM _ B; step three, finishing initialization; monitoring the output end of an exclusive-OR gate in the circuit; and step five, reading the output value and judging the output state of the PWM signal to be monitored.
2. The method for PWM signal output safety monitoring according to claim 1, wherein: the PWM _ A and the PWM _ B have the same frequency and duty ratio, and the clock sources of the PWM _ A and the PWM _ B are different.
3. A method of PWM signal output safety monitoring, according to claim 2, characterized in that: the PWM _ B signal is used as a monitoring signal, and the PWM _ A signal is used as an output signal.
4. The method of claim 1, wherein the method comprises: in the third step, two PWM signals are simultaneously enabled and input to an exclusive or gate for operation.
5. The method for PWM signal output safety monitoring according to claim 4, wherein: in the fifth step, when the output of the exclusive-or gate is not 0, the PWM signal output is abnormal.
6. The method of claim 5, wherein the PWM signal output safety monitoring comprises: in the fifth step, when the output of the exclusive or gate is 0, the PWM signal is normally output.
7. The method of claim 4, wherein the PWM signal output safety monitoring comprises: after the initialization is completed, both PWM _ a and PWM _ B can output PWM square waves.
8. The method of claim 1, wherein the method comprises: and in the third step, if the initialization is not finished, returning to the first step.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211569900.9A CN115980460A (en) | 2022-12-08 | 2022-12-08 | Method for monitoring PWM signal output safety |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211569900.9A CN115980460A (en) | 2022-12-08 | 2022-12-08 | Method for monitoring PWM signal output safety |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115980460A true CN115980460A (en) | 2023-04-18 |
Family
ID=85969045
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211569900.9A Withdrawn CN115980460A (en) | 2022-12-08 | 2022-12-08 | Method for monitoring PWM signal output safety |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115980460A (en) |
-
2022
- 2022-12-08 CN CN202211569900.9A patent/CN115980460A/en not_active Withdrawn
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9897651B2 (en) | Ultra-fast autonomous clock monitoring circuit for safe and secure automotive applications | |
US10901020B2 (en) | Digital duty-cycle monitoring of a periodic signal | |
CN117968965A (en) | Calibration method and device of helium detector and electronic equipment | |
CN115980460A (en) | Method for monitoring PWM signal output safety | |
CN111913038B (en) | Device and method for detecting frequency of multipath clock signals | |
CN110988780B (en) | Method for realizing power frequency anti-shunt running and electric energy meter | |
CN1893339B (en) | Continuous median failure control system and method | |
US20200241588A1 (en) | Hard disk monitoring system and monitoring method using complex programmable logic device | |
CN111158342A (en) | Method for initializing and checking consistency of current sensor by motor controller | |
JPH04326410A (en) | Clock monitor device | |
US20230327522A1 (en) | Method for fault processing of hall position sensor in brushless direct current motor | |
WO2022111538A1 (en) | Method and device for determining optimal exhaust gas recirculation rate of vehicle, storage medium, and vehicle | |
CN117076182B (en) | Error reporting method, system on chip, computer equipment and storage medium | |
JPH08105625A (en) | Gas shut-off device | |
CN108710731B (en) | Method for judging by-pass event by sections | |
JPS5855535B2 (en) | Multi-computer device for vehicles | |
JP3061972B2 (en) | Timing verification model | |
CN114928378A (en) | Single-wire signal transmission method and device and electronic equipment | |
JP2001356917A (en) | Pulse judging device | |
KR101273750B1 (en) | Measuring rotation speed of fan usinging counter | |
CN116577545A (en) | Fault detection method and device | |
CN118259068A (en) | Voltage detection circuit, analog comparator and chip | |
JP3387175B2 (en) | Time erroneous measurement prevention device | |
CN116953686A (en) | Vehicle lost track repairing method and device, computer equipment and storage medium | |
JPH1082658A (en) | Judgment apparatus for level of input signal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20230418 |
|
WW01 | Invention patent application withdrawn after publication |