Voltage detection circuit for IO port of single-chip microcomputer of vehicle body controller
By designing a voltage detection circuit for IO port of a single-chip microcontroller with a body controller, the input resistor and input switch are connected in parallel to the in-phase input end of comparator U1, and the diode D1, current limit resistor R9 and pull-up resistor R10 are connected through the output end of comparator U1, and connected to the IO pin of the single-chip microcontroller U2, the problem of resource consumption and difficulty in distinguishing when handling multiple switch input is solved, and efficient and accurate multiple switch input detection is achieved.
Patent Information
- Application Number
- CN202421464390.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2034-06-25
AI Technical Summary
When handling multiple switch inputs, the traditional automotive body controller IO port voltage detection circuit consumes a large amount of microcontroller I/O port resources, making it difficult to distinguish between effective switch input and invalid switch input, complicating the microcontroller program and increasing design costs.
A voltage detection circuit for IO port of a vehicle body controller microcontroller is designed, and connected to the in-phase input end of comparator U1 through a combination of several input resistors and input switches, and is connected to the in-phase input end of comparator U1, diode D1, current limiting resistor R9 and pull-up resistor R10 through the output end of comparator U1, and is connected to the IO pin of microcontroller U2.
It realizes the detection of multiple switch inputs through a single microcontroller port, and can accurately distinguish the effectiveness of different switches, optimizes the resource configuration of microcontroller I/O ports, reduces design complexity and cost, and protects the safety and reliability of the later-stage circuits.
Smart Images

Figure CN222914093U_ABST
Abstract
Description
Technical Field
[0001] The utility model relates to the field of detection circuits, in particular to a voltage detection circuit for the IO port of a single-chip microcomputer of a body controller. Background Technique
[0002] At present, in the voltage detection circuit of the IO port of an automotive body controller, most of them directly detect through the I / O port of a single-chip microcomputer, and each path corresponds to one IO port for detection. Although the input detection and control are solved, it consumes the configuration resources of the I / O port of the single-chip microcomputer. When dozens or hundreds of detection inputs are involved, a large number of IO port resources are required. When some input detection ports share one interface, it is impossible to distinguish between valid switch inputs and invalid switch inputs, complicating the single-chip microcomputer program, narrowing the selection range of the single-chip microcomputer, increasing the peripheral circuit control circuit, and increasing the design cost.
[0003] For the above reasons, for the traditional voltage detection circuit of the IO port of an automotive body controller, if the configuration resources of the I / O port of the single-chip microcomputer are insufficient, only the single-chip microcomputer can be replaced to solve the problem by increasing the PIN pins of the single-chip microcomputer. The more PIN pins the single-chip microcomputer has, the higher the price is. Either increase the peripheral control circuit, add components, and control the circuit through a complex circuit. Therefore, a simple control method is needed to detect multiple switch inputs through one single-chip microcomputer port and be able to distinguish the validity of different switches. Through Figure 1 The input switches S1, S2, S3, and S4 are all connected to U1, and compared with the voltage at one end of U1, so as to output high and low levels as required, reducing the control circuit, lowering the design difficulty, protecting the subsequent circuit, and realizing the control optimization of the traditional multi-stage input port detection circuit. This method can also expand multiple input switches and can combine external control to participate in it to meet the design requirements. Content of the Utility Model
[0004] The purpose of the utility model is to provide a voltage detection circuit for the IO port of a single-chip microcomputer of a body controller to solve the problems put forward in the above background technique.
[0005] To solve the above technical problems, the utility model provides the following technical solution: A voltage detection circuit for the IO port of a single-chip microcomputer (the single-chip microcomputer is the single-chip microcomputer of the body controller) includes a plurality of input resistors, and one end of each input resistor is connected to an input switch;
[0006] The combination of the plurality of input resistors and the input switch is connected in parallel to the voltage-dividing resistors R5 and R7 and connected to the non-inverting input terminal of the comparator U1;
[0007] The inverting input terminal of the comparator U1 is connected to the voltage-dividing resistors R6 and R8;
[0008] The output terminal of comparator U1 is connected to diode D1, current-limiting resistor R9, and pull-up resistor R10, and is connected to the IO pin of microcontroller U2.
[0009] Preferably, the input resistors include R1, R2, R3, and R4, and the input switches include S1, S2, S3, and S4.
[0010] Preferably, the model of comparator U1 is LTC8701.
[0011] Compared with the prior art, the beneficial effects of the present utility model are as follows:
[0012] The present utility model mainly solves the problem of the traditional IO port voltage detection circuit of the automotive body controller, optimizes the I / O port resources of the microcontroller, can accurately distinguish valid signals by configuring switches with different resistance values as required, enriches the selection of microcontrollers, reduces the designed circuit, lowers the cost, isolates the microcontroller, and protects the safety and reliable operation of the subsequent circuit. Description of the Drawings
[0013] Figure 1 It is the circuit schematic diagram of the present utility model. Detailed Embodiments
[0014] Next, the technical solutions in the embodiments of the present utility model will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present utility model. Obviously, the described embodiments are only a part of the embodiments of the present utility model, rather than all the embodiments. Based on the embodiments of the present utility model, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present utility model.
[0015] As shown in the figure, this embodiment provides a voltage detection circuit for the IO port of the microcontroller of the body controller, including input resistors R1, R2, R3, and R4 (used to provide different voltage-dividing resistance values for the switches, and dozens or hundreds of values can be set), input switches S1, S2, S3, and S4 (the input switches S1, S2, S3, and S4 are external selection switches, and dozens or hundreds of them can be added as the input resistance values increase), voltage-dividing resistors R5, R6, R7, and R8, comparator U1, reverse-connection prevention diode D1, current-limiting resistor R9, pull-up resistor R10, and microcontroller U2. It can realize that a single IO port can detect multiple switch signals, and can accurately distinguish valid signals by configuring switches with different resistance values as required.
[0016] The input resistors R1, R2, R3, and R4 are used to provide different voltage division values for the switches. The input switches S1, S2, S3, and S4 are external selection switches. The voltage division resistors R5, R6, R7, and R8 generate the input comparison voltages at both ends of the comparator by dividing the voltage with external resistors. The comparator U1 compares the input voltages at both ends to confirm the level of the output voltage. The diode D1 isolates the crosstalk generated by U1 from entering the microcontroller U2. The current limiting resistor R9 controls the magnitude of the current in the detection circuit. The pull-up resistor R10 provides a definite high-level signal for the detection circuit. The microcontroller U2 detects the level of the input voltage.
[0017] According to Figure 1 the connection method shown, the voltage at pin 4 of the comparator U1 is obtained by dividing the voltage with resistors R6 and R8 and is 4.85V. When the S1 switch is effective, the voltage at pin 3 of the comparator U1 is obtained by dividing the voltage with resistors R1, R5, and R7 and is 4.12V. Since it is less than the voltage at pin 4, the output at pin 1 of the comparator U1 is at a low level. When the S2 switch is effective, the voltage at pin 3 of the comparator U1 is obtained by dividing the voltage with resistors R2, R5, and R7 and is 4.17V. Since it is less than the voltage at pin 4, the output at pin 1 of the comparator U1 is at a low level. When the S3 switch is effective, the voltage at pin 3 of the comparator U1 is obtained by dividing the voltage with resistors R3, R5, and R7 and is 4.86V. Since it is greater than the voltage at pin 4, the output at pin 1 of the comparator U1 is at a high level. When the S4 switch is effective, the voltage at pin 3 of the comparator U1 is obtained by dividing the voltage with resistors R4, R5, and R7 and is 4.91V. Since it is greater than the voltage at pin 4, the output at pin 1 of the comparator U1 is at a high level.
[0018] Through the isolation of the comparator, the safe and reliable operation of the microcontroller is protected. Detecting multiple switch inputs is achieved through one microcontroller port. Also, according to requirements, switches with different resistance values can be configured to accurately distinguish valid signals.
[0019] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A vehicle body controller single chip microcomputer IO port voltage detection circuit, characterized in that: It includes a plurality of input resistors, and a section of each input resistor is connected to an input switch; A combination of several input resistors and input switches is connected in parallel to the voltage divider resistor R5 and the voltage divider resistor R7, and connected to the non-inverting input terminal of the comparator U1; The inverting input terminal of the comparator U1 is connected to the voltage dividing resistor R6 and the voltage dividing resistor R8; The output end of the comparator U1 is connected to a diode D1 , a current limiting resistor R9 , and a pull-up resistor R10 , and is also connected to an IO pin of the microcontroller U2 .
2. The vehicle body controller single chip microcomputer IO port voltage detection circuit according to claim 1, characterized in that: The input resistors include R1, R2, R3 and R4, and the input switches include S1, S2, S3 and S4.
3. The vehicle body controller single chip microcomputer IO port voltage detection circuit according to claim 2, characterized in that: The number of input resistors and input switches is greater than ten.
4. The vehicle body controller single chip microcomputer IO port voltage detection circuit according to claim 3, characterized in that: The model of comparator U1 is LTC8701.