CN113433485A - Optical coupler fault detection circuit and method and communication system - Google Patents

Optical coupler fault detection circuit and method and communication system Download PDF

Info

Publication number
CN113433485A
CN113433485A CN202110815587.1A CN202110815587A CN113433485A CN 113433485 A CN113433485 A CN 113433485A CN 202110815587 A CN202110815587 A CN 202110815587A CN 113433485 A CN113433485 A CN 113433485A
Authority
CN
China
Prior art keywords
signal
mcu
optocoupler
sampling
slave
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
Application number
CN202110815587.1A
Other languages
Chinese (zh)
Inventor
贺小林
林浩贤
杨帆
刘文斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Gree Green Refrigeration Technology Center Co Ltd of Zhuhai
Zhuhai Gree Energy Saving Environmental Protection Refrigeration Technology Research Center Co Ltd
Original Assignee
Gree Green Refrigeration Technology Center Co Ltd of Zhuhai
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Gree Green Refrigeration Technology Center Co Ltd of Zhuhai filed Critical Gree Green Refrigeration Technology Center Co Ltd of Zhuhai
Priority to CN202110815587.1A priority Critical patent/CN113433485A/en
Publication of CN113433485A publication Critical patent/CN113433485A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R31/00Arrangements for testing electric properties; Arrangements for locating electric faults; Arrangements for electrical testing characterised by what is being tested not provided for elsewhere
    • G01R31/50Testing of electric apparatus, lines, cables or components for short-circuits, continuity, leakage current or incorrect line connections
    • G01R31/56Testing of electric apparatus
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R31/00Arrangements for testing electric properties; Arrangements for locating electric faults; Arrangements for electrical testing characterised by what is being tested not provided for elsewhere
    • G01R31/50Testing of electric apparatus, lines, cables or components for short-circuits, continuity, leakage current or incorrect line connections

Abstract

The invention discloses an optocoupler fault detection circuit, an optocoupler fault detection method and a communication system. Wherein, this opto-coupler fault detection circuit includes: the sampling module is arranged between the master MCU and the slave MCU and used for generating a first sampling signal based on a signal sent by a sending end of the master MCU, generating a second sampling signal based on a signal received by a receiving end of the master MCU and sending the first sampling signal and the second sampling signal to the slave MCU; the slave MCU is used for judging whether the first optocoupler fails or not according to the first sampling signal and a signal received by a receiving end of the slave MCU; and judging whether the second optocoupler breaks down or not according to the signal sent by the sending end of the slave MCU and the second sampling signal. By the method and the device, the optocoupler fault of the communication system can be quickly detected, and the fault detection efficiency of the system is improved.

Description

Optical coupler fault detection circuit and method and communication system
Technical Field
The invention relates to the technical field of electronic power, in particular to an optical coupler fault detection circuit, an optical coupler fault detection method and a communication system.
Background
There are many existing communication systems, including a UART (Universal Asynchronous Receiver/Transmitter) communication system, which is a Universal serial data bus system for Asynchronous communication. In the system, the bus is in bidirectional communication, and full-duplex transmission and reception can be realized. Fig. 1 is a structural diagram of a conventional UART communication system, and as shown in fig. 1, the UART communication system is a communication loop that returns by signal output built by two optical couplers, and general communication faults are detected by detecting whether input and output signals are correct, whether a loss exists, whether communication modes are matched, and the like. But often the communication trouble appears sometimes not because the problem of signal, may appear on the opto-coupler device, and the opto-coupler device leads to damaging or unusual because of unit operational environment or some electrostatic influence etc. easily, if the opto-coupler device has unusually, influences the normal output of signal, however, among the current communication system, does not have the detection scheme to the opto-coupler device is unusual, and current individual to opto-coupler fault detection method, consuming time is longer, and detection efficiency is lower.
Aiming at the problem that the optical coupler fault cannot be detected in time because a detection scheme aiming at the abnormity of the optical coupler device is not provided in a communication system in the prior art, an effective solution is not provided at present.
Disclosure of Invention
The embodiment of the invention provides an optical coupler fault detection circuit, an optical coupler fault detection method and a communication system, and aims to solve the problem that an optical coupler fault cannot be detected in time because no detection scheme aiming at the abnormity of an optical coupler device exists in the prior art.
In order to solve the technical problem, the invention provides an optical coupler fault detection circuit, which comprises:
the sampling module is arranged between the master MCU and the slave MCU and used for generating a first sampling signal based on a signal sent by a sending end of the master MCU, generating a second sampling signal based on a signal received by a receiving end of the master MCU and sending the first sampling signal and the second sampling signal to the slave MCU; the master MCU and the slave MCU perform signal transmission through a first optical coupler and a second optical coupler;
the slave MCU is used for judging whether the first optocoupler fails or not according to the first sampling signal and a signal received by a receiving end of the slave MCU; judging whether the second optocoupler fails or not according to the signal sent by the sending end of the slave MCU and the second sampling signal; the signal received by the receiving end of the slave MCU is a signal generated after the signal sent by the sending end of the master MCU passes through the first optocoupler, and the signal sent by the sending end of the slave MCU is transmitted to the receiving end of the master MCU through the second optocoupler.
Furthermore, a first interface of the sampling module is connected with a sending end of the host MCU; a second interface of the host computer MCU is connected with a receiving end of the host computer MCU; and the third interface of the slave MCU is connected with the first feedback interface of the slave MCU and is communicated with the first interface, and the fourth interface of the slave MCU is connected with the second feedback interface of the slave MCU and is communicated with the second interface.
Further, the sampling module includes:
the first sampling unit is arranged between the sending end of the master MCU and the first feedback interface, and is used for generating the first sampling signal according to the signal sent by the sending end of the master MCU and outputting the first sampling signal to the first feedback interface of the slave MCU;
and the second sampling unit is arranged between the receiving end of the host MCU and the second feedback interface, and is used for generating a second sampling signal according to the signal received by the receiving end of the host MCU and outputting the second sampling signal to the second feedback interface of the slave MCU.
Further, the slave MCU is specifically configured to:
when the first sampling signal is a high-level signal and a signal received by a receiving end of the slave MCU is the high-level signal, judging that the first optocoupler is not in fault;
and when the first sampling signal is a high-level signal and a signal received by a receiving end of the slave MCU is a low-level signal, judging that the first optocoupler has a fault.
Further, the slave MCU is further specifically configured to:
when a signal sent by a sending end of the slave MCU is a high-level signal and the second sampling signal is a high-level signal, judging that the second optocoupler does not have a fault;
and when the signal sent by the sending end of the slave MCU is a high level signal and the second sampling signal is a low level signal, judging that the second optocoupler has a fault.
Further, the first sampling unit includes:
and the non-inverting input end of the first comparator is connected with the sending end of the master MCU, the inverting input end of the first comparator is connected with the output end of the first comparator, and the output end of the first comparator is connected with the first feedback interface of the slave MCU.
Further, the first sampling unit further includes:
and the first end of the first capacitor is connected with the non-inverting input end of the first comparator, and the second end of the first capacitor is grounded and is used for keeping the voltage of the non-inverting input end of the first comparator.
Further, the second sampling unit includes:
and the non-inverting input end of the second comparator is connected with the receiving end of the master MCU, the inverting input end of the second comparator is connected with the output end of the second comparator, and the output end of the second comparator is connected with the second feedback interface of the slave MCU.
Further, the second sampling unit further includes:
and the first end of the second capacitor is connected with the non-inverting input end of the second comparator, and the second end of the second capacitor is grounded and is used for keeping the voltage of the non-inverting input end of the second comparator.
The invention also provides a communication system which comprises a host MCU, a slave MCU, a first optocoupler, a second optocoupler and the optocoupler fault detection circuit.
The invention also provides an optical coupler fault detection method, which is applied to the optical coupler fault detection circuit and comprises the following steps:
acquiring a first sampling signal and a second sampling signal; the first sampling signal is generated based on a signal sent by a sending end of the host MCU, and the second sampling signal is generated based on a signal received by a receiving end of the host MCU;
judging whether the first optocoupler breaks down or not according to the first sampling signal and a signal received by a receiving end of the slave MCU; and/or judging whether the second optocoupler breaks down or not according to a signal sent by a sending end of the slave MCU and the second sampling signal; the signal received by the receiving end of the slave MCU is a signal generated after the signal sent by the sending end of the master MCU passes through the first optocoupler, and the signal sent by the sending end of the slave MCU is transmitted to the receiving end of the master MCU through the second optocoupler.
Further, judging whether the first optocoupler fails according to the first sampling signal and a signal received by a receiving end of the slave MCU, including:
if the first sampling signal is a high-level signal and a signal received by a receiving end of the slave MCU is a high-level signal, judging that the first optocoupler is not in fault;
and if the first sampling signal is a high-level signal and the signal received by the receiving end of the slave MCU is a low-level signal, judging that the first optocoupler has a fault.
Further, judging whether the second optocoupler fails according to the signal sent by the sending end of the slave MCU and the second sampling signal includes:
if the signal sent by the sending end of the slave MCU is a high level signal and the second sampling signal is a high level signal, judging that the second optocoupler does not have a fault;
and if the signal sent by the sending end of the slave MCU is a high level signal and the second sampling signal is a low level signal, judging that the second optocoupler has a fault.
The present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the above-described opto-coupler fault detection method.
By applying the technical scheme of the invention, the sampling module is used for collecting the signal sent by the sending end of the host MCU, generating a first sampling signal, collecting the signal received by the receiving end of the host MCU, generating a second sampling signal, and judging whether the first optocoupler fails or not by the slave MCU according to the first sampling signal and the signal received by the receiving end of the slave MCU; and judging whether the second optocoupler fails according to the signal sent by the sending end of the slave MCU and the second sampling signal, so that the optocoupler failure of the communication system can be quickly detected, and the failure detection efficiency of the system is improved.
Drawings
FIG. 1 is a block diagram of a conventional UART communication system;
fig. 2 is a structural diagram of an opto-coupler fault detection circuit according to an embodiment of the present invention;
FIG. 3 is a block diagram of a sampling module according to an embodiment of the present invention;
fig. 4 is a flowchart of an opto-coupler fault detection method according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and "a plurality" typically includes at least two.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
It should be understood that although the terms first, second, etc. may be used to describe communication bodies in embodiments of the present invention, these communication bodies should not be limited by these terms. These terms are only used to distinguish between different communication bodies. For example, a master MCU may also be referred to as a slave MCU, and similarly, a slave MCU may also be referred to as a master MCU, without departing from the scope of embodiments of the present invention.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that an article or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such article or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in the article or device in which the element is included.
Alternative embodiments of the present invention are described in detail below with reference to the accompanying drawings.
Example 1
The present embodiment provides an optocoupler fault detection circuit, which is described in detail below by taking application to a UART communication system as an example. As shown in fig. 1 mentioned above, the UART communication system includes a master MCU, a slave MCU, a first optical coupler D1 and a second optical coupler D2, the master MCU transmits a signal to the slave MCU through the first optical coupler, and the slave MCU transmits a signal to the master MCU through the second optical coupler. The first resistor R1, the second resistor R2 and the third resistor R3 are current limiting resistors. VCC is the slave end communication supply voltage, and UART VCC is the host end communication supply voltage. The master MCU comprises a transmitting end TXD1 and a receiving end RXD2, the slave MCU comprises a transmitting end TXD2 and a receiving end RXD1, and communication signals are transmitted to RXD1 through TXD1 or transmitted to RXD2 through TXD 2.
As shown in fig. 1, an anode of a diode in the first optocoupler D1 is connected to a host-side communication supply voltage UART VCC through a first resistor R1, a cathode of the diode is connected to a transmitting terminal TXD1 of the host MCU, a first terminal of a phototransistor in the first optocoupler D1 is connected to a slave-side communication supply voltage VCC through a second resistor R2, and a second terminal of the phototransistor is grounded; a diode in the second optocoupler D2 is connected with a slave end communication power supply voltage VCC, a cathode is connected with a transmitting end TXD2 of the slave MCU, a receiving end RXD1 of the slave MCU is further connected between the second resistor R2 and a first end of a phototriode in the first optocoupler D1, a circuit between the first end of the phototriode in the second optocoupler D2 and a receiving end RXD2 of the host MCU is further connected with a host end communication power supply voltage UART VCC, a second end of the phototriode in the second optocoupler D2 is grounded, and a third end of the phototriode in the second optocoupler D2 is a photosurface and is used for generating electromotive force based on an optical signal sent by the diode in the second optocoupler D2 and further controlling the conduction of a second end of a first end box of the phototriode in the second optocoupler D2.
Fig. 2 is a structural diagram of an optocoupler fault detection circuit according to an embodiment of the present invention, and as shown in fig. 2, the optocoupler fault detection circuit includes:
the sampling module is arranged between the host MCU and the slave MCU and used for generating a first sampling signal based on a signal sent by a sending end of the host MCU, generating a second sampling signal based on a signal received by a receiving end of the host MCU and sending the first sampling signal and the second sampling signal to the slave MCU;
the slave MCU is used for judging whether the first optocoupler fails according to the first sampling signal and a signal received by a receiving end of the slave MCU; judging whether the second optocoupler fails or not according to a signal sent by a sending end of the slave MCU and the second sampling signal; the signal received by the receiving end of the slave MCU is a signal generated by the signal sent by the sending end of the master MCU after passing through the first optocoupler, and the signal sent by the sending end of the slave MCU is transmitted to the receiving end of the master MCU through the second optocoupler.
The optocoupler fault detection circuit of the embodiment collects signals sent by a sending end TXD1 of a host MCU through a sampling module to generate a first sampling signal, collects signals received by a receiving end RXD2 of the host MCU to generate a second sampling signal, and judges whether the first optocoupler D1 has a fault or not according to the first sampling signal and the signals received by the receiving end RXD1 of the slave MCU through the slave MCU; and whether the second optocoupler D2 breaks down is judged according to a signal and a second sampling signal sent by a sending end TXD2 of the slave MCU, so that optocoupler faults of a communication system can be quickly detected, and the fault detection efficiency of the system is improved.
A first interface 1 of the sampling module is connected with a transmitting end TXD1 of the host MCU; the second interface 2 is connected with a receiving end of the host MCU; the third interface 3 is connected with the first feedback interface of the slave MCU and is communicated with the first interface 1, and the fourth interface is connected with the second feedback interface of the slave MCU and is communicated with the second interface 2;
the slave MCU is used for judging whether the first optocoupler D1 breaks down or not according to a signal sent by a sending end TXD1 of the master MCU and a signal received by a receiving end RXD1 of the slave MCU; and judging whether the second optocoupler D2 has a fault according to a signal sent by a sending end TXD2 of the slave MCU and a signal received by a receiving end RXD2 of the master MCU.
Example 2
In this embodiment, another optical coupler fault detection circuit is provided, and fig. 3 is a structural diagram of a sampling module according to an embodiment of the present invention, as shown in fig. 3, a sampling module 10 includes: the first sampling unit 101 is arranged between the transmitting end TXD1 of the master MCU and the first feedback interface 5 of the slave MCU, and is used for generating a first sampling signal according to a signal transmitted by the transmitting end TXD1 of the master MCU and outputting the first sampling signal to the first feedback interface 5 of the slave MCU; and the second sampling unit 102 is arranged between the receiving end RXD2 of the master MCU and the second feedback interface of the slave MCU, and is configured to generate a second sampling signal according to the signal received by the receiving end RXD2 of the master MCU, and output the second sampling signal to the second feedback interface 6 of the slave MCU.
When the signal sent by the slave MCU at the sending end TXD1 of the master MCU is a high level signal, the first sampling signal fed back to the first feedback interface 5 is a high level signal, and the signal received by the receiving end RXD1 of the slave MCU is a high level signal, it is determined that the first optocoupler D1 is not faulty; when the signal sent by the sending terminal TXD1 of the master MCU is a high level signal, the first sampling signal fed back to the first feedback interface 5 is a high level signal, and the signal received by the receiving terminal RXD1 of the slave MCU is a low level signal, it is determined that the first optocoupler D1 has a fault.
The slave MCU also determines that the second optocoupler D2 is not in fault when a signal sent by the sending terminal TXD2 of the slave MCU is a high level signal, so that the second sampling signal fed back to the second feedback interface 6 is a high level signal, and a signal received by the receiving terminal RXD2 of the master MCU is a high level signal; when the signal sent by the sending end TXD2 of the slave MCU is a high level signal, the second sampling signal fed back to the second feedback interface 6 is a high level signal, and the signal received by the receiving end RXD2 of the master MCU is a low level signal, it is determined that the second optocoupler D2 has a fault.
In order to generate the first sampling signal according to the signal transmitted by the transmitting end TXD1 of the host MCU, as shown in fig. 3, the first sampling unit 101 includes: the non-inverting input terminal + IN1 of the first comparator a1 is connected to the transmitting terminal TXD1 of the master MCU, the inverting input terminal-IN 1 thereof is connected to the output terminal OUT1 thereof, and the output terminal OUT1 thereof is connected to the first feedback interface 5 of the slave MCU.
After the signal transmitted by the transmitting end TXD1 of the host MCU changes from high level to low level, in order to ensure the sampling precision, the first sampling signal needs to be kept at high level for a period of time, and therefore, the first sampling unit 101 further includes: a first end of the first capacitor C1 is connected to the non-inverting input terminal + IN1 of the first comparator a1, a second end of the first capacitor C1 is grounded, and the first capacitor C1 is used for holding the voltage of the non-inverting input terminal + IN1 of the first comparator a1, and after a signal transmitted by the transmitting terminal TXD1 of the host MCU changes from a high level to a low level, the voltage of the non-inverting input terminal + IN1 of the first comparator a1 is kept high, so that the first sampling signal maintains the high level.
Similarly, in order to generate the second sampling signal according to the signal received by the receiver RXD2 of the host MCU, the second sampling unit 102 includes: the non-inverting input end + IN2 of the second comparator a2 is connected to the receiving end RXD2 of the master MCU, the inverting input end-IN 2 thereof is connected to the output end OUT2 thereof, and the output end OUT2 thereof is connected to the second feedback interface 6 of the slave MCU.
After the signal received by the receiving terminal RXD2 of the host MCU changes from high level to low level, in order to ensure the sampling precision, the second sampling signal needs to be kept at high level for a period of time, and therefore, the second sampling unit 102 further includes: a first end of the second capacitor C2 is connected to the non-inverting input terminal of the second comparator a2, a second end of the second capacitor C2 is grounded, and the second capacitor C2 is used for holding the voltage of the non-inverting input terminal + IN2 of the second comparator a2, so that after the signal received by the receiving terminal RXD2 of the host MCU changes from a high level to a low level, the voltage of the non-inverting input terminal + IN2 of the second comparator a2 is kept high, and further the second sampling signal maintains a high level.
Specifically, as shown IN fig. 3, the sampling module 10 is a dual op-amp integrated chip, and includes two paths of op-amp circuits, 8 pins, which are respectively a 5V input voltage pin, OUT2, -IN2, + IN2, OUT1, -IN1, + IN1, and GND. The + IN2 collects signals received by a receiving end RXD2 of the host MCU, the + IN1 collects signals sent by a sending end TXD1 of the host MCU, and the periphery of the operational amplifier device is set up IN a voltage following state. A high-level signal output by a transmitting terminal TXD1 of the master MCU is input from + IN1, then is input to a non-inverting input terminal of a first comparator A1, and simultaneously charges a first capacitor C1, and the high-level signal outputs a high-level signal to a first feedback interface 5 of the slave MCU through the first comparator A1; when the + IN2 inputs a high level, the second capacitor C2 is charged, and a high level signal is output from the second comparator A2 to the second feedback interface 6 of the slave MCU. When the signal collected by the + IN1 is pulled from high level to low level, the first capacitor C1 discharges, and the first comparator A1 continues to output high level for a period of time, and similarly, when the signal collected by the + IN2 is pulled from high level to low level, the second capacitor C2 discharges, and the second comparator A2 continues to output high level for a period of time, so that the sampling accuracy of detecting high level is improved.
The principle when the optical coupler is normal is as follows:
when a sending end TXD1 of the host MCU sends a high-level signal, two poles of a diode in the first optocoupler D1 are both high levels, the diode is cut off to be not luminous, a phototriode at the rear end of the first optocoupler D1 is cut off to be not conducted, and an RXD1 end is directly connected with a slave end communication power supply voltage VCC and is high level, so that signal output and input are realized. On the contrary, when the transmitting end TXD1 of the host MCU sends a low level signal, the anode of the diode in the first optocoupler D1 is at a high level, the cathode is at a low level, the diode is turned on to emit light, the phototriode at the rear end of the first optocoupler D1 is turned on, and the RXD1 is pulled down to the ground network to present a low level, thereby realizing signal output and input.
When the receiving end RXD2 of the master MCU is a high level signal, it indicates that the phototransistor in the second optocoupler D2 is not turned on, and further indicates that the diode in the second optocoupler D2 is turned off and does not emit light, and further indicates that the transmitting end TXD2 of the slave MCU is a high level, thereby implementing signal output and input. On the contrary, when the receiving end RXD2 of the master MCU is a low level signal, it indicates that the phototransistor in the second optocoupler D2 is turned on, and further indicates that the diode in the second optocoupler D2 is turned on, and further indicates that the transmitting end TXD2 of the slave MCU is a low level, thereby implementing signal output and input.
From the analysis of the above principle, when the transmitting end TXD1 of the host MCU sends a high level signal, if the RXD1 end is also high level, it indicates that the first optocoupler D1 is not failed, whereas when the transmitting end TXD1 of the host MCU sends a high level signal, if the RXD1 end is also low level, it indicates that the first optocoupler D1 is not failed; when the receiving end RXD2 of the master MCU is a high level signal, if the transmitting end TXD2 of the slave MCU is also a high level, it indicates that the second optocoupler D2 is not in fault, and when the receiving end RXD2 of the master MCU is a high level signal, if the transmitting end TXD2 of the slave MCU is a low level, it indicates that the second optocoupler D2 is in fault.
The following table 1 is a table of correspondence between signals of different interfaces and abnormal conditions:
TABLE 1 corresponding table of signal and abnormal condition of different interfaces
Figure BDA0003169909980000101
Note: "1" represents high level and "0" represents low level.
As shown in the above table, when the signals of the first feedback interface 5, the transmitting terminal TXD2 of the slave MCU and the second feedback interface 6 are all at high level, and the signal transmitted by the transmitting terminal TXD1 of the master MCU is at low level, it is indicated that the first optocoupler is abnormal, and the second optocoupler is normal; when the signals sent by the first feedback interface 5, the second feedback interface 6 and the sending end TXD1 of the master MCU are all high level, and the sending end TXD2 of the slave MCU is low level, the second optocoupler is indicated to be abnormal, and the first optocoupler is normal; when signals transmitted by the transmitting end TXD1 of the signal master MCU of the first feedback interface 5, the transmitting end TXD2 of the slave MCU and the second feedback interface 6 are all high level, the first optocoupler and the second optocoupler are both normal; when the signal of the first feedback interface 5 is at a high level, the signal sent by the sending end TXD2 of the slave MCU is at a low level, the signal of the second feedback interface 6 is at a high level, and the signal sent by the sending end TXD1 of the master MCU is at a low level, it indicates that both the first optocoupler and the second optocoupler are abnormal.
The opto-coupler fault detection circuit of this embodiment, newly-increased opto-coupler fault detection function, through detecting first feedback interface 5, from the sending end TXD2 of MCU, second feedback interface 6, the high-low level condition of the signal that sending end TXD1 of host computer MCU sent, under the condition (this detects for original function) of signal anomaly or disappearance not being considered, in terms of this newly-increased function, in a period of time when setting up the detection, there is the high level of input signal when the opto-coupler input side, the output side does not have the signal and can judge that there is the anomaly for the opto-coupler, thereby realize when having anomaly from MCU can realize concrete fault display or remind the function.
Example 3
The embodiment provides a communication system, which comprises a host MCU, a slave MCU, a first optocoupler, a second optocoupler and an optocoupler fault detection circuit in the above embodiment.
Example 4
The present embodiment provides a fault detection method, which is applied to an optical coupler fault detection circuit in the foregoing embodiment, and fig. 4 is a flowchart of the optical coupler fault detection method according to the embodiment of the present invention, as shown in fig. 4, the method includes:
s101, acquiring a first sampling signal and a second sampling signal; the first sampling signal is generated based on a signal sent by a sending end of the host MCU, and the second sampling signal is generated based on a signal received by a receiving end of the host MCU.
S102, judging whether the first optocoupler fails or not according to the first sampling signal and a signal received by a receiving end of the slave MCU; and/or judging whether the second optocoupler fails according to a signal sent by a sending end of the slave MCU and the second sampling signal; the signal received by the receiving end of the slave MCU is a signal generated by the signal sent by the sending end of the master MCU after passing through the first optocoupler, and the signal sent by the sending end of the slave MCU is transmitted to the receiving end of the master MCU through the second optocoupler.
According to the method for detecting the failure of the optocoupler, a first sampling signal is generated based on a signal sent by a sending end of a host MCU, a second sampling signal is generated based on a signal received by a receiving end of the host MCU, and whether the first optocoupler fails or not is judged according to the first sampling signal and the signal received by the receiving end of the slave MCU; and/or judging whether the second optocoupler fails according to a signal sent by a sending end of the slave MCU and the second sampling signal, so that the optocoupler failure of the communication system can be quickly detected, and the failure detection efficiency of the system is improved.
Example 5
The embodiment provides another optical coupler fault detection method, and the principle when the optical coupler is normal is as follows:
when a sending end TXD1 of the host MCU sends a high-level signal, two poles of a diode in the first optocoupler D1 are both high levels, the diode is cut off to be not luminous, a phototriode at the rear end of the first optocoupler D1 is cut off to be not conducted, and an RXD1 end is directly connected with a slave end communication power supply voltage VCC and is high level, so that signal output and input are realized. On the contrary, when the transmitting end TXD1 of the host MCU sends a low level signal, the anode of the diode in the first optocoupler D1 is at a high level, the cathode is at a low level, the diode is turned on to emit light, the phototriode at the rear end of the first optocoupler D1 is turned on, and the RXD1 is pulled down to the ground network to present a low level, thereby realizing signal output and input.
When the receiving end RXD2 of the master MCU is a high level signal, it indicates that the phototransistor in the second optocoupler D2 is not turned on, and further indicates that the diode in the second optocoupler D2 is turned off and does not emit light, and further indicates that the transmitting end TXD2 of the slave MCU is a high level, thereby implementing signal output and input. On the contrary, when the receiving end RXD2 of the master MCU is a low level signal, it indicates that the phototransistor in the second optocoupler D2 is turned on, and further indicates that the diode in the second optocoupler D2 is turned on, and further indicates that the transmitting end TXD2 of the slave MCU is a low level, thereby implementing signal output and input.
From the analysis of the above principle, when the transmitting end TXD1 of the host MCU sends a high level signal, if the RXD1 end is also high level, it indicates that the first optocoupler D1 is not failed, whereas when the transmitting end TXD1 of the host MCU sends a high level signal, if the RXD1 end is also low level, it indicates that the first optocoupler D1 is not failed; when the receiving end RXD2 of the master MCU is a high level signal, if the transmitting end TXD2 of the slave MCU is also a high level, it indicates that the second optocoupler D2 is not in fault, and when the receiving end RXD2 of the master MCU is a high level signal, if the transmitting end TXD2 of the slave MCU is a low level, it indicates that the second optocoupler D2 is in fault.
Therefore, the step S102 of determining whether the first optocoupler has a fault according to the first sampling signal and the signal received by the receiving end of the slave MCU includes: if the first sampling signal is a high-level signal and the signal received by the receiving end of the slave MCU is a high-level signal, judging that the first optocoupler is not in fault; and if the first sampling signal is a high-level signal and the signal received by the receiving end of the slave MCU is a low-level signal, judging that the first optocoupler has a fault.
Whether the second optocoupler breaks down or not is judged according to a signal sent by a sending end of the slave MCU and the second sampling signal, and the method comprises the following steps: if the signal sent by the sending end of the slave MCU is a high level signal and the second sampling signal is a high level signal, judging that the second optocoupler has no fault; and if the signal sent by the sending end of the slave MCU is a high level signal and the second sampling signal is a low level signal, judging that the second optocoupler has a fault.
In specific implementation, a first sampling unit arranged between a sending end of the master MCU and a first feedback interface of the slave MCU generates a first sampling signal according to a signal sent by a sending end TXD1 of the master MCU, and outputs the first sampling signal to the first feedback interface 5 of the slave MCU; and the second sampling unit 102 is arranged between the receiving end RXD2 of the master MCU and the second feedback interface of the slave MCU, and is used for generating a second sampling signal according to the signal received by the receiving end RXD2 of the master MCU and outputting the second sampling signal to the second feedback interface 6 of the slave MCU.
When the signals of the first feedback interface 5, the transmitting end TXD2 of the slave MCU and the second feedback interface 6 are all high level, and the signal transmitted by the transmitting end TXD1 of the master MCU is low level, the first optocoupler is indicated to be abnormal, and the second optocoupler is indicated to be normal; when the signals sent by the first feedback interface 5, the second feedback interface 6 and the sending end TXD1 of the master MCU are all high level, and the sending end TXD2 of the slave MCU is low level, the second optocoupler is indicated to be abnormal, and the first optocoupler is normal; when signals transmitted by the transmitting end TXD1 of the signal master MCU of the first feedback interface 5, the transmitting end TXD2 of the slave MCU and the second feedback interface 6 are all high level, the first optocoupler and the second optocoupler are both normal; when the signal of the first feedback interface 5 is at a high level, the signal sent by the sending end TXD2 of the slave MCU is at a low level, the signal of the second feedback interface 6 is at a high level, and the signal sent by the sending end TXD1 of the master MCU is at a low level, it indicates that both the first optocoupler and the second optocoupler are abnormal.
Example 6
The present embodiment provides a computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the optocoupler fault detection method in the above embodiments.
The above-described circuit embodiments are only illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (14)

1. An opto-coupler fault detection circuit, characterized in that the opto-coupler fault detection circuit comprises:
the sampling module is arranged between the master MCU and the slave MCU and used for generating a first sampling signal based on a signal sent by a sending end of the master MCU, generating a second sampling signal based on a signal received by a receiving end of the master MCU and sending the first sampling signal and the second sampling signal to the slave MCU; the master MCU and the slave MCU perform signal transmission through a first optical coupler and a second optical coupler;
the slave MCU is used for judging whether the first optocoupler fails or not according to the first sampling signal and a signal received by a receiving end of the slave MCU; judging whether the second optocoupler fails or not according to the signal sent by the sending end of the slave MCU and the second sampling signal; the signal received by the receiving end of the slave MCU is a signal generated after the signal sent by the sending end of the master MCU passes through the first optocoupler, and the signal sent by the sending end of the slave MCU is transmitted to the receiving end of the master MCU through the second optocoupler.
2. The optocoupler fault detection circuit of claim 1,
a first interface of the sampling module is connected with a sending end of the host MCU; a second interface of the host computer MCU is connected with a receiving end of the host computer MCU; and the third interface of the slave MCU is connected with the first feedback interface of the slave MCU and is communicated with the first interface, and the fourth interface of the slave MCU is connected with the second feedback interface of the slave MCU and is communicated with the second interface.
3. The optocoupler fault detection circuit of claim 2, wherein the sampling module comprises:
the first sampling unit is arranged between the sending end of the host MCU and the first feedback interface of the slave MCU, and is used for generating the first sampling signal according to the signal sent by the sending end of the host MCU and outputting the first sampling signal to the first feedback interface;
and the second sampling unit is arranged between the receiving end of the host MCU and the second feedback interface of the slave MCU, and is used for generating a second sampling signal according to the signal received by the receiving end of the host MCU and outputting the second sampling signal to the second feedback interface.
4. The optocoupler fault detection circuit of claim 3, wherein the slave MCU is specifically configured to:
when the first sampling signal is a high-level signal and a signal received by a receiving end of the slave MCU is the high-level signal, judging that the first optocoupler is not in fault;
and when the first sampling signal is a high-level signal and a signal received by a receiving end of the slave MCU is a low-level signal, judging that the first optocoupler has a fault.
5. The optocoupler fault detection circuit of claim 3, wherein the slave MCU is further specifically configured to:
when a signal sent by a sending end of the slave MCU is a high-level signal and the second sampling signal is a high-level signal, judging that the second optocoupler does not have a fault;
and when the signal sent by the sending end of the slave MCU is a high level signal and the second sampling signal is a low level signal, judging that the second optocoupler has a fault.
6. The optocoupler fault detection circuit of claim 3, wherein the first sampling unit comprises:
and the non-inverting input end of the first comparator is connected with the sending end of the master MCU, the inverting input end of the first comparator is connected with the output end of the first comparator, and the output end of the first comparator is connected with the first feedback interface of the slave MCU.
7. The optocoupler fault detection circuit of claim 6, wherein the first sampling unit further comprises:
and the first end of the first capacitor is connected with the non-inverting input end of the first comparator, and the second end of the first capacitor is grounded and is used for keeping the voltage of the non-inverting input end of the first comparator.
8. The optocoupler fault detection circuit of claim 3, wherein the second sampling unit comprises:
and the non-inverting input end of the second comparator is connected with the receiving end of the master MCU, the inverting input end of the second comparator is connected with the output end of the second comparator, and the output end of the second comparator is connected with the second feedback interface of the slave MCU.
9. The optocoupler fault detection circuit of claim 8, wherein the second sampling unit further comprises:
and the first end of the second capacitor is connected with the non-inverting input end of the second comparator, and the second end of the second capacitor is grounded and is used for keeping the voltage of the non-inverting input end of the second comparator.
10. A communication system comprising a master MCU, a slave MCU, a first optocoupler and a second optocoupler, characterized by further comprising the optocoupler fault detection circuit of any of claims 1 to 9.
11. An optical coupler fault detection method applied to the optical coupler fault detection circuit as claimed in any one of claims 1 to 9, wherein the method comprises the following steps:
acquiring a first sampling signal and a second sampling signal; the first sampling signal is generated based on a signal sent by a sending end of the host MCU, and the second sampling signal is generated based on a signal received by a receiving end of the host MCU;
judging whether the first optocoupler breaks down or not according to the first sampling signal and a signal received by a receiving end of the slave MCU; and/or judging whether the second optocoupler breaks down or not according to a signal sent by a sending end of the slave MCU and the second sampling signal; the signal received by the receiving end of the slave MCU is a signal generated after the signal sent by the sending end of the master MCU passes through the first optocoupler, and the signal sent by the sending end of the slave MCU is transmitted to the receiving end of the master MCU through the second optocoupler.
12. The method of claim 11, wherein determining whether the first optocoupler has a fault according to the first sampling signal and a signal received from a receiving end of the slave MCU comprises:
if the signal sent by the sending end of the host MCU is a high-level signal and the signal received by the receiving end of the slave MCU is a high-level signal, judging that the first optocoupler is not in fault;
and if the first sampling signal is a high-level signal and the signal received by the receiving end of the slave MCU is a low-level signal, judging that the first optocoupler has a fault.
13. The method according to claim 11, wherein judging whether the second optocoupler has a fault according to the signal sent by the sending end of the slave MCU and the second sampling signal comprises:
if the signal sent by the sending end of the slave MCU is a high level signal and the second sampling signal is a high level signal, judging that the second optocoupler does not have a fault;
and if the signal sent by the sending end of the slave MCU is a high-level signal and the signal received by the receiving end of the host MCU is a low-level signal, judging that the second optocoupler has a fault.
14. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 11 to 13.
CN202110815587.1A 2021-07-19 2021-07-19 Optical coupler fault detection circuit and method and communication system Pending CN113433485A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110815587.1A CN113433485A (en) 2021-07-19 2021-07-19 Optical coupler fault detection circuit and method and communication system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110815587.1A CN113433485A (en) 2021-07-19 2021-07-19 Optical coupler fault detection circuit and method and communication system

Publications (1)

Publication Number Publication Date
CN113433485A true CN113433485A (en) 2021-09-24

Family

ID=77761150

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110815587.1A Pending CN113433485A (en) 2021-07-19 2021-07-19 Optical coupler fault detection circuit and method and communication system

Country Status (1)

Country Link
CN (1) CN113433485A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115219158A (en) * 2022-07-18 2022-10-21 中国南方电网有限责任公司超高压输电公司广州局 Thyristor converter valve detection circuit and method thereof

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115219158A (en) * 2022-07-18 2022-10-21 中国南方电网有限责任公司超高压输电公司广州局 Thyristor converter valve detection circuit and method thereof
CN115219158B (en) * 2022-07-18 2024-04-02 中国南方电网有限责任公司超高压输电公司广州局 Thyristor converter valve detection circuit and method thereof

Similar Documents

Publication Publication Date Title
CN109002368B (en) Working method of monitoring equipment and multi-core system
US9678919B2 (en) Collision detection in EIA-485 bus systems
CN108445436A (en) A kind of electric energy meter that twin-core operating status is mutually examined
US11372796B2 (en) Bus subscriber and method for operating a bus subscriber
CN113433485A (en) Optical coupler fault detection circuit and method and communication system
CN101206608A (en) Display apparatus having network communicating function and control method thereof
US20020128986A1 (en) Communication system for franking system
CN215340263U (en) Optical coupler fault detection circuit and communication system
KR20170122483A (en) System for detecting communication network
JP2006139634A (en) Equipment management device, communication channel diagnosis device, and equipment management method
US7711997B2 (en) Method of controlling a transceiver module
JP4549926B2 (en) Programmable control device
US20130054676A1 (en) Computer network based hazardous condition monitoring system and server
CN113196708B (en) Communication system
CN114443385A (en) Multi-interface testing device and server system
JP5669419B2 (en) Image forming apparatus
US6412016B1 (en) Network link bypass device
JP2932856B2 (en) Communication status monitoring method between host computers
US20190227896A1 (en) Monitoring device for recovering a stalled bus
CN105099408B (en) Reception device
US11729643B2 (en) Communication device and image forming apparatus
US20080231327A1 (en) Signal transfer systems and methods
US20230236647A1 (en) Receiver detection system and receiver detection device
TWI221047B (en) Integrate serial port plug and play into simple signaling communication type UPS
JP2854496B2 (en) Overvoltage protection device for disaster prevention monitoring device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination