Serial port multiplexing method

By setting up a serial port multiplexing method on the battery microcontroller, using power control circuit, communication conversion circuit and input signal recognition circuit, the problem of waste of MCU resources is solved, and serial port multiplexing of various communication methods is realized, reducing costs.

CN120541017APending Publication Date: 2025-08-26WUXI JIUTONG ELECTRONIC TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510620493.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2025-08-26

AI Technical Summary

Technical Problem

The MCU of the BMS in the shared battery needs to be adapted to multiple communication methods, resulting in wasting UART function port resources.

Method used

By setting up a serial port multiplexing method on the battery microcontroller, the serial port is connected to multiple communication conversion modules, including power supply control circuit, communication conversion circuit and input signal recognition circuit, serial port multiplexing is realized.

Benefits of technology

Only one UART function port can realize multiple channels and multiple communication methods, save MCU resources, reduce MCU performance requirements, and reduce costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120541017A_ABST
    Figure CN120541017A_ABST
Patent Text Reader

Abstract

The invention discloses a serial port multiplexing method, which relates to the technical field of electronic circuits, and comprises a plurality of communication conversion modules connected with a battery microcontroller, and any communication conversion module comprises a power supply control circuit, a communication conversion circuit and an input signal identification circuit which are adaptively connected, the serial port multiplexing method comprises the following steps: taking a communication conversion circuit connected with external equipment in a plurality of communication conversion circuits as a circuit to be subjected to communication conversion; an input signal identification circuit connected with the to-be-communicated conversion circuit generates an input identification signal and transmits the input identification signal to the battery microcontroller; and the battery microcontroller generates a communication enable signal, transmits the communication enable signal to a power supply control circuit connected with the target communication conversion circuit, and controls the power supply control circuit to supply power to the target communication conversion circuit, so that the battery microcontroller communicates with external equipment through the target communication conversion circuit by using a serial port. According to the serial port multiplexing method, serial ports of the microcontroller can be saved, and occupation of serial port resources of the microcontroller is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic circuits, in particular to a serial port multiplexing method. Background Art

[0002] Shared batteries typically use 485 communication in battery swap cabinets, while those used in electric two-wheeled vehicles may use serial communication methods such as single-line communication. To accommodate multiple communication methods, the BMS MCU in shared batteries typically uses multiple UART function ports. However, this approach occupies multiple UART function ports, wasting MCU resources. Summary of the Invention

[0003] In response to the above problems and technical requirements, the applicant has proposed a serial port multiplexing method.

[0004] The technical solutions of the present invention are as follows:

[0005] A serial port multiplexing method,

[0006] The serial port is located on the battery microcontroller, and the serial port is connected to a plurality of communication conversion modules, and any of the communication conversion modules includes a power control circuit, a communication conversion circuit, and an input signal recognition circuit;

[0007] The serial port multiplexing method comprises:

[0008] The communication conversion circuit connected to the external device among the multiple communication conversion circuits is used as the communication conversion circuit to be communicated; the input signal recognition circuit connected to the communication conversion circuit to be communicated generates an input recognition signal and transmits it to the battery microcontroller;

[0009] The battery microcontroller selects a target communication conversion circuit according to an input identification signal, and generates a communication enable signal according to the input identification signal. The communication enable signal is transmitted to a power control circuit connected to the target communication conversion circuit, and controls the power control circuit to supply power to the target communication conversion circuit, so that the battery microcontroller communicates with an external device through the target communication conversion circuit using a serial port, wherein the battery microcontroller acts as a communication slave.

[0010] A further technical solution is that the communication conversion circuits in the multiple communication modules adopt the same or different communication modes.

[0011] A further technical solution is that the power control circuit includes a switch tube Q1, a switch tube Q2, and a resistor R1, and the serial port of the battery microcontroller includes a UART function port;

[0012] The third electrode of the switch tube Q1 is connected to the power supply VCC, the second electrode of the switch tube Q1 is connected to the third electrode of the switch tube Q2 through the resistor R1, the second electrode of the switch tube Q2 is connected to the battery microcontroller for receiving a communication enable signal, and the first electrode of the switch tube Q2 is grounded.

[0013] A further technical solution is that the input signal recognition circuit includes a photocoupler U3 and a resistor R3;

[0014] The primary side light emitting diode of the photoelectric coupler U3 is connected to the communication conversion circuit, the collector of the phototransistor of the photoelectric coupler U3 is connected to the battery microcontroller, and the emitter of the phototransistor of the photoelectric coupler U3 is grounded.

[0015] A further technical solution is that the communication conversion circuit includes a single-line communication conversion circuit; the power control circuit also includes a diode D2a, a diode D2b and a resistor R2a;

[0016] The single-line communication conversion circuit includes a resistor R7, a resistor R8, a resistor R9, a resistor R10, a resistor R11, a resistor R12, a resistor R14, a resistor R15, a resistor R16, a switch tube T1, a switch tube T2, a switch tube T3, a switch tube T4, a diode D1, a diode D2 and a diode D3;

[0017] The anode of the diode D2 is connected to the anode of the light-emitting diode of the photocoupler U3 through the resistor R3. The anode of the diode D2 is also connected to the third electrode of the switch tube T3. The first electrode of the switch tube T3 is connected to the cathode of the light-emitting diode of the photocoupler U3.

[0018] The second electrode of the switch tube T3 is connected to the resistor R14 and one end of the resistor R16, and the other end of the resistor R16 is connected to the first electrode of the switch tube T3;

[0019] The cathode of the diode D2 is connected to the second electrode of the switch tube T4 through the resistor R11, the second electrode of the switch tube T4 is connected to the first electrode of the switch tube T4 through the resistor R12, the first electrode of the switch tube T4 is connected to the cathode of the light-emitting diode of the photocoupler U3, and the third electrode of the switch tube T4 is connected to the cathode of the diode D1.

[0020] A further technical solution is that the anode of the diode D1 is connected to the second electrode of the switch tube T1 through the resistor R10, the second electrode of the switch tube T1 is connected to the first electrode of the switch tube T1 through the resistor R8, the first electrode of the switch tube T1 is connected to the first electrode of the switch tube Q1, the third electrode of the switch tube T1 is grounded through the resistor R9, and the third electrode of the switch tube T1 is connected to the anode of the diode D2a through the resistor R7, and the cathode of the diode D2a is connected to the UART function port;

[0021] The other end of the resistor R14 is connected to the cathode of the diode D3, the anode of the diode D3 is connected to the third electrode of the switch tube T2, the first electrode of the switch tube T2 is connected to the first electrode of the switch tube Q1, the first electrode of the switch tube T2 is connected to the second electrode of the switch tube T2 through the resistor R2a, the second electrode of the switch tube T2 is connected to the anode of the diode D2a through the resistor R15, and the cathode of the diode D2b is connected to the UART function port.

[0022] A further technical solution is that the switch tube T1 and the switch tube T2 are PNP type transistors, and the switch tube T3 and the switch tube T4 are NPN type transistors.

[0023] A further technical solution is that the switch tube Q1 is a PMOS tube, and the switch tube Q2 is an NMOS tube.

[0024] Its further technical solution is that the communication conversion circuit includes a 485 communication conversion circuit; the power control circuit also includes a diode D1a, a diode D1b and a resistor R1a; the 485 communication conversion circuit includes a communication isolation chip U1, the model of the communication isolation chip U1 includes CA-IS3721HS, and the communication isolation chip U1 includes a VDD1 pin, a VIA pin, a VOA pin, a GND1 pin, a VDD2 pin, a VOB pin, a VIB pin, and a GND2 pin;

[0025] The cathodes of the diodes D1a and D1b are connected to the UART function port of the battery microcontroller, and the anode of the diode D1b is connected to the first electrode of the switch tube Q1 through the resistor R1a;

[0026] The first electrode of the switch tube Q1 is connected to the VDD1 pin, the anode of the diode D1a is connected to the VOA pin, the anode of the diode D1b is connected to the VIA pin, the VDD2 pin is connected to the power supply ISO_VCC, and the GND2 pin is connected to the ground potential ISO_GND.

[0027] Its further technical solution is that the 485 communication conversion circuit includes a 485 communication conversion chip U2, a resistor R4, a resistor R5 and a resistor R6, the model of the 485 communication conversion chip U2 includes TP8485E, and the 485 communication conversion chip U3 includes a VCC pin, an A pin, a B pin, a GND pin, an RO pin and a DI pin;

[0028] The A pin is connected to the positive electrode of the light emitting diode of the photocoupler U3 through the resistor R3, and the B pin is connected to the negative electrode of the light emitting diode of the photocoupler U3;

[0029] The resistor R5 is connected between the A pin and the B pin, the resistor R4 is connected between the VCC pin and the A pin, and the resistor R6 is connected between the B pin and the GND pin. The VCC pin is connected to the power supply ISO_VCC, and the GND pin is connected to the ground potential ISO_GND.

[0030] The RO pin is connected to the VIB pin of the communication isolation chip U1, and the DI pin is connected to the VOB pin of the communication isolation chip U1. The beneficial technical effects of the present invention are:

[0031] The present invention provides a serial port multiplexing method, which can realize multi-channel and multi-communication modes of communication with external devices by using only one serial port, namely the UART function port, thereby realizing serial port multiplexing, saving the special function port of the MCU, reducing the occupation of the MCU serial port resources, thereby reducing the requirements for MCU performance and reducing costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is a structural block diagram of an embodiment of a method for implementing serial port multiplexing provided by the present invention.

[0033] Figure 2 This is a circuit diagram of an embodiment of the communication conversion module provided by the present invention.

[0034] Figure 3 The diagram is a circuit schematic diagram of an embodiment of an enabling portion of an enabling power circuit.

[0035] Figure 4 This is a circuit principle diagram of an embodiment of the input signal recognition circuit provided by the present invention.

[0036] Figure 5 This is a circuit schematic diagram of an embodiment of a 485 communication conversion circuit provided by the present invention.

[0037] Figure 6 The diagram is a circuit diagram of an embodiment of a single-line communication conversion circuit provided by the present invention. DETAILED DESCRIPTION

[0038] The specific embodiments of the present invention will be further described below in conjunction with the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the relevant content, rather than to limit the present disclosure.

[0039] The present invention provides a serial port multiplexing method, wherein the serial port is located on a battery microcontroller, and the serial port is connected to multiple communication conversion modules, and any of the communication conversion modules includes a power control circuit, a communication conversion circuit, and an input signal recognition circuit;

[0040] The serial port multiplexing method includes: using a communication conversion circuit connected to an external device among multiple communication conversion circuits as a circuit to be communicated conversion; an input signal identification circuit connected to the circuit to be communicated conversion generates an input identification signal and transmits it to a battery microcontroller; the battery microcontroller selects a target communication conversion circuit according to the input identification signal, and generates a communication enable signal according to the input identification signal, and the communication enable signal is transmitted to a power control circuit connected to the target communication conversion circuit, and controls the power control circuit to supply power to the target communication conversion circuit, so that the battery microcontroller uses the serial port to communicate with the external device through the target communication conversion circuit, wherein the battery microcontroller acts as a communication slave.

[0041] Specifically, in any communication conversion module, the power control circuit is connected to the communication conversion circuit, the communication conversion circuit is connected to the input signal identification circuit, and the power control circuit, the communication conversion circuit and the input signal identification circuit are all connected to the battery microcontroller (MCU). In an embodiment of the present invention, the serial port specifically refers to a UART function port, and the communication conversion circuit is connected to the UART function port of the battery microcontroller. The battery microcontroller specifically refers to the microcontroller in the battery BMS (Battery Management System).

[0042] There may be one or more communication conversion circuits connected to external devices among multiple communication conversion circuits, but only one communication conversion circuit establishes communication with the external device at the same time. That is to say, the present invention can allow multiple communication conversion circuits to be connected to multiple external devices at the same time, but it only requires that multiple communication conversion circuits cannot establish communication with the corresponding external devices at the same time. When the communication conversion circuit is connected to the external device, the input signal identification circuit connected to the communication conversion circuit will generate an input identification signal and transmit it to the battery MCU. The battery MCU can then determine through the input identification signal that one or several of the multiple communication conversion circuits need to communicate, that is, use the input identification signal as a communication request signal. In specific implementation, the input identification signals corresponding to multiple external devices can be sent to the battery MCU at the same time, and the battery MCU can establish communication with the external devices one by one by identifying the input identification signal.

[0043] Specifically, when only one communication conversion circuit among multiple communication conversion circuits is connected to an external device, the battery MCU will use the communication conversion circuit as the target communication conversion circuit, generate a communication enable signal based on the input identification signal to control the power control circuit to supply power to the communication conversion circuit, and communicate with the external device through the communication conversion circuit.

[0044] When multiple communication conversion circuits are connected to external devices, the battery MCU can select a target communication conversion circuit based on the input identification signal and select a communication conversion circuit from the communication conversion circuits as the target communication conversion circuit for communication. In application scenarios where the communication data content is not large and the response timeliness requirement is not high, the battery MCU can also select several communication conversion circuits from the communication conversion circuits to be used as target communication conversion circuits for communication in a time-sharing manner, or all communication conversion circuits to be used as target communication conversion circuits for communication in a time-sharing manner. By using time-sharing multiplexing, an effect similar to that of the battery MCU communicating with multiple external devices simultaneously can be achieved. After determining the target communication conversion circuit based on the input identification signal, the battery MCU outputs a communication enable signal to the corresponding power control circuit, and the corresponding power control circuit supplies power to the target communication conversion circuit so that communication with the external device can be carried out through the target communication conversion circuit. Each communication conversion circuit can have an independent communication protocol and communication rate.

[0045] In the above method, the battery MCU is used as a communication slave. In specific implementation, the battery MCU can also be used as a communication master. When the battery MCU is used as a communication master, the battery MCU actively connects the power supply of one communication conversion circuit among the multiple communication conversion circuits, that is, outputs a communication enable signal to the corresponding power control circuit, uses the power control circuit to power one communication conversion circuit among the multiple communication conversion circuits, and actively sends a communication instruction to query whether the communication device is online, that is, to query whether the communication conversion circuit is connected to an external device. If the communication conversion circuit is connected to an external device, the battery MCU can establish communication with the external device through the communication conversion circuit. The method of sending a communication instruction to query whether the communication device is online is consistent with the existing technology.

[0046] By utilizing the serial port multiplexing method provided by the present invention, when multiple serial ports of various communication modes are used to access the MCU, the communication function can be realized by using only one UART function port of the MCU, thereby effectively saving the serial port resources of the MCU.

[0047] The number of communication conversion modules can be set according to the actual needs of serial port multiplexing. The communication methods adopted by the communication conversion circuits in multiple communication conversion modules can be the same or different. The communication method adopted by the communication conversion circuit can be determined according to the communication method of the external device. The communication method may include 485 communication, single-line communication, CAN communication and other serial communication methods. The external devices include but are not limited to charging cabinets and electric two-wheeled vehicles. In other words, the application field of the present invention is not limited to the communication between shared batteries and charging cabinets and complete vehicles, but can also be used for the communication of energy storage batteries, etc. For example, an energy storage battery is connected to multiple electrical devices at the same time, and the MCU of the energy storage battery can apply the method of the present invention to communicate with these electrical devices one by one. As long as the timeliness requirements for communication are not very high, the method of the present invention can be used. The specific forms of the power control circuit, communication conversion circuit and input signal recognition circuit can refer to the following description.

[0048] In one embodiment of the present invention, the power control circuit includes a switch tube Q1, a switch tube Q2, a diode D1a, a diode D1b, a resistor R1 and a resistor R1a;

[0049] The switch transistors Q1, Q2, and resistor R1 form the enable portion of the power control circuit. In this embodiment, the switch transistor Q1 is a PMOS transistor, and the switch transistor Q2 is an NMOS transistor. For both NMOS and PMOS transistors, the first electrode is the source, the second electrode is the gate, and the third electrode is the drain. The third electrode of the switch transistor Q1 is connected to the power supply VCC. The second electrode of the switch transistor Q1 is connected to the third electrode of the switch transistor Q2 via resistor R1. The second electrode of the switch transistor Q2 is connected to the battery microcontroller for receiving a communication enable signal. The first electrode of the switch transistor Q2 is grounded. The cathodes of the diodes D1a and D1b are connected to the UART function port of the battery microcontroller, and the anode of the diode D1b is connected to the first electrode of the switch transistor Q1 via resistor R1a.

[0050] Specifically, the UART function port of the battery microcontroller includes an MCU_RXD pin for receiving data and an MCU_TXD pin for transmitting data. The cathode of diode D1a is connected to the MCU_RXD pin, and the cathode of diode D1b is connected to the MCU_TXD pin. The anode of diode D1a is connected to the data transmitting terminal of the communication conversion circuit, and the anode of diode D1b is connected to the data receiving terminal of the communication conversion circuit.

[0051] When an external device is connected to a communication conversion module, causing the battery MCU to generate a communication enable signal, the communication enable signal (EN) is loaded onto the gate of switch tube Q2, turning on switch tube Q2 and thereby turning on switch tube Q1. Power supply VCC passes through switch tube Q1 to generate power supply VCC1, which is loaded onto one end of resistor R1a. Resistor R1a acts as a pull-up resistor to pull the data receiving end of the communication conversion circuit to a high level. Power supply VCC1 also provides power to the corresponding communication conversion circuit, enabling the power MCU to communicate with the external device. At this time, since the power supply in other communication conversion modules is not enabled, the data receiving end and data transmitting end of their communication conversion circuits are both at a low level. By utilizing the unidirectional conduction function of the diode, other communication conversion modules that are not enabled will not affect the UART function port of the MCU.

[0052] Furthermore, the structures of all input signal identification circuits in the serial port multiplexing method are the same. Taking a certain input signal identification circuit as an example, the input signal identification circuit includes a photocoupler U3 and a resistor R3; the primary side light emitting diode of the photocoupler U3 is connected to the communication conversion circuit, the collector of the phototransistor of the photocoupler U3 is connected to the battery microcontroller, and the emitter of the phototransistor of the photocoupler U3 is grounded.

[0053] Specifically, resistor R3 is a current-limiting resistor. The resistance value of resistor R3 can be selected according to actual needs. It must enable the normal operation of the input signal recognition circuit without affecting the operation of the connected communication conversion circuit. When the input signal recognition circuit is connected to an external device, the primary-side light-emitting diode of the photocoupler U3 is illuminated, and the secondary-side phototransistor of the photocoupler U3 is turned on, generating a low-level input recognition signal and outputting it to the battery MCU.

[0054] In another embodiment of the present invention, the communication conversion circuit is a 485 communication conversion circuit, such as Figure 5 As shown, the 485 communication conversion circuit includes a communication isolation chip U1, a 485 communication conversion chip U2, a resistor R4, a resistor R5, and a resistor R6. The model of the communication isolation chip U1 includes CA-IS 3721HS. The communication isolation chip U1 includes a VDD1 pin, a VIA pin, a VOA pin, a GND1 pin, a VDD2 pin, a VOB pin, a VIB pin, and a GND2 pin.

[0055] The first electrode of the switch tube Q1 is connected to the VDD1 pin, the VOA pin is connected to the anode of the diode D1a as a data sending end, the VIA pin is connected to the anode of the diode D1b as a data receiving end, the VDD2 pin is connected to the isolated power supply ISO_VCC, and the GND2 pin is connected to the isolated ground potential ISO_GND.

[0056] The model of the 485 communication conversion chip U2 includes TP8485E, and the 485 communication conversion chip U3 includes a VCC pin, an A pin, a B pin, a GND pin, an RO pin and a DI pin; the A pin is connected to the positive pole of the light-emitting diode of the photocoupler U3 through a resistor R3, and the B pin is connected to the negative pole of the light-emitting diode of the photocoupler U3; the resistor R5 is connected between the A pin and the B pin, the resistor R4 is connected between the VCC pin and the A pin, and the resistor R6 is connected between the B pin and the GND pin. The VCC pin is connected to the power supply ISO_VCC, and the GND pin is connected to the ground potential ISO_GND; the RO pin is connected to the VIB pin of the communication isolation chip U1, and the DI pin is connected to the VOB pin of the communication isolation chip U1. The A pin and the B pin are also connected to an external device. When the external device using 485 communication is adapted and connected to the A pin and the B pin, the external device will send a message, and a differential signal will be generated between the A pin and the B pin, thereby lighting up the light-emitting diode of the optocoupler U3, and turning on the secondary-side phototransistor of the optocoupler U3, generating a low-level input identification signal and outputting it to the battery MCU. The battery MCU outputs a communication enable signal, and the power supply VCC generates the power supply VCC1 after passing through the switch tube Q1. The power supply VCC1 is loaded to one end of the resistor R1a, so that the battery MCU can communicate with the external device through the communication conversion circuit.

[0057] In another embodiment of the present invention, the communication conversion circuit may be a single-line communication conversion circuit. The structure and operating principle of the power control circuit are the same as those of the above embodiment. However, for ease of description, the diode D1a, the diode D1b, and the resistor R1a in the power control circuit of the previous embodiment are alternatively represented as a diode D2a, a diode D2b, and a resistor R2a, and the power generated by the power supply VCC after passing through the switch Q1 is represented as power supply VCC2. The single-line communication conversion circuit includes a resistor R7, a resistor R8, a resistor R9, a resistor R10, a resistor R11, a resistor R12, a resistor R13, a resistor R14, a resistor R15, a resistor R16, a switch T1, a switch T2, a switch T3, a switch T4, a diode D1, a diode D2, and a diode D3.

[0058] The anode of the diode D2 is connected to the anode of the light-emitting diode of the photocoupler U3 through the resistor R3. The anode of the diode D2 is also connected to the third electrode of the switch tube T3. The first electrode of the switch tube T3 is connected to the cathode of the light-emitting diode of the photocoupler U3.

[0059] The second electrode of the switch tube T3 is connected to the resistor R14 and one end of the resistor R16, and the other end of the resistor R16 is connected to the first electrode of the switch tube T3;

[0060] The cathode of the diode D2 is connected to the second electrode of the switch tube T4 via a resistor R11. The second electrode of the switch tube T4 is connected to the first electrode of the switch tube T4 via a resistor R12. The first electrode of the switch tube T4 is connected to the cathode of the light-emitting diode of the photocoupler U3. The third electrode of the switch tube T4 is connected to the cathode of the diode D1. The cathode of the diode D2 and the first electrode of the switch tube T3 are also connected to an external device. When an external device using single-line communication is adapted and connected to the cathode of the diode D2 and the first electrode of the switch tube T3, one end of the resistor R3 will be connected to a high-level signal, thereby lighting the light-emitting diode of the photocoupler U3. The secondary-side phototransistor of the photocoupler U3 is turned on, generating a low-level input identification signal and outputting it to the battery MCU. The battery MCU outputs a communication enable signal. The power supply VCC generates the power supply VCC2 after passing through the switch tube Q1. The power supply VCC2 is loaded to one end of the resistor R2a, and single-line communication is performed with the external device through the communication conversion circuit.

[0061] The anode of the diode D1 is connected to the second electrode of the switch tube T1 through the resistor R10, the second electrode of the switch tube T1 is connected to the first electrode of the switch tube T1 through the resistor R8, the first electrode of the switch tube T1 is connected to the first electrode of the switch tube Q1, the third electrode of the switch tube T1 is grounded through the resistor R9, and the third electrode of the switch tube T1 is connected to the anode of the diode D2a through the resistor R7, and the cathode of the diode D2a is connected to the UART function port;

[0062] The other end of the resistor R14 is connected to the cathode of the diode D3, the anode of the diode D3 is connected to the third electrode of the switch tube T2, the first electrode of the switch tube T2 is connected to the first electrode of the switch tube Q1, the first electrode of the switch tube T2 is connected to the second electrode of the switch tube T2 through the resistor R2a, the second electrode of the switch tube T2 is connected to the anode of the diode D2a through the resistor R15, and the cathode of the diode D2b is connected to the UART function port.

[0063] In this embodiment, the switch tube T1 and the switch tube T2 are PNP transistors, and the switch tube T3 and the switch tube T4 are NPN transistors. For the PNP transistor and the NPN transistor, the first electrode is the emitter, the second electrode is the base, and the third electrode is the collector.

[0064] In the description of this specification, reference to the terms "one embodiment", "example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in an appropriate manner in any one or more embodiments or examples. In the description of this application, the meaning of "plurality" is at least two, for example, two, three, etc., unless otherwise clearly and specifically defined.

[0065] Those skilled in the art will appreciate that the above description is merely a preferred embodiment of the present invention and that the present invention is not limited to the above embodiment. Any other improvements and variations that may be directly derived or conceived by those skilled in the art without departing from the spirit and concept of the present invention shall be deemed to be within the scope of protection of the present invention.

Claims

1. A serial port multiplexing method, characterized in that: The serial port is located on the battery microcontroller, and the serial port is connected to a plurality of communication conversion modules, and any of the communication conversion modules includes a power control circuit, a communication conversion circuit, and an input signal recognition circuit; The serial port multiplexing method comprises: The communication conversion circuit connected to the external device among the multiple communication conversion circuits is used as the communication conversion circuit to be communicated; the input signal recognition circuit connected to the communication conversion circuit to be communicated generates an input recognition signal and transmits it to the battery microcontroller; The battery microcontroller selects a target communication conversion circuit according to an input identification signal, and generates a communication enable signal according to the input identification signal. The communication enable signal is transmitted to a power control circuit connected to the target communication conversion circuit, and controls the power control circuit to supply power to the target communication conversion circuit, so that the battery microcontroller communicates with an external device through the target communication conversion circuit using a serial port, wherein the battery microcontroller acts as a communication slave.

2. The serial port multiplexing method according to claim 1, wherein: The communication conversion circuits in the multiple communication modules adopt the same or different communication modes.

3. The serial port multiplexing method according to claim 1, wherein: The power control circuit includes a switch tube Q1, a switch tube Q2, and a resistor R1, and the serial port of the battery microcontroller includes a UART function port; The third electrode of the switch tube Q1 is connected to the power supply VCC, the second electrode of the switch tube Q1 is connected to the third electrode of the switch tube Q2 through the resistor R1, the second electrode of the switch tube Q2 is connected to the battery microcontroller for receiving a communication enable signal, and the first electrode of the switch tube Q2 is grounded.

4. The serial port multiplexing method according to claim 3, wherein: The input signal recognition circuit includes a photocoupler U3 and a resistor R3; The primary side light emitting diode of the photoelectric coupler U3 is connected to the communication conversion circuit, the collector of the phototransistor of the photoelectric coupler U3 is connected to the battery microcontroller, and the emitter of the phototransistor of the photoelectric coupler U3 is grounded.

5. The serial port multiplexing method according to claim 4, wherein: The communication conversion circuit includes a single-line communication conversion circuit; the power control circuit also includes a diode D2a, a diode D2b and a resistor R2a; The single-line communication conversion circuit includes a resistor R7, a resistor R8, a resistor R9, a resistor R10, a resistor R11, a resistor R12, a resistor R14, a resistor R15, a resistor R16, a switch tube T1, a switch tube T2, a switch tube T3, a switch tube T4, a diode D1, a diode D2 and a diode D3; The anode of the diode D2 is connected to the anode of the light-emitting diode of the photocoupler U3 through the resistor R3. The anode of the diode D2 is also connected to the third electrode of the switch tube T3. The first electrode of the switch tube T3 is connected to the cathode of the light-emitting diode of the photocoupler U3. The second electrode of the switch tube T3 is connected to the resistor R14 and one end of the resistor R16, and the other end of the resistor R16 is connected to the first electrode of the switch tube T3; The cathode of the diode D2 is connected to the second electrode of the switch tube T4 through the resistor R11, the second electrode of the switch tube T4 is connected to the first electrode of the switch tube T4 through the resistor R12, the first electrode of the switch tube T4 is connected to the cathode of the light-emitting diode of the photocoupler U3, and the third electrode of the switch tube T4 is connected to the cathode of the diode D1.

6. The serial port multiplexing method according to claim 5, wherein: The anode of the diode D1 is connected to the second electrode of the switch tube T1 through the resistor R10, the second electrode of the switch tube T1 is connected to the first electrode of the switch tube T1 through the resistor R8, the first electrode of the switch tube T1 is connected to the first electrode of the switch tube Q1, the third electrode of the switch tube T1 is grounded through the resistor R9, and the third electrode of the switch tube T1 is connected to the anode of the diode D2a through the resistor R7, and the cathode of the diode D2a is connected to the UART function port; The other end of the resistor R14 is connected to the cathode of the diode D3, the anode of the diode D3 is connected to the third electrode of the switch tube T2, the first electrode of the switch tube T2 is connected to the first electrode of the switch tube Q1, the first electrode of the switch tube T2 is connected to the second electrode of the switch tube T2 through the resistor R2a, the second electrode of the switch tube T2 is connected to the anode of the diode D2a through the resistor R15, and the cathode of the diode D2b is connected to the UART function port.

7. The serial port multiplexing method according to claim 5, wherein: The switch tubes T1 and T2 are PNP transistors, and the switch tubes T3 and T4 are NPN transistors.

8. The serial port multiplexing method according to claim 3, wherein: The switch tube Q1 is a PMOS tube, and the switch tube Q2 is an NMOS tube.

9. The serial port multiplexing method according to claim 4, wherein: The communication conversion circuit includes a 485 communication conversion circuit; the power control circuit also includes a diode D1a, a diode D1b and a resistor R1a; the 485 communication conversion circuit includes a communication isolation chip U1, the model of the communication isolation chip U1 includes CA-IS3721HS, and the communication isolation chip U1 includes a VDD1 pin, a VIA pin, a VOA pin, a GND1 pin, a VDD2 pin, a VOB pin, a VIB pin, and a GND2 pin; The cathodes of the diodes D1a and D1b are connected to the UART function port of the battery microcontroller, and the anode of the diode D1b is connected to the first electrode of the switch tube Q1 through the resistor R1a; The first electrode of the switch tube Q1 is connected to the VDD1 pin, the anode of the diode D1a is connected to the VOA pin, the anode of the diode D1b is connected to the VIA pin, the VDD2 pin is connected to the power supply ISO_VCC, and the GND2 pin is connected to the ground potential ISO_GND.

10. The serial port multiplexing method according to claim 8, wherein: The 485 communication conversion circuit includes a 485 communication conversion chip U2, a resistor R4, a resistor R5, and a resistor R6. The model of the 485 communication conversion chip U2 includes TP8485E. The 485 communication conversion chip U3 includes a VCC pin, an A pin, a B pin, a GND pin, an RO pin, and a DI pin. The A pin is connected to the positive electrode of the light emitting diode of the photocoupler U3 through the resistor R3, and the B pin is connected to the negative electrode of the light emitting diode of the photocoupler U3; The resistor R5 is connected between the A pin and the B pin, the resistor R4 is connected between the VCC pin and the A pin, and the resistor R6 is connected between the B pin and the GND pin. The VCC pin is connected to the power supply ISO_VCC, and the GND pin is connected to the ground potential ISO_GND. The RO pin is connected to the VIB pin of the communication isolation chip U1, and the DI pin is connected to the VOB pin of the communication isolation chip U1.