A stable and reliable single-chip microcomputer system communication method

By adopting a stable and reliable master-slave controller communication method in the home appliance control system, the communication line status is detected in real time and the communication mode is switched, which solves the problem of unstable communication between the display control board and the power board, and improves the reliability and service life of the system.

CN112363421BActive Publication Date: 2026-07-10VATTI CORP LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
VATTI CORP LTD
Filing Date
2020-09-29
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In existing home appliance control systems, the communication between the display control board and the power board is prone to short circuits or disconnections due to high temperatures, water vapor, and other reasons, which affects communication reliability and product lifespan.

Method used

A stable and reliable communication method is adopted between the master controller and the slave controller. The communication line is connected between the first signal sending port and the receiving port. Combined with timer and communication mode adjustment, the status of the communication line is detected in real time and the communication mode is switched to ensure normal communication.

Benefits of technology

It reduced the failure rate, ensured normal system operation, and improved communication stability and product lifespan.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112363421B_ABST
    Figure CN112363421B_ABST
Patent Text Reader

Abstract

The application discloses a stable and reliable single-chip system communication method, which comprises a master controller and a slave controller, and the communication method comprises the following steps: S1, the master controller and the slave controller are powered on, and the master controller and the slave controller are communicated through a first communication line and a second communication line; S2, a third timer starts to accumulate time, and it is judged whether a response signal is received by a first signal receiving port within a preset time of the third timer; if yes, the third timer is cleared, and the master controller processes the response data; if not, the communication mode of the master controller and / or the slave controller is adjusted according to the connection state of the first communication line and / or the second communication line. The application can reduce the failure rate and keep the system normal operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a stable and reliable communication method for a single-chip microcomputer system. Background Technology

[0002] In home appliance control systems, two separate circuit boards are often used to form the control system, such as a display control board and a power supply board. The display control board integrates buttons and display control circuits, while the power supply board integrates load control, power supply circuits, and buzzer circuits. If the power supply board has a large load, the best approach is to place a microcontroller on each of the display control board and the power supply board. The common communication method between the display control board and the power supply board is a four-wire communication method: one TX line, one RX line, one VDD line, and one GND line. This is a very common communication connection method. Red and white ribbon cables are commonly used to connect the two circuit boards. However, the usage scenarios for different home appliances vary. For example, soy milk makers, steam ovens, and rice cookers are generally used in high-temperature environments and are easily exposed to water vapor, which can easily cause short circuits between the wires in the connection between the two circuit boards. Over time, the connection cable may break or have poor contact with the socket, which can affect the communication between the two circuit boards and reduce the product's lifespan. Summary of the Invention

[0003] The present invention aims to at least partially solve one of the problems existing in the existing related technologies. To this end, one objective of the present invention is to propose a stable and reliable communication method for a single-chip microcomputer system, which can reduce the failure rate and keep the system running normally.

[0004] The above objective is achieved through the following technical solution:

[0005] A stable and reliable communication method for a microcontroller system includes a master controller and a slave controller. The master controller is equipped with a first signal transmitting port, a first signal receiving port, a first timer, and a third timer. The slave controller is equipped with a second signal transmitting port, a second signal receiving port, and a second timer. The first signal transmitting port and the second signal receiving port are connected via a first communication line, and the first signal receiving port and the second signal transmitting port are connected via a second communication line. The communication method includes the following steps:

[0006] S1, the master controller and slave controller are powered on, and the master controller and slave controller communicate with each other through the first communication line and the second communication line;

[0007] S2, the third timer starts to accumulate, and it is determined whether the first signal receiving port receives an acknowledgment signal within the preset time of the third timer. If yes, the third timer is cleared and the main controller processes the acknowledgment data; if no, the communication mode of the main controller and / or the slave controller is adjusted according to the connection status of the first communication line and / or the second communication line.

[0008] In some implementations, in step S1, the master controller and the slave controller communicate in full-duplex or half-duplex mode.

[0009] In some implementations, step S2, adjusting the communication mode of the master controller and / or slave controller according to the connectivity status of the first communication line and / or the second communication line, specifically includes:

[0010] S21, the main controller determines whether the first communication line and the second communication line are short-circuited. If so, the main controller changes the communication mode; if not, the open-circuit status of the first communication line and / or the second communication line is confirmed.

[0011] In some implementations, step S2, adjusting the communication mode of the master controller and / or slave controller according to the connectivity status of the first communication line and / or the second communication line, specifically further includes:

[0012] S22, determine whether the first communication line and / or the second communication line is open-circuited. If yes, the main controller and the slave controller switch communication modes; if no, confirm the short-circuit status of the first communication line and / or the second communication line.

[0013] In some implementations, step S21, which involves the main controller determining whether the first communication line and the second communication line are short-circuited, includes:

[0014] Determine whether the first signal receiving port of the main controller receives data sent from the first signal transmitting port. If yes, determine that the first communication line and the second communication line are short-circuited. If no, determine that the first communication line and the second communication line are not short-circuited.

[0015] In some implementations, step S21, where the main controller switches communication modes, includes:

[0016] S211, the master controller switches to single-line communication mode, and the master controller sends a command to the slave controller to switch the slave controller to single-line communication mode.

[0017] S212, determine if the main controller has a need to send data. If yes, proceed to step S213; otherwise, repeat step S212.

[0018] S213, switch the first signal receiving port of the main controller to a high impedance state, and send data through the first signal transmitting port;

[0019] S214, determine whether the first signal transmitting port has finished transmitting data. If yes, proceed to step S215; otherwise, repeat step S214.

[0020] S215, the first signal transmitting port of the main controller is switched to a high impedance state, the first signal receiving port is switched from a high impedance state to a signal receiving function, after receiving data from the second signal receiving port of the controller, it is switched to a high impedance state, and the response signal is sent out through the second signal transmitting port.

[0021] In some implementations, step S22, when it is determined that the first communication line is in an open circuit state, specifically includes the step of the master controller and the slave controller switching communication modes:

[0022] S221, the master controller is converted to analog serial port mode, and a command is sent to the slave controller through the first signal transmission port of the master controller to make the slave controller convert to analog serial port mode. Then the master controller switches to signal receiving mode and the fourth timer set on the slave controller starts counting.

[0023] S222, determine whether the slave controller receives the response signal from the master controller within the preset time of the fourth timer. If yes, switch the master controller to analog serial communication mode and communicate with the slave controller in half-duplex mode through its first signal transmission port. If no, confirm the open circuit status of the second communication line.

[0024] In some implementations, step S22, when it is determined that the second communication line is in an open circuit state, specifically includes the step of the master controller and the slave controller switching communication modes as follows:

[0025] S223, the first timer is set to start counting down when the main controller is powered on;

[0026] Determine if the countdown of the first timer is 0. If yes, proceed to step S224; otherwise, repeat step S223.

[0027] S224, the main controller is converted to analog serial port mode, and a command is sent to the slave controller through the first signal receiving port of the main controller to make the slave controller convert to analog serial port mode. Then the main controller switches to signal receiving mode and the fifth timer set on the main controller starts counting.

[0028] S225: Determine whether the slave controller receives an acknowledgment signal from the master controller within the preset time of the fifth timer. If yes, the master controller maintains the analog serial port mode and communicates with the slave controller in half-duplex mode. If no, a communication error is indicated.

[0029] Compared with the prior art, the present invention has at least the following beneficial effects:

[0030] 1. The present invention provides a stable and reliable communication method for a single-chip microcomputer system, which can reduce the failure rate and keep the system running normally. Attached Figure Description

[0031] Figure 1 This is a schematic diagram of the microcontroller system in an embodiment of the present invention;

[0032] Figure 2 This is a control flowchart of the communication method in an embodiment of the present invention;

[0033] Figure 3 This is a flowchart illustrating the communication method in an embodiment of the present invention;

[0034] Figure 4 This is a circuit diagram of the MCMC96F8316 MCU in an embodiment of the present invention;

[0035] Figure 5 This is the basic timing diagram used for simulating serial communication in the embodiments of the present invention. Detailed Implementation

[0036] The following embodiments illustrate the present invention, but the present invention is not limited to these embodiments. Modifications to the specific embodiments of the present invention or equivalent substitutions for some technical features, without departing from the spirit of the present invention, should all be covered within the scope of the technical solutions claimed in the present invention.

[0037] Example 1: As Figure 1 , Figure 2 and Figure 3 As shown, this embodiment provides a stable and reliable communication method for a microcontroller system, including a master controller 1 and a slave controller 2. The master controller 1 is equipped with a first signal transmitting port 101, a first signal receiving port 102, a first timer, and a third timer. The slave controller 2 is equipped with a second signal transmitting port 201, a second signal receiving port 202, and a second timer. The first signal transmitting port 101 and the second signal receiving port 202 are connected by a first communication line 3, and the first signal receiving port 102 and the second signal transmitting port 201 are connected by a second communication line 4. In this embodiment, the master controller 1 is generally a master circuit board, and the slave controller 2 is generally a slave circuit board. The communication method includes the following steps:

[0038] S1, the master controller 1 and the slave controller 2 are powered on, and the master controller 1 and the slave controller 2 communicate with each other through the first communication line 3 and the second communication line 4. Specifically, the master controller 1 is powered on, sets the first timer time T1 and starts counting down, and the slave controller 2 is powered on, sets the second timer time T2 and starts counting down. Preferably, the master controller 1 is powered on, sets the first timer time T1 = DT1 seconds (DT1 is a constant) and starts counting down, and the slave controller 2 is powered on, sets the second timer time T2 = DT2 seconds (DT2 is a constant) and starts counting down. Furthermore, the master controller 1 and the slave controller 2 communicate with each other in full-duplex mode or half-duplex mode.

[0039] S2, the third timer starts to accumulate, and it is determined whether the first signal receiving port 102 receives an acknowledgment signal within the preset time of the third timer. If yes, the third timer is cleared and the main controller 1 processes the acknowledgment data; if no, the communication mode of the main controller 1 and / or the slave controller 2 is adjusted according to the connection status of the first communication line 3 and / or the second communication line 4.

[0040] This embodiment provides a stable and reliable communication method for a single-chip microcomputer system, which can reduce the failure rate and keep the system running normally.

[0041] Specifically, the communication method provided in this embodiment continuously checks whether the communication line is normal during system operation. If an abnormality is found, it will check and distinguish the abnormal situation one by one and switch to an appropriate communication method to maintain normal system operation and reduce the failure rate.

[0042] In this embodiment, half-duplex allows data to be transmitted in both directions, but at any given time, only data can be transmitted in one direction. It is essentially a type of simplex communication with switching directions. Only one party can receive or send information at any given time, enabling bidirectional communication. Example: Walkie-talkie.

[0043] Full duplex refers to a transmission method in which both parties can send and receive data simultaneously when the data transmission and reception are separated and transmitted through two different transmission lines.

[0044] Example 2: Figure 1 , Figure 2 and Figure 3 As shown, this embodiment provides a stable and reliable communication method for a microcontroller system. The difference between this method and the stable and reliable communication method for a microcontroller system provided in Embodiment 1 is that, in step S2, adjusting the communication mode of the master controller 1 and / or slave controller 2 according to the connection status of the first communication line 3 and / or the second communication line 4 specifically includes:

[0045] S21, the main controller 1 determines whether the first communication line 3 and the second communication line 4 are short-circuited. If so, the main controller 1 changes the communication mode; if not, it confirms the open-circuit status of the first communication line 3 and / or the second communication line 4.

[0046] Furthermore, step S21, which involves the main controller 1 determining whether the first communication line 3 and the second communication line 4 are short-circuited, includes:

[0047] Determine whether the first signal receiving port 102 of the main controller 1 receives data sent from the first signal transmitting port 101. If yes, determine that the first communication line 3 and the second communication line 4 are short-circuited. If no, determine that the first communication line 3 and the second communication line 4 are not short-circuited.

[0048] The above steps can further reduce the failure rate and keep the system running normally.

[0049] Example 3: Figure 1 , Figure 2 and Figure 3 As shown, this embodiment provides a stable and reliable communication method for a microcontroller system. The difference between this method and the stable and reliable communication method for a microcontroller system provided in Embodiment 2 is that, in step S2, adjusting the communication mode of the master controller 1 and / or slave controller 2 according to the connection status of the first communication line 3 and / or the second communication line 4 specifically further includes:

[0050] S22, determine whether the first communication line 3 and / or the second communication line 4 are open circuits. If yes, the main controller 1 and the slave controller 2 switch communication modes. If no, confirm the short circuit status of the first communication line 3 and / or the second communication line 4.

[0051] The above steps are designed reasonably and cleverly, which helps to determine whether the first communication line 3 and the second communication line 4 are short-circuited.

[0052] Furthermore, the above steps can further reduce the failure rate and keep the system running normally.

[0053] Example 4: Figure 1 , Figure 2 and Figure 3 As shown, this embodiment provides a stable and reliable communication method for a microcontroller system. The difference between this method and the stable and reliable communication method for a microcontroller system provided in Embodiment 3 is that the step of the main controller 1 changing the communication mode in step S21 includes:

[0054] S211, the master controller 1 switches to single-line communication mode, and the master controller 1 sends a command to the slave controller 2 to switch the slave controller 2 to single-line communication mode;

[0055] S212, determine whether the main controller 1 has a need to send data. If yes, proceed to step S213; otherwise, repeat step S212.

[0056] S213, switch the first signal receiving port 102 of the main controller 1 to a high impedance state, and send data through the first signal transmitting port 101;

[0057] S214, determine whether the first signal transmission port 101 has finished transmitting data. If yes, proceed to step S215; otherwise, repeat step S214.

[0058] S215, the first signal transmitting port 101 of the main controller 1 is switched to a high impedance state, the first signal receiving port 102 is switched from a high impedance state to a signal receiving function, after receiving data from the second signal receiving port 202 of the controller 2, it is switched to a high impedance state, and the response signal is sent out through the second signal transmitting port 201.

[0059] In this embodiment, high impedance is a common term in digital circuits, referring to an output state of a circuit that is neither high nor low. If a high impedance state is input to the next stage circuit, it has no effect on the next stage circuit, as if it is not connected. If measured with a multimeter, it may be a high level or a low level, depending on what is connected to it.

[0060] The above steps can further reduce the failure rate and keep the system running normally.

[0061] Example 5: Figure 1 and Figure 2 As shown, this embodiment provides a stable and reliable communication method for a microcontroller system. The difference between this method and the stable and reliable communication method for a microcontroller system provided in Embodiment 4 is that, in step S22, when it is determined that the first communication line 3 is in an open circuit state, the step of switching the communication mode between the master controller 1 and the slave controller 2 specifically includes:

[0062] S221, switch the master controller 1 to analog serial port mode, and send a command to the slave controller 2 through the first signal transmission port 101 of the master controller 1 to make the slave controller 2 switch to analog serial port mode. Then the master controller 1 switches to signal receiving mode and the fourth timer T4 set on the slave controller 2 starts timing.

[0063] S222, determine whether the slave controller 2 receives the response signal from the master controller 1 within the preset time of the fourth timer. If yes, the fourth timer T4 is cleared, and the master controller 1 is switched to analog serial communication mode to communicate with the slave controller 2 in half-duplex mode through its first signal transmission port 101. If no, the open circuit status of the second communication line 4 is confirmed.

[0064] The above steps can further reduce the failure rate and keep the system running normally.

[0065] In this embodiment, the basic timing sequence used for simulated serial communication is shown in the attached figure. Figure 5 As shown:

[0066] Point A (start bit) is at a high potential, meaning the TXD pin is in state 1. At point B, the potential is pulled low, and the TXD state becomes 0. After a delay, the signal reaches point C, which is when "Start Bit" is sent. After point C, data is sent according to the rule of "send the least significant bit first, then the most significant bit," with each bit spaced apart by a certain time t. When the signal reaches point D, all 8 bits of data have been sent. Then, TXD is pulled high, and after a delay, this is equivalent to sending "Stop Bit."

[0067] The interval t between each bit is related to the baud rate, t = 1 / Baud, where Baud means bit / s, so 1 / Baud refers to the time taken to take 1 bit.

[0068] Example 6: Figure 1 and Figure 2 As shown, this embodiment provides a stable and reliable communication method for a microcontroller system. The difference between this method and the stable and reliable communication method for a microcontroller system provided in Embodiment 5 is that, in step S22, when it is determined that the second communication line 4 is in an open circuit state, the step of switching the communication mode between the master controller 1 and the slave controller 2 specifically includes:

[0069] S223, the first timer is set to start counting down when the main controller 1 is powered on;

[0070] Determine if the countdown of the first timer is 0. If yes, proceed to step S224; otherwise, repeat step S223.

[0071] S224, switch the main controller 1 to analog serial port mode, and send a command to the slave controller 2 through the first signal receiving port 102 of the main controller 1 to make the slave controller 2 switch to analog serial port mode. Then the main controller 1 switches to signal receiving mode, and the fifth timer T5 set on the main controller 1 starts timing.

[0072] S225: Determine whether the slave controller 2 receives an acknowledgment signal from the master controller 1 within the preset time of the fifth timer. If yes, the fifth timer T5 is cleared, and the master controller 1 maintains the analog serial port mode to communicate with the slave controller 2 in half-duplex mode. If no, a communication error is indicated.

[0073] The above steps can further reduce the failure rate and keep the system running normally.

[0074] like Figures 1 to 4 As shown, the following is a description of the implementation scheme of the communication method provided in this embodiment using an MCU of model MCMC96F8316:

[0075] This involves setting the MCMC96F8316 MCU to a high-impedance state and enabling the RX and TX functions in the relevant registers.

[0076] To set Pin8 to input mode (high impedance), execute the following commands: INT9E = 0; P31IO = 0.

[0077] To set Pin9 to input mode (high impedance), execute the following commands: P3FSR0 = 0; P30IO = 0.

[0078] To enable the Rx function on pin 8, execute the following commands: INT9E = 1; P31IO = 0;

[0079] To enable the Tx function on pin9, execute the following commands: P3FSR0 = 1; P30IO = 1;

[0080] Step 1: Power on the host MCU, set timer T1 to 10 seconds and start counting down. Power on the slave MCU, set timer T2 to 10 seconds and start counting down.

[0081] Step 2: The T5 timer starts accumulating. The host MCU and slave MCU enable the chip-integrated serial port function and communicate using the first and second communication lines in full-duplex or half-duplex mode. When the host MCU's host RX port receives an acknowledgment signal, the T5 timer is reset to zero. If no acknowledgment signal is received until T5>=2 seconds, proceed to the next step.

[0082] Step 3: The master MCU uses its own pin 8 to determine if there is a short circuit between the first and second communication lines. The master MCU sends data to the slave MCU. If the data received by the master MCU's pin 8 is the same data sent from its own pin 9, then the first and second communication lines are considered short-circuited. If no data is received, proceed to the next step. At this point, the master MCU communication system is switched to single-wire communication mode. The master MCU then sends a command to the slave MCU to also enter single-wire communication mode. Upon entering single-wire communication mode, the master MCU's pin 8 switches to a high-impedance state, and the slave MCU's pin 9 switches to a high-impedance state. The master MCU sends data through pin 9. After sending the data, the master MCU's pin 9 switches to a high-impedance state, and its pin 8 switches to RX function. When the slave MCU receives data, its pin 8 switches to a high-impedance state, and its pin 9 switches to TX function. The response data is sent through the slave MCU's pin 9.

[0083] Step 4: Determine if the first communication line is open. The host MCU switches to analog serial port mode and sends a signal from pin 9 to instruct the slave MCU to switch to analog serial port mode. The host MCU immediately switches to signal receiving mode and uses timer T3 to time the response. If a response signal is received when T3 < 2 seconds, the line is normal. If T3 >= 2 seconds, an error occurs, proceed to the next step. When the first communication line is normal, the host MCU and slave MCU communicate simultaneously in half-full-duplex mode in analog serial port mode.

[0084] Step 5: Determine if the second communication line is open. When timer T1 counts down to 0, the host MCU switches to analog serial port mode and sends a signal from pin 8 to instruct the slave MCU to switch to analog serial port mode. It then immediately switches to receive mode and uses timer T4. If a response signal is received after T4 < 2 seconds, the line is considered normal. If T4 >= 2 seconds, a communication error is reported. When the slave MCU waits for timer T2 to count down to 0, it switches to analog serial port mode and responds if it receives a signal from the host.

[0085] The above descriptions are merely some embodiments of the present invention. Those skilled in the art can make various modifications and improvements without departing from the inventive concept of the present invention, and these all fall within the scope of protection of the present invention.

Claims

1. A stable and reliable communication method for a single-chip microcomputer system, comprising a master controller (1) and a slave controller (2), wherein the master controller (1) is provided with a first signal transmitting port (101), a first signal receiving port (102), a first timer and a third timer, and the slave controller (2) is provided with a second signal transmitting port (201), a second signal receiving port (202) and a second timer, wherein the first signal transmitting port (101) and the second signal receiving port (202) are connected by a first communication line (3), and the first signal receiving port (102) and the second signal transmitting port (201) are connected by a second communication line (4), characterized in that, The communication method includes the following steps: S1, the master controller (1) and slave controller (2) are powered on, and the master controller (1) and slave controller (2) communicate with each other through the first communication line (3) and the second communication line (4); S2, the third timer starts to accumulate time, and it is determined whether the first signal receiving port (102) receives an acknowledgment signal within the preset time of the third timer. If yes, the third timer is cleared and the main controller (1) processes the acknowledgment data; if no, the communication mode of the main controller (1) and / or the slave controller (2) is adjusted according to the connection status of the first communication line (3) and / or the second communication line (4). In step S2, adjusting the communication mode of the master controller (1) and / or slave controller (2) according to the connection status of the first communication line (3) and / or the second communication line (4) specifically includes: S21, the master controller (1) determines whether the first communication line (3) and the second communication line (4) are short-circuited. If so, the master controller (1) changes the communication mode; if not, the open-circuit status of the first communication line (3) and / or the second communication line (4) is confirmed. Alternatively, in step S2, adjusting the communication mode of the master controller (1) and / or slave controller (2) according to the connection status of the first communication line (3) and / or the second communication line (4) specifically includes: S22, determining whether the first communication line (3) and / or the second communication line (4) are open-circuited. If so, the master controller (1) and the slave controller (2) change the communication mode; if not, the short-circuit status of the first communication line (3) and / or the second communication line (4) is confirmed. In step S21, the step of the main controller (1) changing the communication mode includes: S211, the master controller (1) switches to single-line communication mode, and the master controller (1) sends a command to the slave controller (2) to switch the slave controller (2) to single-line communication mode; S212, determine whether the main controller (1) has a need to send data. If yes, proceed to step S213; otherwise, repeat step S212. S213, switch the first signal receiving port (102) of the main controller (1) to a high impedance state, and send data through the first signal transmitting port (101); S214, determine whether the first signal transmitting port (101) has finished transmitting data. If yes, proceed to step S215; otherwise, repeat step S214. S215, the first signal transmitting port (101) of the main controller (1) is switched to a high impedance state, the first signal receiving port (102) is switched from a high impedance state to a signal receiving function, and after receiving data from the second signal receiving port (202) of the controller (2), it is switched to a high impedance state, and the response signal is sent through the second signal transmitting port (201). The step S21, which involves the main controller (1) determining whether the first communication line (3) and the second communication line (4) are short-circuited, includes: determining whether the first signal receiving port (102) of the main controller (1) receives data sent from the first signal sending port (101). If yes, the first communication line (3) and the second communication line (4) are short-circuited; otherwise, the first communication line (3) and the second communication line (4) are not short-circuited.

2. The stable and reliable communication method for a single-chip microcomputer system according to claim 1, characterized in that, In step S1, the master controller (1) and the slave controller (2) communicate with each other in full-duplex mode or half-duplex mode.

3. The stable and reliable communication method for a single-chip microcomputer system according to claim 1, characterized in that, In step S22, when it is determined that the first communication line (3) is in an open circuit state, the step of the main controller (1) and the slave controller (2) switching communication modes specifically includes: S221, the main controller (1) is converted to analog serial port mode, and a command is sent to the slave controller (2) through the first signal sending port (101) of the main controller (1) to make the slave controller (2) switch to analog serial port mode. Then the main controller (1) switches to signal receiving mode and the fourth timer set on the slave controller (2) starts counting. S222, determine whether the slave controller (2) receives the response signal from the master controller (1) within the preset time of the fourth timer. If yes, switch the master controller (1) to the analog serial communication mode and communicate with the slave controller (2) in half-duplex mode through its first signal sending port (101). If no, confirm the open circuit status of the second communication line (4).

4. A stable and reliable communication method for a single-chip microcomputer system according to claim 1 or 3, characterized in that, In step S22, when it is determined that the second communication line (4) is in an open circuit state, the step of the main controller (1) and the slave controller (2) switching communication modes specifically includes: S223, the main controller (1) is powered on and the first timer is set to start counting down; determine whether the countdown of the first timer is 0. If yes, proceed to step S224; otherwise, repeat step S223. S224, the main controller (1) is converted to analog serial port mode, and a command is sent to the slave controller (2) through the first signal receiving port (102) of the main controller (1) to make the slave controller (2) convert to analog serial port mode. Then the main controller (1) switches to signal receiving mode and the fifth timer set on the main controller (1) starts counting. S225, determine whether the slave controller (2) receives the response signal from the master controller (1) within the preset time of the fifth timer. If yes, the master controller (1) maintains the analog serial port mode and communicates with the slave controller (2) in half-duplex mode. If no, a communication error is prompted.