Program monitoring method and system for mcu, home appliance and storage medium

CN115248740BActive Publication Date: 2026-09-08ZHEJIANG SUPOR ELECTRICAL APPLIANCES MFG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210331573.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-30
Publication Date
2026-09-08
Estimated Expiration
2042-03-30

AI Technical Summary

Technical Problem

[0004]在现有技术中,只能保护程序完全跑飞的情况,而无法保护部分程序异常的情况

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115248740B_ABST
    Figure CN115248740B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a program monitoring method and system for a microcontroller, a household appliance and a storage medium. The method comprises: initializing one or more counting variables to zero, in the case that the number of counting variables is multiple, the multiple counting variables correspond to N program modules executed in series in the MCU one by one, in the case that the number of counting variables is one, the counting variable corresponds to the N program modules, and the N program modules belong to a specific function program running on the MCU; for the i-th program module, the corresponding counting variable is added by one each time the program module is executed; an interrupt program is triggered at a predetermined time; whether the value of the one or more counting variables meets a preset requirement is detected by using the interrupt program; if yes, it is determined that the N program modules run normally and the one or more counting variables are cleared, otherwise, it is determined that the N program modules do not run normally and the one or more counting variables are cleared. Whether the multiple program modules run normally can be monitored.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of microcontroller technology, and more specifically, to a method and system for monitoring programs in a microcontroller, a household appliance, and a storage medium. Background Technology

[0002] In microcomputer systems composed of microcontrollers, the operation of the microcontroller is often affected by interference from external electromagnetic fields, causing data corruption in various registers and memory. This can lead to errors such as program pointer errors, being out of the program area, or fetching incorrect program instructions, potentially resulting in an infinite loop. The normal operation of the program is interrupted, and the system controlled by the microcontroller cannot continue to function normally, causing the entire system to stagnate and leading to unpredictable consequences. Currently, to prevent software crashes and infinite loops in microcontrollers and microcomputer systems composed of microcontrollers, a watchdog timer is often installed in the microcontroller to reset the microcontroller in the event of software crashes or infinite loops.

[0003] Currently, many home appliances (such as some cooking appliances) use microcontrollers (MCUs) to ensure that the watchdog timer is cleared in each program cycle by placing it at the top or bottom of the program's main loop. This ensures that the watchdog timer is cleared while the program is running normally.

[0004] Current technology can only protect against complete program malfunctions, not partial program errors. If a part of the program (such as a critical protection program) malfunctions, it can easily lead to electrical malfunctions (or even fires). For example, in the MCU on the heating chip of a cooking appliance, a logic error or an abnormality in individual variables could cause the critical protection program related to heating control to fail, meaning the critical program cannot run. This could lead to the cooking appliance burning out or even causing a fire. Summary of the Invention

[0005] In order to at least partially solve the problems existing in the prior art, a program monitoring method and system for MCUs, home appliances and storage media are provided.

[0006] According to one aspect of the present invention, a program monitoring method for an MCU is provided, comprising: initializing one or more counter variables to zero, wherein, when the number of counter variables is multiple, the multiple counter variables correspond one-to-one with N program modules executed in series in the MCU, and when the number of counter variables is one, the counter variable corresponds to N program modules, where N is a positive integer greater than 1, and the N program modules belong to specific function programs running on the MCU; for the i-th program module among the N program modules, whenever an identifier submodule in the program module is executed, the corresponding counter variable is incremented by one, where i = 1, 2, 3, ..., N; triggering an interrupt program at a predetermined time; using the interrupt program to detect whether the value of one or more counter variables meets a preset requirement; if the value of one or more counter variables meets the preset requirement, then determining that the N program modules are running normally and clearing one or more counter variables to zero, otherwise determining that the N program modules are not running normally and clearing one or more counter variables to zero.

[0007] Based on the above monitoring method, it is possible to monitor whether multiple program modules belonging to the same specific function program running on the MCU are running normally. If any one or more program modules are not running normally, the interrupt program can detect this abnormality in time through the value of the counter variable, thereby reducing the risk caused by the abnormal operation of the program module.

[0008] For example, after using an interrupt routine to detect whether the values ​​of one or more counter variables meet preset requirements, the method further includes: if it is determined that N program modules are not operating properly, then outputting a first alarm message and / or recording the first operating information of the N program modules; if it is determined that any specific program module among the N program modules is not operating properly, then outputting a second alarm message related to the specific program module and / or recording the second operating information of the specific program module.

[0009] Through the above embodiments, when a program module malfunctions, alarms can be triggered for all program modules or for the specific program module that malfunctions, or corresponding operating information can be recorded to promptly remind users to perform repairs or replacements, or to facilitate later verification.

[0010] For example, the first operating information includes the variable values ​​of state variables related to the working state of a specific function program at the current moment. After using an interrupt program to detect whether the values ​​of one or more counter variables meet preset requirements, the method further includes: if it is determined that N program modules are not operating normally, then clearing the remaining variables involved in the specific function program other than the state variables and / or clearing the hardware registers in the MCU.

[0011] By recording the above status, the operating status of a specific function program when an anomaly occurs can be recorded, facilitating subsequent verification or resuming work. Furthermore, clearing various variables and / or hardware registers allows for timely formatting of the specific function program or the MCU's operating status, preventing the anomaly from recurring and causing adverse or even serious consequences.

[0012] For example, after determining that N program modules are not functioning properly, the method further includes: re-running the specific function program and assigning the previously recorded variable values ​​to the state variables of the specific function program.

[0013] By using the above reset method, the previous variable values ​​can be reused after the MCU restarts, continuing the previous operating state. This solution has a state memory function, which is user-friendly and can effectively improve the user experience.

[0014] For example, the MCU is an MCU on a touch chip used to implement button touch interaction functions, and the state variables are the reference values ​​of each button.

[0015] This solution allows electronic devices with button-touch interaction to detect buttons according to the user's previous working habits after a reset, resulting in a better user experience.

[0016] For example, the number of counter variables is one. For the i-th program module among N program modules, whenever the program module is executed, the corresponding counter variable is incremented by one, including: for the i-th program module among N program modules, whenever the program module is executed, if a preset condition is met, the counter variable M is incremented by one, where the preset condition is that M modulo N equals i-1, or the preset condition is that M equals i-1; wherein the preset requirement is that the counter variable M is greater than or equal to N.

[0017] In this embodiment, a single counter variable M is used to accumulate and record the execution status of the program module. This approach requires fewer counter variables, resulting in less data and higher detection efficiency.

[0018] For example, the method further includes: if the count variable M is equal to j, then the (j+1)th program module is determined to be malfunctioning, where j = 0, 1, 2, ..., N–1.

[0019] The above embodiments not only identify program modules that malfunction, but also pinpoint which module is causing the malfunction. This facilitates subsequent inspection to determine the cause of the malfunction and allows for timely repair or replacement of the appliance.

[0020] For example, there are multiple count variables, and the preset requirement is that the difference between the maximum and minimum values ​​among the multiple count variables is not greater than a preset threshold and the minimum value is not zero.

[0021] In this embodiment, each program module has its own corresponding counting variable, which makes it easier to know the running status of each program module later.

[0022] For example, the method further includes: for the case where N program modules are not running properly, determining the program module corresponding to the count variable whose difference from the maximum value is greater than a preset threshold among multiple count variables is not running properly.

[0023] The above embodiments not only identify program modules that malfunction, but also pinpoint which module is causing the malfunction. This facilitates subsequent inspection to determine the cause of the malfunction and allows for timely repair or replacement of the appliance.

[0024] For example, the time interval between two triggers of the interrupt routine is not less than the time required for all N program modules to execute once.

[0025] This trigger interval setting helps ensure that each of the N program modules is executed at least once, thereby helping to ensure the accuracy of program execution detection.

[0026] For example, the interrupt routine is triggered at a timer, and the time interval between the interrupt routine triggering is in the range of 100us to 2s.

[0027] This solution can meet the safety needs of most household appliances and achieve a good balance between safety and workload.

[0028] For example, any program module among the N program modules includes an identifier submodule and one or more branch submodules. When each of the one or more branch submodules is running, the identifier submodule is also running. For the i-th program module among the N program modules, incrementing the corresponding count variable by one each time the program module is executed includes: for the i-th program module among the N program modules, incrementing the corresponding count variable by one each time the identifier submodule in the program module is executed.

[0029] As a core submodule within the program module, the identifier submodule associates the accumulation of the counter variable with the identifier submodule, which helps ensure that the accumulation of the counter variable can be effectively triggered when the program module is executed.

[0030] For example, the MCU is an MCU on a touch chip used to implement button touch interaction functions, and the N program modules include a communication program module, a button detection program module, and a valid button recognition program module.

[0031] Incorporating the above key programs of the touch MCU into the monitoring helps meet the monitoring requirements of most electronic devices, thus adapting to a wider range of application scenarios.

[0032] For example, the MCU is the MCU on the main control chip of the cooking appliance, and the N program modules include one or more of the following: cooking programs for each stage, temperature limit protection programs, and communication programs.

[0033] Incorporating the above key programs of the main MCU of cooking appliances into monitoring helps to detect abnormalities in the main MCU in a timely manner and avoid various safety hazards.

[0034] According to another aspect of the present invention, a program monitoring system is also provided, comprising a processor and a memory, wherein the memory stores computer program instructions, which are executed by the processor to perform the above-described program monitoring method for an MCU.

[0035] According to the program monitoring system of the present invention, it can monitor whether multiple program modules belonging to the same specific function program running on the MCU are running normally. If any one or more program modules are not running normally, the interrupt program can detect this abnormality in time by using the value of the counter variable, thereby reducing the risk caused by the abnormal operation of the program modules.

[0036] According to another aspect of the present invention, a household appliance is also provided, including the above-described program monitoring system and MCU.

[0037] Home appliances include the aforementioned program monitoring system, which can monitor whether multiple program modules belonging to the same specific function program running on the MCU are operating normally. If any one or more program modules are not operating normally, the interrupt program can detect this abnormality in a timely manner through the value of the counter variable, thereby reducing the risk caused by the abnormal operation of the program module.

[0038] According to another aspect of the present invention, a storage medium is also provided, on which program instructions are stored, which, when executed, are used to perform the above-described program monitoring method for an MCU.

[0039] When the program instructions stored in the storage medium of this solution are running, they can monitor whether multiple program modules belonging to the same specific function program running on the MCU are running normally. If any one or more program modules are not running normally, the interrupt program can detect this abnormality in time through the value of the counter variable, thereby reducing the risk caused by the abnormal operation of the program modules.

[0040] A series of simplified concepts are introduced in the description of the invention, which will be further explained in detail in the detailed description section. This description is not intended to limit the key features and essential technical features of the claimed technical solution, nor is it intended to determine the scope of protection of the claimed technical solution.

[0041] The advantages and features of the present invention will be described in detail below with reference to the accompanying drawings. Attached Figure Description

[0042] The following figures are included as part of this invention for understanding its principles. The figures illustrate embodiments of the invention and their descriptions, serving to explain the principles of the invention. In the figures,

[0043] Figure 1 A schematic flowchart illustrating a program monitoring method for a microcontroller according to an embodiment of the present invention; and

[0044] Figure 2 A schematic block diagram of a program monitoring system according to an embodiment of the present invention is shown. Detailed Implementation

[0045] In the following description, numerous details are provided to enable a thorough understanding of the invention. However, those skilled in the art will appreciate that the following description merely illustrates preferred embodiments of the invention, and that the invention can be practiced without one or more of these details. Furthermore, to avoid obscuring the invention, some technical features well-known in the art have not been described in detail.

[0046] To at least partially address the aforementioned technical problems, embodiments of the present invention provide a program monitoring method and system for microcontrollers, a home appliance, and a storage medium. This method can monitor whether multiple program modules belonging to the same specific function program running on the MCU are operating normally. If any one or more program modules are not operating normally, the interrupt program can promptly detect this anomaly through the value of a counter variable, thereby reducing the risk caused by abnormal operation of program modules.

[0047] Figure 1 A schematic flowchart of a program monitoring method 100 for a microcontroller according to an embodiment of the present invention is shown. The program monitoring method 100 for a microcontroller can run on any microcontroller. Figure 1 As shown, the program monitoring method 100 for a microcontroller includes steps S110, S120, S130, S140 and S150.

[0048] In step S110, one or more count variables are initialized to zero. When there are multiple count variables, each count variable corresponds to one of the N program modules executed in series in the microcontroller. When there is only one count variable, the count variable corresponds to N program modules, where N is a positive integer greater than 1. The N program modules belong to specific function programs running on the microcontroller.

[0049] The MCU described herein can be of any type and used to implement any function. An MCU can be any suitable processing device with data processing and / or instruction execution capabilities. For example, an MCU can be implemented using one or a combination of several of the following processing units: programmable logic controller (PLC), digital signal processor (DSP), field-programmable gate array (FPGA), programmable logic array (PLA), central processing unit (CPU), application-specific integrated circuit (ASIC), and other forms of processing units.

[0050] The MCU described herein can be any MCU in any electronic device (e.g., a cooking appliance) that requires program monitoring. For example, the MCU can be either the MCU of a touch chip or the MCU of a main control chip in an electronic device with touch functionality. The MCU can also be either the MCU of a display chip or the MCU of a main control chip in an electronic device with display functionality. The MCU can also be any other suitable MCU on a chip, which is not listed here. The aforementioned electronic devices with touch or display functionality can be such as mobile phones, rice cookers, soy milk makers, range hoods, televisions, etc.

[0051] A function-specific program (SSP) is a program running on an MCU to implement a specific function. This function can be such as touch-screen interaction, heating, or various cooking functions. An SSP can include N program modules. These N modules can be the key programs within the MCU. The key programs differ depending on the type of MCU. For example, the key programs for a touch-chip MCU (touch MCU) can include communication programs, key detection programs, and valid key recognition programs. The touch MCU's communication program transmits key information to the main control chip MCU (main MCU) via communication. The key detection program detects the position of the key pressed by the user. The valid key recognition program identifies whether the key was pressed by the user or was falsely detected due to pulse bursts or injected current interference. Similarly, the key programs for the main control chip MCU of a cooking appliance can include various cooking stages, temperature limit protection programs, and communication programs. The cooking program achieves the purpose of cooking food through appropriate heating. The temperature limit protection program protects the heating from exceeding a certain temperature. The main MCU's communication program communicates with the touch chip to receive key information and / or with the electromagnetic heating (IH) power board chip to control heating.

[0052] It can perform serial execution detection on the MCU's critical programs. That is, the MCU's N program modules can be executed in sequence, meaning that the second program module will only be executed after the first program module has been completed, the third program module will only be executed after the third program module has been completed, and so on.

[0053] One or more counter variables can be set in the MCU and initialized to zero during setting. For example, one or more counter variables can be stored in a common memory location. This memory location can be independent of the MCU or it can be a memory location on the MCU (e.g., a register on the MCU). N program modules and interrupt routines can all read from and write to one or more counter variables from this common memory location.

[0054] In one example, the number of counter variables can be one. In this case, N program modules can each correspond to this counter variable (denoted by M). Each time a program module runs normally (i.e., executes), the counter variable M is incremented by one. Therefore, if all N program modules run normally, the value of M should not be less than N. Thus, in this situation, when the interrupt program makes a judgment, the value of M can be used to determine whether the N program modules are running normally.

[0055] In another example, the number of counter variables can be multiple, such as N. In this case, each of the N program modules can be associated with one of the N counter variables. Each time a program module runs normally, its corresponding counter variable is incremented by one. Therefore, if all N program modules are running normally, the values ​​of the N counter variables corresponding to the N program modules should be consistent (all program modules run the same number of times) or not significantly different (if some program modules run one more time than others, the difference should be at most 1). Therefore, in this case, when the interrupt program makes a judgment, it can determine whether the N program modules are running normally by combining multiple counter variables, for example, by comparing the difference between the maximum and minimum values.

[0056] In step S120, for the i-th program module among the N program modules, whenever the program module is executed, the corresponding counter variable is incremented by one, where i = 1, 2, 3, ..., N.

[0057] By way of example, and not limitation, for the i-th program module out of N program modules, a counter variable can be incremented by one each time an identified submodule within that program module is executed. An identified submodule can represent a program module. For any program module, the identified submodule can be its core module, i.e., the common part within that program module. A part of a program module is common and core; that is, whenever the program module is executed, its submodule will necessarily be executed.

[0058] The following description uses the number of counter variables as an example. The MCU can first set the counter variable M and then clear it. For the first program module, the first judgment code can be placed in the core position of the module. The judgment logic of the first judgment code is: check if M modulo N is 0. If it is 0, then M = M + 1. That is, when the specific function program runs to the first program module, if M modulo N is 0, then M is incremented by 1. For the second program module, the second judgment code can also be placed in the core position of the module. The judgment logic of the second judgment code is: check if M modulo N is 1. If it is 1, then M = M + 1. That is, when the specific function program runs to the second program module, if M modulo N is 1, then M is incremented by 1 again. The remaining program modules follow the same principle and will not be elaborated further. When running to the Nth program module, if all program modules run exactly as expected, M will be incremented to the value of N. The above description is for the case of N program modules executing once. If the execution is repeated a second or more times, the value of M can continue to accumulate.

[0059] In step S130, the interrupt procedure is triggered at a predetermined time.

[0060] An interrupt routine is a program independent of N program modules, or it can be a program independent of the entire specific function program. The program instructions of the interrupt routine can be stored in the memory units (such as certain registers) of the MCU mentioned above.

[0061] For example, triggering an interrupt routine at a predetermined time may include: intermittently triggering the interrupt routine, where the predetermined time is the moment each interrupt routine is triggered. The time interval for triggering the interrupt routine may be fixed or variable.

[0062] For example, triggering an interrupt at a predetermined time can include a timed interrupt routine. This interrupt routine can be triggered by a timer in the MCU, meaning it runs at fixed intervals. The timer can be a hardware or software timer. The timer's interval (i.e., the interval at which the interrupt routine is triggered) can be set to any suitable value as needed.

[0063] In step S140, an interrupt routine is used to check whether the values ​​of one or more counter variables meet preset requirements.

[0064] As mentioned above, the interrupt routine can read the value of the counter variable from the aforementioned common memory location. It is also understood that the program module can read the value of the counter variable from the common memory location and write the new value of the counter variable back into the common memory location.

[0065] As described above, with only one count variable, the count variable M increments by one if any program module executes. Thus, if all program modules execute normally, the count variable M should be greater than or equal to N. If any program module fails to execute normally, the count variable M will not accumulate to N. Therefore, the relative values ​​of M and N can be used to determine whether N program modules are running normally. In other words, in this case, the default requirement can be set to the count variable M being greater than or equal to N.

[0066] As mentioned above, when there are multiple counting variables, each program module's corresponding counting variable is incremented by one for each normal operation. In this case, when the interrupt program makes a judgment, it can determine whether N program modules are operating normally by combining multiple counting variables, such as comparing the difference between the maximum and minimum values. That is, in this case, the preset requirement can be set as follows: the difference between the maximum and minimum values ​​of multiple counting variables is not greater than a preset threshold and the minimum value is not zero.

[0067] In step S150, if the values ​​of one or more count variables meet the preset requirements, then it is determined that N program modules are running normally and one or more count variables are cleared to zero; otherwise, it is determined that N program modules are not running normally and one or more count variables are cleared to zero.

[0068] If the values ​​of one or more counter variables meet the preset requirements, it indicates that the specific function program has run completely and as expected. At this point, a corresponding operation can be performed, such as resetting the counter variables to zero. Resetting them allows the counter variables to start counting again. If the values ​​of one or more counter variables do not meet the preset requirements, it indicates that some program modules were not executed within the previous timing period. In this case, a corresponding operation can also be performed, such as resetting the MCU and then powering it back on, causing the MCU to re-run the specific function program.

[0069] According to the monitoring method of the present invention, multiple program modules belonging to the same specific function program running on the MCU can be monitored to see if they are running normally. If any one or more program modules are not running normally, the interrupt program can detect the abnormality in time by using the value of the counter variable, thereby reducing the risk caused by the abnormal operation of the program modules.

[0070] The step of initializing one or more counter variables to zero (step S110) can be executed before the MCU runs N program modules for the first time. Subsequent steps S120 to S150 can be executed in real time or cyclically, that is, steps S120 to S150 can be executed repeatedly.

[0071] According to an embodiment of the present invention, after detecting whether the values ​​of one or more counter variables meet preset requirements using an interrupt program, method 100 may further include: if it is determined that N program modules are not operating normally, then outputting first alarm information and / or recording first operating information of the N program modules; if it is determined that any specific program module among the N program modules is not operating normally, then outputting second alarm information related to the specific program module and / or recording second operating information of the specific program module.

[0072] For example, if any one of the N program modules malfunctions, it can be determined that all N program modules are malfunctioning. Once it is determined that all N program modules are malfunctioning, regardless of which specific module is identified as malfunctioning, a first alarm message can be output and / or the first operating information of the N program modules can be recorded.

[0073] The first alarm message can be any suitable form of information and can be output in any suitable manner. For example, the first output message can take one or more of the following forms: video, image, text, sound, light, etc. For example, the first output message can be output through the output device of a household appliance. The output device can include, but is not limited to: a monitor, speaker, light source, etc. The first alarm message can promptly remind users to repair or replace household appliances, thereby reducing safety hazards and improving user experience.

[0074] The initial operational information may include the time when N program modules malfunctioned (i.e., the time when the anomaly occurred) and / or other information related to the operation of the N program modules. Recording the initial operational information facilitates subsequent verification, such as checking the time when the program module malfunctioned and its operating status at that time during maintenance, in order to further determine the cause of the anomaly and to conduct performance evaluation of the electrical appliance.

[0075] If it is determined that N program modules are not operating properly, and it is determined which program module is not operating properly (the program module that is not operating properly is the specific program module), a second alarm message related to the specific program module can be output and / or the second operating information of the specific program module can be recorded.

[0076] The second alarm information is similar in form and output method to the first alarm information, and will not be repeated here. The second operational information may include the time when a specific program module malfunctions (i.e., the time of the anomaly) and / or other information related to the operation of that specific program module. The advantages of recording the second operational information are similar to those of recording the first operational information, and will not be repeated here.

[0077] Through the above embodiments, when a program module malfunctions, alarms can be triggered for all program modules or for the specific program module that malfunctions, or corresponding operating information can be recorded to promptly remind users to perform repairs or replacements, or to facilitate later verification.

[0078] According to an embodiment of the present invention, the first operating information includes the variable values ​​of state variables related to the working state of a specific functional program at the current moment. After using an interrupt program to detect whether the values ​​of one or more counter variables meet preset requirements, the method further includes: if it is determined that N program modules are not operating normally, then clearing the remaining variables involved in the specific functional program other than the state variables and / or clearing the hardware registers in the microcontroller.

[0079] N program modules belong to a specific function program. The first running information of the N program modules can include the variable values ​​of state variables related to the working state of the specific function program at the current moment.

[0080] If it is determined that N program modules are not operating properly, the values ​​of the state variables related to the working state of a specific function program at the current moment can be recorded. It is also possible to clear the other variables involved in the specific function program, excluding the state variables, and / or clear the hardware registers in the microcontroller.

[0081] If it is determined that N program modules are malfunctioning, a corresponding reset operation can be performed. The reset operation can include the following status recording and clearing operations. For example, the operating status of a specific function program can be recorded using several variables. For instance, in the case of a cooking program, the status variables could include the current cooking state (e.g., cooking rice) and the progress of that cooking state. Furthermore, in addition to the recorded status variables, other variables and the MCU's hardware registers can be cleared.

[0082] Which variables are important and need to be recorded, and which variables can be cleared, can be determined as needed; this invention does not impose any restrictions on this.

[0083] By recording the above status, the operating status of a specific function program when an anomaly occurs can be recorded, facilitating subsequent verification or resuming work. Furthermore, clearing various variables and / or hardware registers allows for timely formatting of the specific function program or the MCU's operating status, preventing the anomaly from recurring and causing adverse or even serious consequences.

[0084] According to an embodiment of the present invention, if it is determined that N program modules are not operating properly, after clearing all variables except the status variables involved in the specific function program and / or clearing the hardware registers in the microcontroller, the method further includes: restarting the specific function program and assigning the previously recorded variable values ​​to the status variables of the specific function program.

[0085] The reset operation can further include a state recovery operation. For example, after recording the values ​​of the status variables and clearing the remaining variables and / or hardware registers, the MCU can be restarted, that is, the MCU can be restored to its power-on state and the specific function program can be restarted. The specific function program can then check whether the status variable was previously recorded. If the variable was recorded, the current status variable can be set to the previous value and the specific function program can continue to run, while continuing to monitor changes in the value of the counter variable to identify whether the program module is malfunctioning.

[0086] By using the above reset method, the previous variable values ​​can be reused after the MCU restarts, continuing the previous operating state. This solution has a state memory function, which is user-friendly and can effectively improve the user experience.

[0087] According to an embodiment of the present invention, the microcontroller is a microcontroller on a touch chip used to implement button touch interaction functions, and the state variables are the reference values ​​of each button.

[0088] For electronic devices with button-touch interaction, each button can have a corresponding reference value, and this reference value can change during operation. The reference value of any button can be regarded as the position threshold of that button. For example, if the button position is below the reference value, it is considered that the button is pressed; otherwise, it is considered that the button is not pressed.

[0089] For the MCU on the touch chip, recording the reference value for each button allows the MCU to continue button recognition based on that reference value upon the next restart. This approach facilitates button detection in electronic devices with touch-sensitive interaction after a reset, allowing them to follow the user's previous habits and providing a better user experience.

[0090] According to an embodiment of the present invention, the number of counting variables is one. For the i-th program module among N program modules, whenever the identifier submodule in the program module is executed, the corresponding counting variable is incremented by one, including: for the i-th program module among N program modules, whenever the identifier submodule in the program module is executed, if a preset condition is met, the counting variable M is incremented by one, wherein the preset condition is that M modulo N equals i-1, or the preset condition is that M equals i-1; wherein the preset requirement is that the counting variable M is greater than or equal to N.

[0091] By way of example, and not limitation, the user can pre-set the value of N in the interrupt routine. In this way, the interrupt routine can know the size of N.

[0092] The following example further illustrates this. For instance, for a touch MCU, there are three key programs: the first is the communication program module, which transmits key information to the main MCU; the second is the key detection program module, which detects whether a key is pressed; and the third is the valid key recognition program module, which identifies whether the trigger is caused by interference or by an actual user press. A timer can be set to trigger an interrupt program at fixed intervals to check if these three programs have been executed. First, a variable M is set and cleared to zero. Furthermore, in the communication program module (right after communication ends), an instruction is added to execute M = M + 1 when M is 0 (remainder of 3); in the key detection program module, an instruction is added to execute M = M + 1 when M is 1 (remainder of 3); and in the valid key recognition program module, an instruction is added to execute M = M + 1 when M is 2 (remainder of 3). When the program runs completely, the value of M should not be less than 3. The timer periodically triggers an interrupt program to check if M is greater than or equal to 3. If M is greater than or equal to 3, it indicates that the touch program has run completely, and M is cleared to zero. Conversely, if M is less than 3, it indicates that the touch program is not running completely. In this case, the baseline values ​​of each button can be recorded, and all other variables except the baseline values ​​of each button should be cleared, as well as the hardware registers. Subsequently, the touch program can be restarted, and the previously recorded baseline values ​​of each button can be assigned to the current baseline value variables of each button to detect the button presses.

[0093] Furthermore, the preset condition can also be that M equals i-1. The example above illustrates an example where the preset condition is M modulo N equals i-1. In the example above, if the interval between two interrupts exceeds the execution time of N program modules in one run, that is, if N program modules can execute more than one round, M will continuously accumulate. In this embodiment, however, the preset condition is that M equals i. Thus, M accumulates at most to N. Therefore, if M does not equal N, it can be considered that a program module has malfunctioned.

[0094] In this embodiment, a single counter variable M is used to accumulate and record the execution status of the program module. This approach requires fewer counter variables, resulting in less data and higher detection efficiency.

[0095] According to an embodiment of the present invention, method 100 may further include: for the case where N program modules are not running properly, if the counter variable M is equal to j, then the (j+1)th program module is determined to be not running properly, j = 0, 1, 2, ..., N–1.

[0096] The following explanation uses an example where the preset condition M equals i-1. In this example, the abnormal program module can be further determined by the value of the counter variable M. For example, if the interrupt routine detects that M equals 0, it can be determined that the first communication program module is not running normally; if the interrupt routine detects that M equals 1, it can be determined that the second key detection program module is not running normally; if the interrupt routine detects that M equals 2, it can be determined that the third valid key recognition program module is not running normally. That is, if M equals j, it means that the (j+1)th program module is not running normally, where j = 0, 1, 2, ..., N-1.

[0097] The above embodiments not only identify program modules that malfunction, but also pinpoint which module is causing the malfunction. This facilitates subsequent inspection to determine the cause of the malfunction and allows for timely repair or replacement of the appliance.

[0098] According to an embodiment of the present invention, there are multiple counting variables, and the preset requirement is that the difference between the maximum and minimum values ​​among the multiple counting variables is not greater than a preset threshold and the minimum value is not zero.

[0099] The counting method for multiple counting variables and the detection method for interrupt routines have been described above, and will not be repeated here.

[0100] The preset threshold can be set to any suitable value as needed, such as 0, 1, or a larger value. A preset threshold of 0 requires all program modules to execute the same number of times, which is a relatively strict requirement. A preset threshold of 1 allows two program modules to differ by one execution time. Since the time interval between two interrupts may not be guaranteed to be an exact multiple of the execution time of N program modules, a difference of one execution time between two program modules is more likely to occur. Therefore, a preset threshold greater than 0 is more practical and helps improve the accuracy of program execution detection.

[0101] In this embodiment, each program module has its own corresponding counter variable, which makes it convenient to know the running status of each program module (e.g., how many times each program module runs).

[0102] According to an embodiment of the present invention, method 100 may further include: for the case where N program modules are not running properly, determining that the program module corresponding to the count variable whose difference from the maximum value is greater than a preset threshold among multiple count variables is not running properly.

[0103] In embodiments employing multiple counting variables, the abnormal program modules can be further identified by the values ​​of the counting variables. The following explanation uses a preset threshold of 1 as an example. For instance, if the counting variables M1 corresponding to the first program module and M2 corresponding to the second program module are the largest and equal to each other, and the difference between them and the counting variable M3 corresponding to the third program module is greater than 1, then the third program module can be determined to be abnormal. As another example, if the counting variable M1 corresponding to the first program module is the largest, and the difference between it and the counting variable M2 corresponding to the second program module is 2 (i.e., greater than 1), while the difference between it and the counting variable M3 corresponding to the third program module is 4 (also greater than 1), then it can be determined that both the second and third program modules are abnormal.

[0104] The above embodiments not only identify program modules that malfunction, but also pinpoint which module is causing the malfunction. This facilitates subsequent inspection to determine the cause of the malfunction and allows for timely repair or replacement of the appliance.

[0105] According to an embodiment of the present invention, the time interval between two triggers of the interrupt program is not less than the time required for all N program modules to be executed once.

[0106] This trigger interval setting helps ensure that each of the N program modules is executed at least once, thereby helping to ensure the accuracy of program execution detection.

[0107] According to an embodiment of the present invention, the interrupt routine is triggered at a timer, and the time interval for triggering the interrupt routine is in the range of 100µs to 2s. For example, the time interval for the timer to trigger the interrupt routine can be 0.5s.

[0108] The time interval for triggering the interrupt routine can be set according to the needs of the application scenario, such as cooking safety requirements. If the time interval is too long, the interrupt routine may have difficulty detecting abnormalities in the program module in a timely manner, which can easily lead to significant safety risks. On the other hand, if the time interval is too short, the interrupt routine will detect abnormalities too frequently, which will place a heavy workload on the MCU and increase the power consumption of the device.

[0109] The time interval for triggering the interrupt routine is set to be in the range of 100us to 2s, especially 0.5s. This can meet the safety needs of most household appliances and achieve a good balance between safety and workload.

[0110] According to an embodiment of the present invention, any program module among the N program modules includes an identifier submodule and one or more branch submodules. When each of the one or more branch submodules is running, the identifier submodule is also running. For the i-th program module among the N program modules, incrementing the corresponding count variable by one each time the program module is executed includes: for the i-th program module among the N program modules, incrementing the corresponding count variable by one each time the identifier submodule in the program module is executed.

[0111] As mentioned above, for any program module, the identifier submodule is its core module, that is, the common part of the program module. A part of a program module is common and core; that is, whenever the program module is executed, this submodule will inevitably be executed as well.

[0112] Branch submodules can be executed independently of each other; that is, executing one branch submodule does not necessarily mean executing another branch submodule.

[0113] As a core submodule within the program module, the identifier submodule associates the accumulation of the counter variable with the identifier submodule, which helps ensure that the accumulation of the counter variable can be effectively triggered when the program module is executed.

[0114] According to an embodiment of the present invention, the microcontroller is a microcontroller on a touch chip used to implement button touch interaction functions, and the N program modules include a communication program module, a button detection program module, and a valid button recognition program module.

[0115] The program modules of the touch MCU have already been described above and will not be repeated here. Touch MCUs are commonly used in most electronic devices today. Incorporating the above-mentioned key programs of the touch MCU into monitoring helps meet the monitoring requirements of most electronic devices, adapting to a wider range of application scenarios.

[0116] According to an embodiment of the present invention, the microcontroller is a microcontroller on the main control chip of the cooking appliance, and the N program modules include one or more of the following: cooking programs for each stage, temperature limit protection programs, and communication programs.

[0117] The main MCU program modules of cooking appliances have already been described above and will not be repeated here. The main MCU of cooking appliances typically handles functions such as heating and temperature limiting, which have high safety requirements. Incorporating these key programs of the main MCU into monitoring helps to promptly detect malfunctions and avoid various safety hazards.

[0118] According to another aspect of the present invention, a program monitoring system is provided. Figure 2A schematic block diagram of a program monitoring system 200 according to an embodiment of the present invention is shown. The program monitoring system 200 includes a memory 210 and a processor 220. The memory 210 stores computer program instructions, which are executed by the processor 220 to perform the program monitoring method 100 for a microcontroller described above.

[0119] For example, the program monitoring system 200 may be the microcontroller itself. That is, computer program instructions may be embedded inside the microcontroller to be monitored, which, when running, are used to execute the program monitoring method 100 to monitor the microcontroller itself.

[0120] According to another aspect of the present invention, a household appliance is provided, including the above-described program monitoring system 200 and a microcontroller.

[0121] According to another aspect of the present invention, a storage medium is provided on which program instructions are stored, which, when executed by a computer or processor, are used to perform corresponding steps of the program monitoring method 100 for a microcontroller according to an embodiment of the present invention. The storage medium may, for example, include a memory card of a smartphone, a storage component of a tablet computer, a hard disk of a personal computer, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disc read-only memory (CD-ROM), a USB memory, or any combination of the above storage media.

[0122] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed.

[0123] Similarly, it should be understood that, in order to streamline the invention and aid in understanding one or more of the various aspects of the invention, features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the description of exemplary embodiments of the invention. However, this approach should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the corresponding claims, its inventive point lies in solving the corresponding technical problem with fewer features than all of those in a single disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of the invention.

[0124] Those skilled in the art will understand that, apart from the mutual exclusion of features, all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or apparatus so disclosed can be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0125] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that processing modules or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some modules in the program monitoring system according to embodiments of the present invention. The present invention can also be implemented as an apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such programs implementing the present invention can be stored on a computer-readable medium or can take the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0126] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.

[0127] The above description is merely a specific embodiment of the present invention or an explanation of that embodiment. The scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. The scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for program monitoring of a microcontroller, comprising: Initialize one or more counter variables to zero. When there are multiple counter variables, the multiple counter variables correspond one-to-one with N program modules executed in series in the microcontroller. When there is only one counter variable, the counter variable corresponds to the N program modules, where N is a positive integer greater than 1. The N program modules belong to specific function programs running on the microcontroller. For the i-th program module among the N program modules, each time the program module is executed, the corresponding counter variable is incremented by one, where i = 1, 2, 3, ..., N; The interrupt procedure is triggered at a predetermined time. The interrupt routine is used to detect whether the values ​​of one or more counter variables meet preset requirements; If the value of one or more count variables meets the preset requirement, then it is determined that the N program modules are running normally and the one or more count variables are cleared to zero; otherwise, it is determined that the N program modules are not running normally and the one or more count variables are cleared to zero. The number of counter variables is one. For the i-th program module among the N program modules, incrementing the corresponding counter variable by one each time the program module is executed includes: For the i-th program module among the N program modules, whenever the program module is executed, if a preset condition is met, the counter variable M is incremented by one, where the preset condition is that M modulo N equals i-1, or the preset condition is that M equals i-1. The preset requirement is that the counting variable M is greater than or equal to N; The method further includes: In the event that the N program modules malfunction... If the count variable M equals j, then the (j+1)th program module is determined to be malfunctioning, where j = 0, 1, 2, ..., N – 1.

2. The method as described in claim 1, wherein, After detecting whether the values ​​of the one or more counter variables meet preset requirements using the interrupt routine, the method further includes: If it is determined that the N program modules are not operating properly, then output the first alarm information and / or record the first operating information of the N program modules; If it is determined that any specific program module among the N program modules is malfunctioning, then a second alarm message related to the specific program module is output and / or the second operating information of the specific program module is recorded.

3. The method as described in claim 2, wherein, The first operational information includes the values ​​of state variables related to the working state of the specific functional program at the current moment. After detecting whether the values ​​of the one or more counter variables meet preset requirements using the interrupt program, the method further includes: If it is determined that the N program modules are not functioning properly, then all variables involved in the specific function program, except for the status variables, are cleared and / or the hardware registers in the microcontroller are cleared.

4. The method of claim 3, wherein, After determining that if the N program modules are malfunctioning, the method clears all variables related to the specific function program except for the status variables and / or clears the hardware registers in the microcontroller, the method further includes: Restart the specific function program and assign the previously recorded variable values ​​to the state variables of the specific function program.

5. The method as described in claim 3 or 4, wherein, The microcontroller is a microcontroller on a touch chip used to implement button touch interaction functions, and the state variables are the reference values ​​of each button.

6. The method according to any one of claims 1 to 4, wherein, The number of counting variables is multiple, and the preset requirement is that the difference between the maximum and minimum values ​​among the multiple counting variables is not greater than a preset threshold and the minimum value is not zero.

7. The method of claim 6, wherein, The method further includes: If any of the N program modules malfunction, the program module corresponding to the count variable whose difference from the maximum value is greater than the preset threshold is identified as malfunctioning.

8. The method as described in any one of claims 1 to 4, wherein, The time interval between the two triggers of the interrupt routine is not less than the time required for all N program modules to execute once.

9. The method according to any one of claims 1 to 4, wherein, The interrupt routine is triggered periodically, and the time interval for triggering the interrupt routine is in the range of 100us to 2s.

10. The method according to any one of claims 1 to 4, wherein, Each of the N program modules includes an identifier submodule and one or more branch submodules. When each of the one or more branch submodules is running, the identifier submodule is also running. Wherein, for the i-th program module among the N program modules, incrementing the corresponding counter variable by one each time the program module is executed includes: For the i-th program module among the N program modules, whenever the identifier submodule in the program module is executed, the corresponding counter variable is incremented by one.

11. The method according to any one of claims 1 to 4, wherein, The microcontroller is a microcontroller on a touch chip used to implement button touch interaction functions, and the N program modules include a communication program module, a button detection program module, and a valid button recognition program module.

12. The method according to any one of claims 1 to 4, wherein, The microcontroller is the microcontroller on the main control chip of the cooking appliance, and the N program modules include one or more of the following: cooking programs for each stage, temperature limit protection programs, and communication programs.

13. A program monitoring system, comprising a processor and a memory, wherein, The memory stores computer program instructions, which, when executed by the processor, are used to perform the program monitoring method for a microcontroller as described in any one of claims 1 to 12.

14. A household appliance comprising the program monitoring system and microcontroller as described in claim 13.

15. A storage medium storing program instructions that, when executed, perform the program monitoring method for a microcontroller as claimed in any one of claims 1 to 12.

Citation Information

Patent Citations

  • Service monitoring method and device

    CN112100034A

  • Fault monitoring method for application

    JP2007257395A