Single-chip microcomputer GPIO port control output circuit and control board
By designing a GPIO port control output circuit for microcontrollers, using power transistors and conduction control modules, a limited time response to GPIO port signals is achieved, and the problem of continuous high or low GPIO port caused by microcontroller failure is solved. It avoids safety hazards caused by the continuous operation of high-power devices.
Patent Information
- Application Number
- CN202411670343.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-02-25
AI Technical Summary
When a microcontroller controls a high-power load device through a GPIO port, if the microcontroller fails, the GPIO port will continue to rise or fall, which may cause the high-power device to work continuously, resulting in power consumption, heat generation and safety accidents.
A single-chip microcomputer GPIO port control output circuit is designed, using a power transistor and a conduction control module, and the switching unit is controlled by the rising conduction unit and the falling conduction unit to realize the limited time conduction of the power transistor and avoid continuous conduction.
It effectively avoids the continuous pulling of the GPIO port due to microcontroller failure, avoids safety hazards caused by the continuous operation of high-power devices, and ensures the safety and stability of the system.
Smart Images

Figure CN119511904A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic chips, and in particular to a single-chip microcomputer GPIO port control output circuit and a control board. Background Art
[0002] A single-chip microcomputer is a microcomputer system that integrates a microprocessor, memory, input / output interface, and other functions on a single chip. Based on functional requirements, single-chip microcomputers are widely used in many fields, such as control functions, data processing functions, communication functions, interaction functions, monitoring and diagnosis functions, etc. Based on functional requirements, the output mode of the GPIO port of the single-chip microcomputer and the type of load driven are also different.
[0003] The design of the GPIO output circuit of the microcontroller depends on the functions it needs to achieve and the requirements of the external circuit. Generally, the GPIO output circuit has direct load drive mode, load drive mode through transistor, load drive mode through driver IC or direct series resistor. Taking the transistor as an example, when the microcontroller drives the load through the transistor, the collector of the transistor is generally connected to the positive pole of the power supply, the emitter of the transistor is connected to the load, and the base of the transistor is connected to the GPIO port. The high and low levels output by the GPIO port control the conduction of the collector and emitter of the transistor, thereby driving the load to work.
[0004] However, although the microcontroller technology is mature, there are still cases of microcontroller failure. When controlling the power supply of high-power load devices through the GPIO port of the microcontroller, if the microcontroller failure causes the GPIO port to be continuously pulled high or low, the high-power devices will continue to work and cause power consumption, heat and other safety accidents. For example, in the control process of the hair dryer, if the microcontroller failure causes the heating circuit to continue heating, it may cause a fire. For example, in the case of a milk warmer or a high-temperature heating soldering station, continuous heating will cause safety accidents. Summary of the invention
[0005] The purpose of the present application is to provide a single-chip microcomputer GPIO port control output circuit and a control board, wherein the circuit can avoid safety hazards caused by single-chip microcomputer abnormalities when the single-chip microcomputer drives high-power load devices or dangerous devices.
[0006] The above application objectives of this application are achieved through the following technical solutions:
[0007] In a first aspect, a single-chip microcomputer GPIO port control output circuit provided in the present application adopts the following technical solution.
[0008] A single-chip microcomputer GPIO port control output circuit, the GPIO port outputs a square wave signal, the circuit comprises: a power transistor and a conduction control module;
[0009] A power transistor, wherein a first end of the power transistor is connected to a positive electrode of a power supply, a second end of the power transistor is connected to a load, and a control end of the power transistor is connected to a negative electrode of a power supply through a conduction control module and connected to a positive electrode of a power supply through a pull-up resistor;
[0010] The conduction control module includes a rising conduction unit, a falling conduction unit and a switch unit;
[0011] The switch unit is connected to the control end of the power transistor and the negative electrode of the power supply, and is used to turn on or off the connection between the control end of the power transistor and the negative electrode of the power supply;
[0012] The rising conduction unit drives the switch unit to conduct for a first preset time in response to a rising edge of the GPIO port;
[0013] The falling conduction unit drives the switch unit to conduct for a second preset time when the first preset time ends.
[0014] In a preferred embodiment, the rising conduction unit includes a first energy storage capacitor and a first discharge resistor, one end of the first energy storage capacitor is connected to the falling conduction unit, and the other end is connected to the GPIO port, and the first discharge resistor is connected to the GPIO port and the negative pole of the power supply.
[0015] In a preferred embodiment, a first unidirectional diode from the first energy storage capacitor to the switch unit is connected between the first energy storage capacitor and the falling conduction unit.
[0016] In a preferred embodiment, the node where the first energy storage capacitor is connected to the first unidirectional diode is connected to the negative electrode of the power supply through a second unidirectional diode, and the direction of the second unidirectional diode is from the negative electrode of the power supply to the first energy storage capacitor.
[0017] In a preferred embodiment, the falling conduction unit includes a second energy storage capacitor and a second discharge resistor, the second energy storage capacitor and the second discharge resistor are connected in parallel, one end of the second energy storage capacitor is connected to the first unidirectional diode and the switch unit, and the other end is connected to the negative electrode of the power supply.
[0018] In a preferred embodiment, the switch unit includes a second transistor, a first end of the second transistor is connected to the control end of the power transistor, a second end of the second transistor is connected to the negative electrode of the power supply, and the control end of the second transistor is connected to the falling conduction unit.
[0019] In a preferred embodiment, the first end of the power transistor is connected to the negative electrode of the power supply through a first filter capacitor.
[0020] In a preferred embodiment, the second end of the power transistor is connected to the negative electrode of the power supply via a second filter capacitor.
[0021] In a second aspect, a control panel provided in the present application adopts the following technical solution.
[0022] A control board is provided with a single chip microcomputer and the control output circuit.
[0023] In summary, this application has the following beneficial effects:
[0024] 1. The GPIO port outputs a square wave signal. At the rising edge of the GPIO port, the rising conduction unit drives the switch unit to turn on for the first preset time in response to the rising edge of the GPIO port, so that the power transistor is turned on, thereby driving the load through the second end of the power transistor. When the first preset time ends, the falling conduction unit drives the switch unit to turn on for the second preset time, so that the power transistor is continuously turned on until the second preset time ends. When the second preset time ends, the switch unit is turned off, and the power transistor is no longer turned on, thereby avoiding the safety hazard caused by the continuous operation of the high-power device when the GPIO port is continuously pulled high.
[0025] 2. When the GPIO port rises, the first energy storage capacitor starts to charge. The first energy storage capacitor starts the charging process and triggers the second transistor to turn on through the first unidirectional diode and charges the second energy storage capacitor. The first preset time is the charging time of the first energy storage capacitor. When the charging of the first energy storage capacitor is completed, the second energy storage capacitor discharges through the discharge resistor. The discharge process of the second energy storage capacitor triggers the second transistor to turn on. The second preset time is the discharge time of the second energy storage capacitor. When the second energy storage capacitor is discharged to the point where it cannot trigger the second transistor to turn on, the second transistor is turned off. Therefore, if the GPIO port is continuously in a pulled-up state, the second transistor and the power transistor cannot be in a turned-on state all the time, thereby avoiding the safety hazard caused by the continuous operation of high-power devices when the GPIO port is continuously pulled up. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a system diagram of the single-chip microcomputer GPIO port control output circuit in an embodiment of the present application.
[0027] Figure 2 It is a circuit diagram of a conduction control module in an embodiment of the present application.
[0028] Explanation of reference numerals: 1. conduction control module; 11. rising conduction unit; 12. falling conduction unit; 13. switch unit; 2. load. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0030] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.
[0031] Reference Figure 1 , the present application provides a single-chip microcomputer GPIO port control output circuit, the output circuit is based on a transistor to drive a load, it should be noted that the transistors described in the present application are not limited to, including but not limited to, field effect transistors, thyristors and triodes. For the purpose of unified description, the present application uniformly names the three pins of the transistor, including a control end, a first end, and a second end. The control end is the trigger end of the transistor, such as the base of a triode, the gate of a field effect transistor, and the control electrode of a thyristor; the first end is the collector of a triode, the anode of a thyristor, or the drain of a field effect transistor, and the second end is the emitter of a triode, the cathode of a thyristor, or the source of a field effect transistor.
[0032] Generally, the GPIO port of the microcontroller is in a high or low state under program control. The GPIO port responds to the high or low level to control the connected transistor to be in an on or off state, thereby controlling the load operation. During a complete working process of the load, the GPIO port is continuously in a high or low state. When the load needs to stop working, the GPIO port is switched to a high or low state. However, when the microcontroller fails, the GPIO port of the microcontroller becomes uncontrollable, the GPIO port is continuously pulled high or low, and there is an abnormal condition in which the load matched by the GPIO port continuously works. The microcontroller GPIO port control output circuit provided in this application is intended to solve this technical problem.
[0033] The single-chip GPIO port control output circuit includes a power transistor Q1 and a conduction control module. It should be particularly noted that the GPIO port output signal of the present application is a square wave signal. The power transistor Q1 is a P-MOSFET tube, which has a low internal resistance, thereby reducing the conduction voltage drop.
[0034] The first end of the power transistor Q1 is connected to the positive electrode of the power supply, the second end of the power transistor Q1 is connected to the load, and the control end of the power transistor Q1 is connected to the negative electrode of the power supply through the conduction control module and connected to the positive electrode of the power supply through the pull-up resistor R1. The conduction control module is connected to the GPIO port, and when the GPIO port outputs a square wave signal, the power transistor Q1 is driven to be in a conducting state. When the GPIO port is continuously pulled up or down, the power transistor Q1 is turned off, thereby avoiding the abnormal situation of the load continuously working due to the GPIO port being continuously pulled up or down.
[0035] The first end of the power transistor Q1 is connected to the negative power supply via the first filter capacitor C1, and the second end of the power transistor Q1 is connected to the negative power supply via the second filter capacitor C2. The first filter capacitor C1 and the second filter capacitor C2 can enhance the stability of the electrical signals at the first and second ends of the power transistor Q1.
[0036] Reference Figure 2 The conduction control module includes a rising conduction unit, a falling conduction unit and a switch unit. The switch unit is connected to the control end of the power transistor and the negative electrode of the power supply, and is used to turn on or off the connection between the control end of the power transistor and the negative electrode of the power supply; the rising conduction unit drives the switch unit to conduct for a first preset time in response to the rising edge of the GPIO port; the falling conduction unit drives the switch unit to conduct for a second preset time at the end of the first preset time.
[0037] The switch unit includes a second transistor Q2, which is an N-channel field effect transistor. The first end of the second transistor Q2 is connected to the control end of the power transistor, and the second end of the second transistor Q2 is connected to the negative electrode of the power supply. When the second transistor Q2 is turned on, the control end of the power transistor Q1 is connected to the negative electrode of the power supply. At this time, the power transistor Q1 is turned on, and the load is connected to the positive electrode of the power supply to obtain electrical energy; when the second transistor Q2 is turned off, the control end of the power transistor Q1 is connected to the positive electrode of the power supply through the pull-up resistor R1 and is in a high-level input state, and the power transistor Q1 cannot be turned on. That is, only when the second transistor Q2 is turned on, the power transistor Q1 can be turned on.
[0038] The rising conduction unit includes a first energy storage capacitor C3 and a first discharge resistor R2. One end of the first energy storage capacitor C3 is connected to the GPIO port, and the other end is connected to the control end of the second transistor Q2 through a first unidirectional diode D1. The direction of the first unidirectional diode D1 is from the first energy storage capacitor C3 to the second transistor Q2. The two ends of the first discharge resistor R2 are respectively connected to the GPIO port and the negative electrode of the power supply. When the GPIO port output signal is at a rising edge, the first energy storage capacitor C3 starts to charge, so that the control end of the second transistor Q2 is in a high-level input state, and the second transistor Q2 is turned on; when the first energy storage capacitor C3 is fully charged, the path between the GPIO port and the control end of the second transistor Q2 is disconnected, the control end of the second transistor Q2 is in a low-level input state, and the second transistor Q2 is turned off. The first preset time is the charging time or part of the charging time of the first energy storage capacitor C3. If the GPIO port level is continuously pulled up, the second transistor Q2 is turned off after the first preset time ends, so that the power transistor Q1 is turned off, and the GPIO port control output circuit no longer supplies power to the load.
[0039] The node where the first energy storage capacitor C3 is connected to the first unidirectional diode D1 is connected to the negative pole of the power supply through the second unidirectional diode D2, and the conduction direction of the second unidirectional diode D2 is: from the negative pole of the power supply to the first energy storage capacitor C3. When the GPIO port output signal is at a falling edge, the first energy storage capacitor C3 starts to discharge through the second unidirectional diode D2 and the first discharge resistor R2.
[0040] The falling conduction unit includes a second energy storage capacitor C4 and a second discharge resistor R3, which are connected in parallel, and one end of the second energy storage capacitor C4 and the second discharge resistor R3 are connected to the first unidirectional diode D1 and the control end of the second transistor Q2, and the other end is connected to the negative electrode of the power supply.
[0041] When the GPIO port output signal is at the rising edge, the first energy storage capacitor C3 and the second energy storage capacitor C4 begin to charge; when the GPIO port output signal is at the falling edge, due to the setting of the first unidirectional diode D1, the path between the first energy storage capacitor C3 and the second transistor Q2 is cut off, and the second energy storage capacitor C4 begins to discharge through the second discharge resistor R3, and triggers the power supply for the control end of the second transistor Q2. During the discharge of the second energy storage capacitor C4, the second transistor Q2 continues to be turned on until the voltage of the second energy storage capacitor C4 is lower than the turn-on trigger voltage of the second transistor Q2, and then the second transistor Q2 is turned off. That is, the second preset time is the discharge time or partial discharge time of the second energy storage capacitor C4.
[0042] The working principle of the present application scheme is as follows: when the GPIO port rises, the first energy storage capacitor C3 starts to charge, and the first energy storage capacitor C3 starts the charging process to trigger the second transistor Q2 to turn on through the first unidirectional diode D1 and charge the second energy storage capacitor C4. The first preset time is the charging time of the first energy storage capacitor C3. When the charging of the first energy storage capacitor C3 is completed, the second energy storage capacitor C4 is discharged through the second discharge resistor R3. The discharge process of the second energy storage capacitor C4 triggers the second transistor Q2 to turn on. The second preset time is the discharge time of the second energy storage capacitor C4. When the second energy storage capacitor C4 is discharged to the point where the second transistor Q2 cannot be triggered to turn on, the second transistor Q2 is turned off. When the GPIO port is continuously pulled down, the second transistor Q2 cannot be triggered to turn on. Therefore, if the GPIO port is continuously in a pulled-up state or a pulled-down state, the second transistor Q2 and the power transistor Q1 cannot be in a turned-on state all the time, thereby avoiding the potential safety hazard caused by the continuous operation of high-power devices when the GPIO port is continuously pulled up.
[0043] In another embodiment, the present application further provides a control board, which is configured with a single-chip microcomputer and the above-mentioned GPIO port control output circuit. It should be noted that the control board described in the present application can be a module composed of circuit boards, or a controller capable of driving a load to work.
[0044] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0045] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A single-chip microcomputer GPIO port control output circuit, characterized in that: The GPIO port outputs a square wave signal, and the circuit includes: a power transistor and a conduction control module; A power transistor, wherein a first end of the power transistor is connected to a positive electrode of a power supply, a second end of the power transistor is connected to a load, and a control end of the power transistor is connected to a negative electrode of a power supply through a conduction control module and connected to a positive electrode of a power supply through a pull-up resistor; The conduction control module includes a rising conduction unit, a falling conduction unit and a switch unit; The switch unit is connected to the control end of the power transistor and the negative electrode of the power supply, and is used to turn on or off the connection between the control end of the power transistor and the negative electrode of the power supply; The rising conduction unit drives the switch unit to conduct for a first preset time in response to a rising edge of the GPIO port; The falling conduction unit drives the switch unit to conduct for a second preset time when the first preset time ends.
2. A single-chip microcomputer GPIO port control output circuit according to claim 1, characterized in that: The rising conduction unit includes a first energy storage capacitor and a first discharge resistor, one end of the first energy storage capacitor is connected to the falling conduction unit, and the other end is connected to the GPIO port, and the first discharge resistor is connected to the GPIO port and the negative pole of the power supply.
3. A single chip microcomputer GPIO port control output circuit according to claim 2, characterized in that: A first unidirectional diode from the first energy storage capacitor to the switch unit is connected between the first energy storage capacitor and the falling conduction unit.
4. A single-chip microcomputer GPIO port control output circuit according to claim 3, characterized in that: The node where the first energy storage capacitor is connected to the first unidirectional diode is connected to the negative electrode of the power supply through the second unidirectional diode, and the direction of the second unidirectional diode is from the negative electrode of the power supply to the first energy storage capacitor.
5. A single chip microcomputer GPIO port control output circuit according to claim 3, characterized in that: The falling conduction unit includes a second energy storage capacitor and a second discharge resistor. The second energy storage capacitor and the second discharge resistor are connected in parallel, and one end of the second energy storage capacitor is connected to the first unidirectional diode and the switch unit, and the other end is connected to the negative electrode of the power supply.
6. A single-chip microcomputer GPIO port control output circuit according to any one of claims 1 to 5, characterized in that: The switch unit comprises a second transistor, a first end of the second transistor is connected to the control end of the power transistor, a second end of the second transistor is connected to the negative electrode of the power supply, and a control end of the second transistor is connected to the falling conduction unit.
7. A single-chip microcomputer GPIO port control output circuit according to claim 1, characterized in that: The first end of the power transistor is connected to the negative electrode of the power supply through a first filter capacitor.
8. A single-chip microcomputer GPIO port control output circuit according to claim 1, characterized in that: The second end of the power transistor is connected to the negative electrode of the power supply through a second filter capacitor.
9. A control panel, characterized in that: The control board is equipped with a single chip microcomputer and the control output circuit according to any one of claims 1-6.