Serial port plug-in detection circuit and serial port plug-in detection system

By introducing filter circuit and AND gate chip logic into the serial port plug-in detection circuit, the problem of low-level pulse interference during TTL-level serial port communication is solved, the accuracy and stability of serial port plug-in detection is improved, and the serial port is realized Efficient detection of plug-in and unplugging state.

CN113157527BActive Publication Date: 2025-01-14FUJIAN SHIDA COMP EQUIP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110458110.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-27
Publication Date
2025-01-14
Estimated Expiration
2041-04-27

AI Technical Summary

Technical Problem

The existing serial port plug-in detection methods have low-level pulse interference during TTL-level serial port communication, resulting in inaccurate detection, making it difficult to distinguish the state of the serial port being pulled out and inserted during communication.

Method used

A serial port plug-in detection circuit is designed, including a positive voltage detection module and a negative voltage detection module, each containing a filtering circuit to eliminate low-level or high-level pulses generated during communication and connect their output to The plug-in and de-assembly judgment module determines the plug-in and unplugging status of the serial port through the AND gate chip logic.

Benefits of technology

It realizes efficient and simple detection of the serial port plug-in and unplugging state, improves the detection accuracy, and filters out pulse interference during communication without affecting the serial port signal quality to ensure the stability of the detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113157527B_ABST
    Figure CN113157527B_ABST
Patent Text Reader

Abstract

The invention discloses a serial port plug-in detection circuit and a serial port plug-in detection system. By adding a filter circuit module in an existing positive voltage detection module and a negative voltage detection module, a low-level pulse generated by the serial port during TTL communication or a high-level pulse generated during RS232 communication can be filtered; the uncertain state other than the positive and negative levels can be filtered out without affecting the quality of the serial port signal, thereby improving the accuracy of the serial port plug-in detection; the positive voltage detection module and the negative voltage detection module are connected to the plug-in judgment module, so that the serial port to be detected can be detected conveniently and quickly, and whether a serial port device is inserted into the serial port to be detected can be judged according to the output signal thereof, thereby realizing efficient and convenient detection of the serial port plug-in state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of serial port detection, and in particular to a serial port plug-in detection circuit and a serial port plug-in detection system. Background Art

[0002] At present, many serial port devices are still used in the financial industry and industrial control industry. With the development of technology, customers have higher and higher requirements for serial port communication between host and peripheral terminals, such as synchronous power on and off, level adaptation or better human-computer interaction, and these applications rely heavily on serial port plug-in detection. Existing serial port plug-in detection usually detects the status of the serial port through positive and negative voltage detection modules respectively, and obtains the plug-in status of the serial port by comprehensively analyzing the status of the serial port detected by the positive and negative voltage detection modules respectively.

[0003] However, the serial port includes RS232 level serial port and TTL level serial port. When the serial port is TTL level serial port, the level of the serial port transmission signal is generally 0V~0.8V and +2V~+5V. Therefore, when the TTL level serial port communicates, the serial port will have a 0V~0.8V signal level, that is, the TTL level serial port will generate a low level pulse during communication. The state of the low level pulse detected by the positive and negative voltage detection module is the same as the state when the serial port is unplugged. Therefore, there is a possibility that the serial port is detected as unplugged during the communication process, resulting in inaccurate detection of the serial port plug-in and unplugging. Summary of the invention

[0004] In order to overcome the defects of the prior art, the technical problem to be solved by the present invention is to provide a serial port plug and unplug detection circuit and a serial port plug and unplug detection system to improve the accuracy of serial port plug and unplug detection.

[0005] In order to solve the above technical problems, a technical solution adopted by the present invention is:

[0006] A serial port plug-in detection circuit comprises a positive voltage detection module and a negative voltage detection module, wherein the input ends of the positive voltage detection module and the negative voltage detection module are respectively connected to a serial port to be detected, and when the input end of the positive voltage detection module is a positive voltage, the positive voltage detection module outputs a low level, and when the input end of the positive voltage detection module is a non-positive voltage, the positive voltage detection module outputs a high level; when the input end of the negative voltage detection module is a negative voltage, the negative voltage detection module outputs a low level, and when the input end of the negative voltage detection module is a non-negative voltage, the negative voltage detection module outputs a high level, and further comprises a plug-in judgment module;

[0007] The positive voltage detection module includes a filter circuit, and the filter circuit is used to eliminate the low-level pulses generated by the serial port during communication;

[0008] The negative voltage detection module includes a filter circuit, and the filter circuit is used to eliminate the high level pulses generated by the serial port during communication;

[0009] The output end of the positive voltage detection module and the output end of the negative voltage detection module are respectively connected to the two input ends of the plug-in and unplug determination module.

[0010] Further, the negative voltage detection module includes a first diode, a first NMOS tube, a PMOS tube, a first capacitor, a second capacitor, a first resistor, a second resistor, a third resistor and a fourth resistor;

[0011] The first capacitor, the first resistor and the second resistor constitute a filter circuit of the negative voltage detection module;

[0012] The cathode of the first diode is connected to the serial port to be detected, the anode of the first diode is respectively connected to one end of the second capacitor, one end of the fourth resistor and the source of the first NMOS tube, the other end of the second capacitor, the other end of the fourth resistor and the gate of the first NMOS tube are grounded, the drain of the first NMOS tube is respectively connected to one end of the third resistor and the gate of the PMOS tube, the other end of the third resistor is connected to a power supply, the drain of the PMOS tube is grounded, the source of the PMOS tube is respectively connected to one end of the first resistor and one end of the second resistor, the other end of the first resistor is connected to a power supply, and the other end of the second resistor and one end of the first capacitor are respectively connected to one of the input ends of the plug-in judgment module;

[0013] The positive voltage detection module includes a second diode, a second NMOS tube, a third capacitor, a fourth capacitor, a fifth resistor, a sixth resistor and a seventh resistor;

[0014] The third capacitor, the fifth resistor and the sixth resistor constitute a filter circuit of the positive voltage detection module;

[0015] The anode of the second diode is connected to the serial port to be detected, the cathode of the second diode is respectively connected to one end of the fourth capacitor, one end of the seventh resistor and the gate of the second NMOS tube, the other end of the fourth capacitor, the other end of the seventh resistor and the source of the second NMOS tube are all grounded, the drain of the second NMOS tube is respectively connected to one end of the fifth resistor and one end of the sixth resistor, the other end of the fifth resistor is connected to a power supply, one end of the third capacitor is respectively connected to the other end of the sixth resistor and the other input end of the plug-in judgment module, and the other end of the third capacitor is grounded.

[0016] Furthermore, the sixth resistor is smaller than a first preset resistance value, and the third capacitor is larger than the first preset capacitance value.

[0017] Furthermore, the sixth resistor is 100Ω;

[0018] The fifth resistor is 10KΩ;

[0019] The third capacitor is 10 μF.

[0020] Further, the plug-in judgment module includes an AND gate chip, a fifth capacitor, a sixth capacitor, an eighth resistor, a ninth resistor and a tenth resistor;

[0021] The output end of the negative voltage detection module is connected to one of the input ends of the AND gate chip through the eighth resistor;

[0022] The output end of the positive voltage detection module is connected to another input end of the AND gate chip through the ninth resistor;

[0023] The power supply terminal of the AND gate chip is respectively connected to the power supply and one end of the fifth capacitor, and the other end of the fifth capacitor is grounded;

[0024] The output end of the AND gate chip is connected to one end of the tenth resistor and one end of the sixth capacitor respectively;

[0025] The other end of the tenth resistor and the other end of the sixth capacitor are grounded.

[0026] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0027] A serial port plug-in detection system comprises a host, a controller and a plurality of serial port plug-in detection circuits;

[0028] The input end of each serial port plug-in detection circuit is used to connect to a corresponding serial port to be detected;

[0029] The output end of each of the serial port plug detection circuits is connected to one end of the controller;

[0030] The other end of the controller is connected to the host.

[0031] The beneficial effects of the present invention are as follows: by adding a filter circuit to the existing positive and negative voltage detection modules, the filter circuit, as a filter network, can filter the low-level pulses generated by the serial port during TTL communication or the high-level pulses generated during RS232 communication, so that the positive and negative voltage detection modules can output a relatively stable DC level; it can filter out the pulse interference during serial port communication without affecting the quality of the serial port signal, thereby improving the accuracy of the serial port plug-in detection; and the positive voltage detection module and the negative voltage detection module are connected to the plug-in judgment module as two inputs of the plug-in judgment module respectively, as long as the serial port is in an electrically connected state, no matter whether the connected serial port is a TTL level or an RS232 level, as long as the positive voltage detection module detects a positive voltage (detects a TTL communication signal) or the negative voltage detection module detects a positive voltage (detects a TTL communication signal) or the negative voltage detection module detects a negative voltage (detects a TTL communication signal). When a negative voltage is detected (RS232 communication signal is detected), that is, the output of the positive voltage detection module is low or the output of the negative voltage detection module is low, the plug-in judgment module outputs a low level, indicating that the serial port is in a connected state; conversely, when the positive voltage detection module outputs a high level (no TTL communication signal is detected) and the negative voltage detection module outputs a high level (no RS232 communication signal is detected), the plug-in judgment module outputs a high level, indicating that the serial port is unplugged or the connected device is in a shutdown state. Therefore, a serial port plug-in detection circuit can be used to conveniently and quickly detect the serial port to be detected. According to its output signal, it can be determined whether a serial port device is inserted into the serial port to be detected and whether the connected device is in a working state, thereby realizing efficient and convenient detection of the serial port plug-in state. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 FIG. 1 is a principle block diagram of a serial port plug-in detection circuit according to an embodiment of the present invention;

[0033] Figure 2 The figure shows a circuit schematic diagram of a negative voltage detection module in a serial port plug detection circuit according to an embodiment of the present invention;

[0034] Figure 3 The figure shows a circuit schematic diagram of a positive voltage detection module in a serial port plug-in detection circuit according to an embodiment of the present invention;

[0035] Figure 4 The figure shows an electrical schematic diagram of a plug-in / plug-out judgment module in a serial port plug-in / plug-out detection circuit according to an embodiment of the present invention;

[0036] Figure 5 It is a flowchart of serial port plug-in detection and judgment when the serial port is an RS232 level serial port according to an embodiment of the present invention;

[0037] Figure 6 It is a flowchart of serial port plug-in detection and judgment when the serial port is a TTL level serial port according to an embodiment of the present invention;

[0038] Figure 7 The present invention is a schematic structural diagram of a serial port plug and unplug detection system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.

[0040] Please refer to Figures 1 to 6 As shown, a serial port plug-in detection circuit of the present invention comprises a positive voltage detection module and a negative voltage detection module, the input ends of the positive voltage detection module and the negative voltage detection module are respectively connected to the serial port to be detected, when the input end of the positive voltage detection module is a positive voltage, the positive voltage detection module outputs a low level, when the input end of the positive voltage detection module is a non-positive voltage, the positive voltage detection module outputs a high level; when the input end of the negative voltage detection module is a negative voltage, the negative voltage detection module outputs a low level, when the input end of the negative voltage detection module is a non-negative voltage, the negative voltage detection module outputs a high level, and also comprises a plug-in judgment module;

[0041] The positive voltage detection module includes a filter circuit, and the filter circuit is used to eliminate the low-level pulses generated by the serial port during communication;

[0042] The negative voltage detection module includes a filter circuit, and the filter circuit is used to eliminate the high level pulses generated by the serial port during communication;

[0043] The output end of the positive voltage detection module and the output end of the negative voltage detection module are respectively connected to the two input ends of the plug-in and unplug determination module.

[0044] As can be seen from the above description, the beneficial effects of the present invention are as follows: by adding a filter circuit to the existing positive and negative voltage detection modules, the filter circuit, as a filter network, can filter the low-level pulses generated by the serial port during TTL communication or the high-level pulses generated during RS232 communication, so that the positive and negative voltage detection modules can output a relatively stable DC level; it can filter out the pulse interference during serial port communication without affecting the quality of the serial port signal, thereby improving the accuracy of serial port plug-in detection; and the positive voltage detection module and the negative voltage detection module are connected to the plug-in judgment module as two inputs of the plug-in judgment module respectively, as long as the serial port is in an electrically connected state, no matter whether the connected serial port is a TTL level or an RS232 level, as long as the positive voltage detection module detects a positive voltage (detects a TTL communication signal) or a negative voltage When the detection module detects a negative voltage (detects an RS232 communication signal), that is, the output of the positive voltage detection module is a low level or the output of the negative voltage detection module is a low level, the plug-in judgment module outputs a low level, indicating that the serial port is in a connected state; conversely, when the positive voltage detection module outputs a high level (no TTL communication signal is detected) and the negative voltage detection module outputs a high level (no RS232 communication signal is detected), the plug-in judgment module outputs a high level, indicating that the serial port is unplugged or the connected device is in a shutdown state. Therefore, a serial port plug-in detection circuit can be used to conveniently and quickly detect the serial port to be detected. According to its output signal, it can be determined whether a serial port device is inserted into the serial port to be detected and whether the connected device is in a working state, thereby realizing efficient and convenient detection of the serial port plug-in state.

[0045] Further, the negative voltage detection module includes a first diode, a first NMOS tube, a PMOS tube, a first capacitor, a second capacitor, a first resistor, a second resistor, a third resistor and a fourth resistor;

[0046] The first capacitor, the first resistor and the second resistor constitute a filter circuit of the negative voltage detection module;

[0047] The cathode of the first diode is connected to the serial port to be detected, the anode of the first diode is respectively connected to one end of the second capacitor, one end of the fourth resistor and the source of the first NMOS tube, the other end of the second capacitor, the other end of the fourth resistor and the gate of the first NMOS tube are all grounded, the drain of the first NMOS tube is respectively connected to one end of the third resistor and the gate of the PMOS tube, the other end of the third resistor is connected to a power supply, the drain of the PMOS tube is grounded, the source of the PMOS tube is respectively connected to one end of the first resistor and one end of the second resistor, the other end of the first resistor is connected to a power supply, the other end of the second resistor and one end of the first capacitor are respectively connected to one of the input ends of the plug-in judgment module, and the other end of the first capacitor is grounded;

[0048] The positive voltage detection module includes a second diode, a second NMOS tube, a third capacitor, a fourth capacitor, a fifth resistor, a sixth resistor and a seventh resistor;

[0049] The third capacitor, the fifth resistor and the sixth resistor constitute a filter circuit of the positive voltage detection module;

[0050] The anode of the second diode is connected to the serial port to be detected, the cathode of the second diode is respectively connected to one end of the fourth capacitor, one end of the seventh resistor and the gate of the second NMOS tube, the other end of the fourth capacitor, the other end of the seventh resistor and the source of the second NMOS tube are all grounded, the drain of the second NMOS tube is respectively connected to one end of the fifth resistor and one end of the sixth resistor, the other end of the fifth resistor is connected to a power supply, one end of the third capacitor is respectively connected to the other end of the sixth resistor and the other input end of the plug-in judgment module, and the other end of the third capacitor is grounded.

[0051] From the above description, it can be seen that when the TTL level serial port communicates, when a low level is sent, the voltage is generally between 0V and +0.8V. The state detected by the positive voltage detection module is the same as that of the serial port being unplugged. Therefore, the third capacitor, the fifth resistor and the sixth resistor form a filter circuit, which can be filtered to ensure the accuracy of the serial port plug and unplug detection; similarly, the negative voltage detection module can filter out the influence of the high level +3V to +15V pulse signal of the serial port on the output of the negative voltage detection module during RS232 communication by setting a filter circuit composed of the first resistor, the second resistor and the first capacitor.

[0052] Furthermore, the sixth resistor is smaller than a first preset resistance value, and the third capacitor is larger than the first preset capacitance value.

[0053] Furthermore, the sixth resistor is 100Ω;

[0054] The fifth resistor is 10KΩ;

[0055] The third capacitor is 10 μF.

[0056] From the above description, it can be seen that by setting the sixth resistor to be sufficiently low, it can be approximately considered that the preset power supply charges the third capacitor through the fifth resistor, and by setting the third capacitor to be greater than a preset capacitance value, it is ensured that the charging circuit composed of the fifth resistor and the third capacitor cannot reach a high level threshold value exceeding the plug and unplug judgment module during the maximum possible low level time period of the TTL level, thereby achieving filtering of the low level pulse width of the TTL level serial port.

[0057] Further, the plug-in judgment module includes an AND gate chip, a fifth capacitor, a sixth capacitor, an eighth resistor, a ninth resistor and a tenth resistor;

[0058] The output end of the negative voltage detection module is connected to one of the input ends of the AND gate chip through the eighth resistor;

[0059] The output end of the positive voltage detection module is connected to another input end of the AND gate chip through the ninth resistor;

[0060] The power supply terminal of the AND gate chip is respectively connected to the power supply and one end of the fifth capacitor, and the other end of the fifth capacitor is grounded;

[0061] The output end of the AND gate chip is connected to one end of the tenth resistor and one end of the sixth capacitor respectively;

[0062] The other end of the tenth resistor and the other end of the sixth capacitor are grounded.

[0063] From the above description, it can be seen that when the positive voltage detection module outputs a low level (detects a TTL communication signal), or the negative voltage detection module outputs a low level (detects an RS232 communication signal), the plug-in judgment module outputs a low level, indicating that the serial port is in a connected state; conversely, when the positive voltage detection module outputs a high level (no TTL communication signal is detected) and the negative voltage detection module outputs a high level (no RS232 communication signal is detected), the plug-in judgment module outputs a high level, indicating that the serial port is unplugged or the connected device is in a shutdown state; through a simple serial port plug-in The detection circuit can conveniently and quickly detect the serial port to be detected, and can determine whether a serial port device is plugged into the serial port to be detected and whether the access device is in working state according to its output signal. When the output of the serial port plug-in detection circuit is at a high level, it indicates that no external serial port device is connected or the access device is in a shutdown state. When the output of the serial port plug-in detection circuit is at a low level, it indicates that an external serial port device is connected, thereby realizing efficient and convenient detection of the serial port plug-in state, and the sixth capacitor and the tenth resistor are used to filter out jitter pulses and enhance the stability of the output level of the AND gate chip.

[0064] Please refer to Figure 7 , a serial port plug detection system, comprising a host, a controller and a plurality of the above serial port plug detection circuits;

[0065] The input end of each serial port plug-in detection circuit is used to connect to a corresponding serial port to be detected;

[0066] The output end of each of the serial port plug detection circuits is connected to one end of the controller;

[0067] The other end of the controller is connected to the host.

[0068] From the above description, it can be seen that by setting the above-mentioned serial port plug-in detection circuit between the controller and each serial port, it is possible to intelligently detect whether each serial port is in an abnormal connection state, provide better information interaction, and prompt which specific serial port device is abnormally connected or not powered on.

[0069] Embodiment 1

[0070] Please refer to Figure 1, a serial port plug-in detection circuit, comprising a positive voltage detection module and a negative voltage detection module, the input ends of the positive voltage detection module and the negative voltage detection module are respectively connected to the serial port to be detected, that is, connected to the serial port socket to be detected, when the input end of the positive voltage detection module is a positive voltage, the positive voltage detection module outputs a low level, when the input end of the positive voltage detection module is a non-positive voltage, the positive voltage detection module outputs a high level; when the input end of the negative voltage detection module is a negative voltage, the negative voltage detection module outputs a low level, when the input end of the negative voltage detection module is a non-negative voltage, the negative voltage detection module outputs a high level, and also includes a plug-in judgment module;

[0071] The positive voltage detection module includes a filter circuit, and the filter circuit is used to eliminate the low-level pulses generated by the serial port during communication;

[0072] The negative voltage detection module includes a filter circuit, and the filter circuit is used to eliminate the high level pulses generated by the serial port during communication;

[0073] The output end of the positive voltage detection module and the output end of the negative voltage detection module are respectively connected to the two input ends of the plug-in and unplug judgment module;

[0074] The above-mentioned serial port plug-in and plug-out detection circuit is mainly based on the detection of signals sent by the external serial port. According to the difference in the signals sent by the external serial port when the external serial port device is connected and unplugged (including shutdown), plug-in and plug-out judgment is realized, which includes a positive voltage detection module, a negative voltage detection module and a plug-in and plug-out judgment module.

[0075] Figure 1 The diagram shows a principle block diagram, in which the positive voltage detection module is used to detect whether the signal sent by the external serial port is a positive voltage; the negative voltage detection module is used to detect whether the signal sent by the external serial port is a negative voltage; the plug-in judgment module is used to receive the results of the positive voltage detection module and the negative voltage detection module, and analyze whether the current serial port is in the plug-in or unplug-out state based on the comprehensive judgment of the results of the two detection modules;

[0076] Among them, Figure 2As shown, the negative voltage detection module includes a first diode D1, a first NMOS tube Q2, a PMOS tube Q1, a first capacitor C1, a second capacitor C2, a first resistor R1, a second resistor R2, a third resistor R3 and a fourth resistor R4; the cathode of the first diode D1 is connected to the M_RX end of the serial port to be detected, the anode of the first diode D1 is respectively connected to one end of the second capacitor C2, one end of the fourth resistor R4 and the source S of the first NMOS tube Q2, the other end of the second capacitor C2, the other end of the fourth resistor R4 and the first NMOS tube Q2 The gates G of the first NMOS tube Q2 are grounded, the drain D of the first NMOS tube Q2 is respectively connected to one end of the third resistor R3 and the gate G of the PMOS tube Q1, the other end of the third resistor R3 is connected to the power supply, the drain D of the PMOS tube Q1 is grounded, the source S of the PMOS tube Q1 is respectively connected to one end of the first resistor R1 and one end of the second resistor R2, the other end of the first resistor R1 is connected to the power supply, the other end of the second resistor R2 and one end of the first capacitor C1 are respectively connected to one of the input ends of the plug-in judgment module, and the other end of the first capacitor C1 is grounded;

[0077] Among them, the first diode D1 is used to conduct negative voltage to isolate positive voltage and pick up low-level signals of RS232 serial communication; the second capacitor C2 is used to filter out jitter pulses on negative voltage in serial communication signals, and the fourth resistor R4, on the one hand, provides a 0 level to the positive electrode of the first diode D1, so that when M_RX is a negative level, the first diode D1 can be turned on; on the other hand, when M_RX is a positive level, it provides a stable low level to the source of the first NMOS tube Q2, that is, it is used to ensure that the first NMOS tube Q2 remains in a closed state when M_RX is a non-negative level;

[0078] The first capacitor C1, the first resistor R1 and the second resistor R2 form a filter network for eliminating the high level pulses generated by the serial port during communication contained in the output signal, thereby ensuring that the detection result is not affected by the level conversion during communication;

[0079] like Figure 2 As shown, the value of the first capacitor C1 is set to 1000pF, and the value of the second capacitor C2 is set to 100pF; the principle of the negative voltage detection module is as follows:

[0080] If the serial port M_RX is a negative voltage, generally -3V to -15V, then the first diode D1 is turned on, the source of the first NMOS tube Q2 is a negative voltage, the drain and source of the first NMOS tube Q2 are turned on, the gate of the PMOS tube Q1 is a negative voltage, the drain and source of the PMOS tube Q1 are turned on, and the Negative_VL_DET1 output is a low level;

[0081] If the serial port M_RX is a non-negative voltage, generally +3V to +15V or 0V to +0.8V or +2V to +5V, then the first diode D1 is cut off, the first NMOS tube Q2 is not conducting, the gate of the PMOS tube Q1 is high level, the PMOS tube Q1 is not conducting, and the Negative_VL_DET1 output is high level; the resistance and capacitance values ​​in the figure can be adjusted or even cancelled according to the actual required effect;

[0082] like Figure 3 As shown, the positive voltage detection module includes a second diode D2, a second NMOS tube Q3, a third capacitor C3, a fourth capacitor C4, a fifth resistor R5, a sixth resistor R6 and a seventh resistor R7; the positive electrode of the second diode D2 is connected to the serial port M_RX port to be detected, the negative electrode of the second diode D2 is respectively connected to one end of the fourth capacitor C4, one end of the seventh resistor R7 and the gate G of the second NMOS tube Q3, the other end of the fourth capacitor C4, the other end of the seventh resistor R7 and the source S of the second NMOS tube Q3 are all grounded, the drain D of the second NMOS tube Q3 is respectively connected to one end of the fifth resistor R5 and one end of the sixth resistor R6, the other end of the fifth resistor R5 is connected to the power supply, one end of the third capacitor C3 is respectively connected to the other end of the sixth resistor R6 and the other input end of the plug-in judgment module, and the other end of the third capacitor C3 is grounded;

[0083] Among them, the second diode D2 is used to conduct positive voltage to isolate negative voltage and pick up high-level signals of serial communication; the fourth capacitor C4 is used to filter out jitter pulses on the positive voltage in the serial communication signal; the seventh resistor R7, on the one hand, provides a 0 level to the positive electrode of the second diode D2, so that when M_RX is at a high level, the second diode D2 can be turned on; on the other hand, when M_RX is at a low level, it provides a stable low level to the source of the second NMOS tube Q3, that is, it is used to ensure that the second NMOS tube Q3 remains in a closed state when M_RX is not at a positive level; the third capacitor C3, the fifth resistor R5 and the sixth resistor R6 form a filter network, which is used to eliminate the low-level pulses generated by the serial port during communication contained in the output signal, and ensure that the detection result is not affected by the level conversion during communication;

[0084] like Figure 3 As shown, the third capacitor C3 is 10μF; the principle of the positive voltage detection module is as follows:

[0085] If the serial port M_RX is a positive voltage, generally +3V to +15V or +2V to +5V, then the second diode D2 is turned on, the gate of the second NMOS tube Q3 is at a high level, the drain-source of the second NMOS tube Q3 is turned on, and the output of Positive_VL_DET2 is a low level;

[0086] If the serial port M_RX is a non-positive voltage, generally -3V to -15V or 0V to +0.8V, the second diode D2 is cut off, the gate G of the second NMOS tube Q3 is at a low level, the drain and source of the second NMOS tube Q3 are not conducting, and the Positive_VL_DET2 output is at a high level;

[0087] R5, R6 and C3 form a positive voltage detection filter circuit, which is used to filter the low-level pulses generated by the TTL level serial port during communication. When the TTL level serial port is communicating, when sending a low level, the voltage is generally between 0V and +0.8V. The state detected by the positive voltage detection module is the same as the serial port unplugging, so a filter circuit is needed to filter it out.

[0088] Specifically, the sixth resistor R6 is smaller than the first preset resistance value, and the third capacitor C3 is larger than the first preset capacitance value;

[0089] Among them, the input Ciss (gate short-circuit common source input capacitance) of the second NMOS tube Q3 is small and does not affect the level signal quality;

[0090] When M_RX is at a positive voltage high level, the second NMOS tube Q3 is turned on. Since the resistance of R6 is low enough and the impedance of other paths of C3 is large, C3 can be approximately regarded as discharging to the ground through R6. Positive_VL_DET2 can quickly respond to the output low level and realize real-time detection of positive voltage.

[0091] When M_RX is at a zero voltage low level, Q3 is turned off. Since R6 is relatively low, it can be approximately considered that VCC charges C3 through the resistor R5. That is, the first preset resistance value is set so that the sixth resistor R6 is sufficiently low, and it can be approximately considered that VCC charges C3 through the resistor R5.

[0092] The universal minimum baud rate of the serial port is 1200bps. According to the limit of continuously sending 0X00 data, the maximum low-level pulse width of the TTL level serial port is about 75ms; the R5 and C3 charging circuits must not exceed the high-level threshold value of the plug-in judgment module within 75ms; thereby filtering the low-level pulse width of the TTL level serial port;

[0093] Positive_VL_DET2 keeps low level. When the serial port is unplugged, it usually takes more than 1 second. At this time, the R5 and C3 charging circuits have enough time to reach high level.

[0094] When selecting the values ​​of the components of the filter circuit, the selection is made according to the following principles. The values ​​of the components of the filter circuit in the positive voltage detection module and the negative voltage detection module can be selected according to the following principles. This embodiment is described with reference to the components of the filter circuit in the positive voltage detection module:

[0095] The universal minimum baud rate of the serial port is 1200bps. According to the limit of continuously sending 0X00 data, the maximum low-level pulse width of the TTL level serial port is about 75ms. The R5 and C3 charging circuits must meet the requirement that they cannot exceed the high-level threshold value (i.e. 0.8V) of the plug-in judgment module within 75ms, thereby filtering the low-level pulse width of the TTL level serial port.

[0096] Charging time calculation formula: Vt = V0 + (V1-V0) * [1-exp (-t / R5*C3)]

[0097] t is time;

[0098] R5 is the resistance value, C3 is the capacitance value;

[0099] V0 is the initial voltage value on the capacitor;

[0100] V1 is the voltage value to which the capacitor can be charged in the end;

[0101] Vt is the voltage value on the capacitor at time t;

[0102] In this embodiment, t time is 75ms, V0 is 0V, V1 is VCC (3.3V), and Vt is 0.8V;

[0103] Substituting into the formula, we get: 0.8>0+(3.3-0)*[1-exp(-75ms / R5*C3)]

[0104] Calculated: 75ms<4.3R5*C3, C3>1.74*10 -2 / R5, that is, the setting of the first preset capacitance value must satisfy, C3>1.74*10 -2 / R5;

[0105] The value of R5 is 10KΩ, and when it is put into the formula, we get C3>1.74*10 -6 F (i.e. 1.74μF);

[0106] To ensure that it is not affected by TTL level data, the capacitor C3 is selected to be 10μF, that is, the continuous input low level is greater than 100ms to be detected as unplugged;

[0107] The selection of filter circuit element parameters in the negative voltage detection module is based on the same principle as that of the positive voltage detection module, that is, to ensure that the filter circuit can filter out the interference of positive voltage pulses in the RS232 signal.

[0108] in, Figure 4 The figure shows the electrical schematic diagram of the plug-in judgment module in the serial port plug-in detection circuit in this embodiment, wherein the plug-in judgment module includes an AND gate chip U1, a fifth capacitor C5, a sixth capacitor C6, an eighth resistor R8, a ninth resistor R9 and a tenth resistor R10;

[0109] The output end of the negative voltage detection module is connected to one of the input ends of the AND gate chip U1 through the eighth resistor R8;

[0110] The output end of the positive voltage detection module is connected to another input end of the AND gate chip U1 through the ninth resistor R9;

[0111] The power supply end of the AND gate chip U1 is respectively connected to the power supply and one end of the fifth capacitor C5, and the other end of the fifth capacitor C5 is grounded;

[0112] The output end of the AND gate chip U1 is connected to one end of the tenth resistor R10 and one end of the sixth capacitor R6 respectively;

[0113] The other end of the tenth resistor R10 and the other end of the sixth capacitor C6 are grounded;

[0114] Among them, the fifth capacitor C5 is used for power supply filtering, the sixth capacitor C6 is used to eliminate jitter and interference, and the tenth resistor R10 is used to stabilize the level;

[0115] In the specific judgment, the serial port receiving signal M_RX on the device side is short-circuited with the external serial port sending signal EXT_UART_TX. When the serial port is an RS232 level serial port, the voltage of EXT_UART_TX is generally -3V to -15V or +3V to +15V. If the positive voltage detection module detects that M_RX is a positive voltage, or the negative voltage detection module detects that M_RX is a negative voltage, it is judged that a serial port device is connected. Otherwise, it is judged that the serial port is unplugged or the connected device is in the shutdown state. The specific flow chart is as follows: Figure 5 As shown;

[0116] When the serial port is a TTL level serial port, the voltage of the EXT_UART_TX signal is generally 0V~0.8V or +2V~+5V. When the serial port is communicating, the EXT_UART_TX level will be in the state of 0V~0.8V. Since the positive voltage detection module has a filter circuit to filter the low level generated during the communication process, the low level during serial port communication cannot be captured by the positive voltage detection module. If the positive voltage detection module detects that M_RX is a positive voltage, it is determined that there is a serial port connected; otherwise, it is determined that the serial port is unplugged or the connected device is in the shutdown state. The specific flow chart is as follows: Figure 6 As shown;

[0117] In summary, no matter whether the connected serial port is RS232 level or TTL level, as long as the positive and negative voltage detection modules detect the external serial port sending signal EXT_UART_TX, the plug-in status of the serial port can be determined, which can be achieved through a simple logic AND gate circuit: when the negative voltage detection module detects a negative voltage, the signal Negative_VL_DET1 is low level, and when the positive voltage detection module detects a positive voltage, the signal Positive_VL_DET2 is low level; when the signal Negative_VL_DET1 and the signal Positive_VL_DET2 are both high levels, it is determined that there is no external serial port device connected or the device is in the shutdown state; otherwise, it is determined that there is a serial port device connected, and the corresponding truth table is shown in Table 1:

[0118] Table 1

[0119] Access Status Negative_VL_DET1 status Positive_VL_DET2 status PULLOUT_FLAG status Not connected High level High level High level RS232 interface access Low level High level Low level TTL interface access High level Low level Low level

[0120] Embodiment 2

[0121] This embodiment applies the above serial port plug detection circuit to the intelligent management of multiple serial ports. Figure 7 As shown, a serial port plug detection system includes a host, a controller and a plurality of serial port plug detection circuits described in the first embodiment;

[0122] When intelligently managing multiple serial ports, each of the serial ports is connected to an input end of the serial port plug-in detection circuit;

[0123] The output end of the serial port plug detection circuit is connected to one end of the controller;

[0124] The other end of the controller is connected to the host;

[0125] A serial port plug-in detection circuit is added to each serial port, and the controller monitors the status of the serial port plug-in detection output. If it is monitored that the corresponding serial port is in the device unplugged state, the controller can output interactive information to the user to remind the device connection abnormality, thereby achieving better fault monitoring and maintenance of the serial port device.

[0126] In summary, the present invention provides a serial port plug-in detection circuit and a serial port plug-in detection system. By adding a filter circuit composed of a third capacitor, a fifth resistor and a sixth resistor to the existing positive voltage detection module, and adding a filter circuit composed of a first capacitor, a first resistor and a second resistor to the existing negative voltage detection module, the influence of a low-level pulse generated by the serial port during TTL communication on the output level of the positive voltage detection module, or the influence of a high-level pulse generated during RS232 communication on the output level of the negative voltage detection module can be eliminated; the pulse interference during serial port communication is filtered out without affecting the quality of the serial port signal, thereby improving the accuracy of serial port plug-in detection; and the positive voltage detection module and the negative voltage detection module are connected to the AND circuit module as two inputs of the AND circuit module respectively. No matter whether the connected serial port is TTL level or RS232 level, as long as the positive voltage detection module detects When a positive voltage (TTL signal) is detected or a negative voltage detection module detects a negative voltage (RS232 signal), that is, the output of the positive voltage detection module is a low level or the output of the negative voltage detection module is a low level, it means that the serial port device is connected to the serial port to be detected. Therefore, the serial port to be detected can be detected conveniently and quickly through the combination of AND gate chip, resistor and capacitor. According to its output level, it can be judged whether there is a serial port device inserted in the serial port to be detected. When the output of the serial port plug-in detection circuit is a high level, it means that no external serial port device is connected or the connected device is in the shutdown state. When the output of the serial port plug-in detection circuit is a low level, it means that an external serial port device is connected, thereby realizing efficient and convenient detection of the serial port plug-in status. The above serial port plug-in detection circuit can be applied to communication systems that need to detect the serial port plug-in status, such as equipment or systems that need to intelligently manage multiple serial port devices.

[0127] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A serial port plug-in detection circuit, comprising a positive voltage detection module and a negative voltage detection module, wherein the input ends of the positive voltage detection module and the negative voltage detection module are respectively connected to the serial port to be detected, and when the input end of the positive voltage detection module is a positive voltage, the positive voltage detection module outputs a low level, and when the input end of the positive voltage detection module is a non-positive voltage, the positive voltage detection module outputs a high level; when the input end of the negative voltage detection module is a negative voltage, the negative voltage detection module outputs a low level, and when the input end of the negative voltage detection module is a non-negative voltage, the negative voltage detection module outputs a high level, characterized in that: It also includes a plug-in and plug-out judgment module; The plug-in judgment module includes an AND gate chip, a fifth capacitor, a sixth capacitor, an eighth resistor, a ninth resistor and a tenth resistor; the output end of the negative voltage detection module is connected to one of the input ends of the AND gate chip through the eighth resistor; the output end of the positive voltage detection module is connected to another input end of the AND gate chip through the ninth resistor; the power supply end of the AND gate chip is respectively connected to the power supply and one end of the fifth capacitor, and the other end of the fifth capacitor is grounded; the output end of the AND gate chip is respectively connected to one end of the tenth resistor and one end of the sixth capacitor; the other end of the tenth resistor and the other end of the sixth capacitor are grounded; The positive voltage detection module includes a filter circuit, and the filter circuit is used to eliminate the low-level pulses generated by the serial port during communication; The negative voltage detection module includes another filter circuit, which is used to eliminate the high level pulses generated by the serial port during communication; The output end of the positive voltage detection module and the output end of the negative voltage detection module are respectively connected to the two input ends of the plug-in and unplug judgment module; The negative voltage detection module includes a first diode, a first NMOS tube, a PMOS tube, a first capacitor, a second capacitor, a first resistor, a second resistor, a third resistor and a fourth resistor; The first capacitor, the first resistor and the second resistor constitute a filter circuit of the negative voltage detection module; The cathode of the first diode is connected to the serial port to be detected, the anode of the first diode is respectively connected to one end of the second capacitor, one end of the fourth resistor and the source of the first NMOS tube, the other end of the second capacitor, the other end of the fourth resistor and the gate of the first NMOS tube are all grounded, the drain of the first NMOS tube is respectively connected to one end of the third resistor and the gate of the PMOS tube, the other end of the third resistor is connected to a power supply, the drain of the PMOS tube is grounded, the source of the PMOS tube is respectively connected to one end of the first resistor and one end of the second resistor, the other end of the first resistor is connected to a power supply, the other end of the second resistor and one end of the first capacitor are respectively connected to one of the input ends of the plug-in judgment module, and the other end of the first capacitor is grounded; The positive voltage detection module includes a second diode, a second NMOS tube, a third capacitor, a fourth capacitor, a fifth resistor, a sixth resistor and a seventh resistor; The third capacitor, the fifth resistor and the sixth resistor constitute a filter circuit of the positive voltage detection module; The anode of the second diode is connected to the serial port to be detected, the cathode of the second diode is respectively connected to one end of the fourth capacitor, one end of the seventh resistor and the gate of the second NMOS tube, the other end of the fourth capacitor, the other end of the seventh resistor and the source of the second NMOS tube are all grounded, the drain of the second NMOS tube is respectively connected to one end of the fifth resistor and one end of the sixth resistor, the other end of the fifth resistor is connected to a power supply, one end of the third capacitor is respectively connected to the other end of the sixth resistor and the other input end of the plug-in judgment module, and the other end of the third capacitor is grounded.

2. A serial port plug detection circuit according to claim 1, characterized in that: The sixth resistor is smaller than the first preset resistor value, and the third capacitor is larger than the first preset capacitor value.

3. A serial port plug detection circuit according to claim 2, characterized in that: The sixth resistor is 100Ω; The fifth resistor is 10KΩ; The third capacitor is 10 μF.

4. A serial port plug-in detection system, characterized in that: It comprises a host, a controller and a plurality of serial port plug detection circuits as described in any one of claims 1 to 3; The input end of each serial port plug-in detection circuit is used to connect to a corresponding serial port to be detected; The output end of each of the serial port plug detection circuits is connected to one end of the controller; The other end of the controller is connected to the host.

Citation Information

Patent Citations

  • Serial port plugging detection circuit and serial port plugging detection system

    CN214896584U