Low-power-consumption management and control method based on state mode

Through the low-power management and control method based on state mode, the microcontroller can achieve fast state switching and lower power consumption in complex tasks, solving the problems of cumbersome state transition and high power consumption of the microcontroller in complex tasks, and significantly reducing the cost of the microcontroller. Average power consumption.

CN118655809APending Publication Date: 2024-09-17TIANJIN HAOYUAN HUINENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410689676.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

When the microcontroller handles complex tasks or needs to frequently adjust the operating mode, it is difficult to switch states, resulting in inconvenient program operation, increased software maintenance costs, and high power consumption during the state switching process, reducing the battery life of the device.

Method used

Adopt a low-power management and control method based on state mode to quickly switch states and reduce power consumption by initializing, shortening peripheral device operation time, entering low-power sleep state, stopping CPU work, and keeping the clock running.

Benefits of technology

It achieves fast state switching and lower power consumption of the microcontroller, solves the problems of cumbersome switching modes and incomplete power consumption in the existing technology, and significantly reduces the average power consumption of the microcontroller.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118655809A
    Figure CN118655809A
Patent Text Reader

Abstract

The invention provides a low-power-consumption management and control method based on a state mode. The low-power-consumption management and control method comprises the following steps that whether a program runs for the first time or not is judged; performing complete initialization; performing partial initialization; a program starts to work, and related sampling and control instructions are executed; after the sampling is completed, initializing related settings of the operation; when the work is finished or an instruction is received, preparing to enter low power consumption, setting dormancy time and an awakening mode, and entering dormancy; and the single-chip microcomputer enters low power consumption and waits for awakening. The method has the advantages that after the single-chip microcomputer receives corresponding instruction operation, state switching can be rapidly carried out, meanwhile, after the single-chip microcomputer enters the low-power-consumption state, the power consumption of the single-chip microcomputer is lower, and the low-power-consumption mode of the single-chip microcomputer is more thorough. The problems that in the prior art, the middle process of mode switching is tedious, and low power consumption is not thorough are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of single-chip computer power consumption, and in particular relates to a low power consumption management and control method based on a state mode. Background Art

[0002] Most of the widely used single-chip microcomputer control systems are designed based on fixed program flow. Once the programming is completed, its execution logic is difficult to change. This design method is incapable of handling complex tasks or applications that require frequent adjustment of operating modes. For example, during the operation of the single-chip microcomputer, when different state transitions need to be performed according to the actual situation of the current single-chip microcomputer operation, the state transition of the single-chip microcomputer is more difficult, the current state of some peripheral devices is difficult to judge and determine, and it is impossible to quickly switch to the next process. The program operation is not convenient enough, which increases the maintenance cost of the software and limits the flexibility of the software system.

[0003] The reason for these problems is that when the MCU is running, it needs to wait for the current task state to be completed before it can switch the state, and the waiting time is long. At the same time, when the MCU switches from the working state to the sleeping state, there is a lot of preparation work to be done in the middle, and the process is cumbersome. In the actual working process, the power consumption is increased, which reduces the battery life of the MCU equipment. Summary of the invention

[0004] In view of this, the present invention aims to propose a low power consumption management and control method based on a state mode to solve at least one problem existing in the above-mentioned prior art.

[0005] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0006] A low power consumption management and control method based on a state mode comprises the following steps:

[0007] S1, determine whether it is the first time to run the program, if yes, go to step S2, if not, go to step S3;

[0008] S2, complete initialization, and proceed to step S4;

[0009] S3, partial initialization, and proceed to step S4;

[0010] S4, the program starts working and executes relevant sampling and control instructions;

[0011] S5, sampling is completed, and the operation-related settings of step S4 are initialized;

[0012] S6: After the work is completed or the command is received, prepare to enter low power consumption, set the sleep time and wake-up method, and enter sleep mode;

[0013] S7, the MCU enters low power consumption and waits for wake-up. If the MCU wakes up, it returns to step S1.

[0014] Furthermore, in step S1, when the single-chip microcomputer device is used for the first time, all variables are initialized;

[0015] Further, in step S2, the single-chip microcomputer device is awakened and used to initialize some variables that do not need to be retained.

[0016] Furthermore, in step S4, during the running of the program, when the peripheral devices of the single-chip microcomputer are controlled, the operation time of the peripheral devices is shortened and the number of operations on the peripheral devices is reduced;

[0017] After the work is completed, the operation is concluded and the called peripheral devices are initialized;

[0018] When a long wait is required, the microcontroller can be controlled to enter a low-power, short-term sleep or pause mode to reduce the power consumption of the microcontroller.

[0019] Further, in step S6, before the program enters low power consumption, the variables that need to be retained are retained, and the operation instructions that are not retained are initialized;

[0020] Determine the device wake-up status based on the retained variable value.

[0021] Furthermore, in step S6, when the single-chip microcomputer enters a low power consumption state, the single-chip microcomputer enters a low power mode, stops the CPU from working, keeps the clock running, and determines whether it is necessary to start the program running through the register.

[0022] Compared with the prior art, the low power consumption management and control method based on state mode described in the present invention has the following advantages:

[0023] The low power consumption management and control method based on the state mode described in the present invention can quickly switch the state after the single chip receives the corresponding instruction operation, and at the same time, after entering the low power consumption state, the power consumption of the single chip is lower, making the low power consumption mode of the single chip more thorough. It actually solves the problem of the existing technology that the switching mode intermediate process is cumbersome and the low power consumption is not thorough. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0025] Figure 1 A schematic diagram of the method flow of the embodiment of the present invention;

[0026] Figure 2A schematic diagram of a power consumption spectrum obtained by measuring using the old power consumption mode according to an embodiment of the present invention;

[0027] Figure 3 This is a schematic diagram of a power consumption graph spectrum measured using the power consumption mode of the method described in an embodiment of the present invention. DETAILED DESCRIPTION

[0028] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0029] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and the like may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.

[0030] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood by specific circumstances.

[0031] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0032] like Figure 1 As shown, a low power consumption management and control method based on state mode, the specific steps are as follows:

[0033] 1. During the program running process, when executing the control of the microcontroller peripheral devices, shorten the operation time of the peripheral devices, reduce the number of operations on the peripheral devices, and after the work is completed, finish the operation and initialize the called peripheral devices. Prepare for the subsequent rapid entry into the low-power state. When a long wait is required, the microcontroller can be controlled to enter a short-term low-power sleep or pause to reduce the power consumption of the microcontroller.

[0034] 2. Before the program enters low power consumption, keep the relevant variables that need to be retained and initialize the operation instructions that do not need to be retained. According to the values ​​of the relevant variables that are retained, judge the device wake-up status. When the MCU device is used for the first time, initialize all variables; after the MCU device is awakened, initialize some variables that do not need to be retained.

[0035] 3. When the MCU enters the low power state, it puts the MCU into low power mode, stops the CPU, keeps the clock running, and determines whether it is necessary to start the program through the register.

[0036] In this method, the low power consumption and low power consumption wake-up process are executed during the operation of the single chip microcomputer, and the low power consumption processing process is entered.

[0037] After the MCU system software finishes the current work, it will immediately finish the current work. After executing the corresponding operation, it will immediately initialize the corresponding state and execute the subsequent operation commands. After the work instruction is completed, the command is executed to return the state of the relevant part of the MCU to the default or initialized state. In this way, when the software program is not executing a specific command, it is in an idle state, and it is more convenient and quick to switch the state later. Some existing MCUs enter the low-power mode, which makes the MCU in an idle state without high power consumption. In fact, the MCU has been in a running state at this time, and has been performing an empty loop, and is in a low-power running state, but the MCU has not stopped working at this time, and is not in a power-off state. The registers of the chip are still working normally.

[0038] In the low-power sleep state, the MCU can be put into a more thorough sleep state through software calls, retaining some variables of the MCU into SRAM, stopping the CPU of the MCU, maintaining low power consumption, and waiting for subsequent clock wake-up. After being awakened, the MCU state is judged, and the MCU is controlled to enter the initialization of different states according to the state of the MCU variables. In the workflow of the MCU, when the MCU is operating peripheral devices, the peripheral devices are in an active working state and the power consumption is high. The operation time of the peripheral devices should be minimized and the number of operations should be reduced. Optimize the code to reduce the power consumption time of each operation. On the premise of satisfying the device operation, the delay state can be changed to the sleep state to further reduce the power consumption of the MCU. When the MCU does not need to work for a long time, put the MCU in a long-term, low-power sleep state.

[0039] Example 1

[0040] The low power consumption management and control method based on the state mode is verified by example comparison. Figure 2-Figure 3 ,in Figure 2The power consumption spectrum is obtained by measuring the old power consumption mode. At this time, it enters the low power consumption state with an average power consumption of 100uA. Figure 3 This is the power consumption graph spectrum measured using the new power consumption mode of this method. At this time, it enters a low power consumption state with an average power consumption of 20uA.

[0041] It has been verified that by switching to low power mode, the actual power consumption is reduced by 80uA, which actually reduces the average power consumption.

[0042] This method can quickly switch the state after the single-chip microcomputer receives the corresponding instruction operation. At the same time, after entering the low-power state, the power consumption of the single-chip microcomputer is lower, making the low-power mode of the single-chip microcomputer more thorough. It actually solves the problem of the existing technology that the switching mode process is cumbersome and the low-power mode is not thorough.

[0043] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A low power consumption management and control method based on state mode, characterized in that: The following steps are involved: S1, determine whether it is the first time to run the program, if yes, go to step S2, if not, go to step S3; S2, complete initialization, and proceed to step S4; S3, partial initialization, and proceed to step S4; S4, the program starts working and executes relevant sampling and control instructions; S5, sampling is completed, and the operation-related settings of step S4 are initialized; S6: After the work is completed or the command is received, prepare to enter low power consumption, set the sleep time and wake-up method, and enter sleep mode; S7, the MCU enters low power consumption and waits for wake-up. If the MCU wakes up, it returns to step S1.

2. A low power consumption management and control method based on state mode according to claim 1, characterized in that: In step S1, when the single-chip microcomputer device is used for the first time, all variables are initialized.

3. The low power consumption management and control method based on state mode according to claim 1, characterized in that: In step S2, the single-chip microcomputer device is awakened and used to initialize some variables that do not need to be retained.

4. The low power consumption management and control method based on state mode according to claim 1, characterized in that: In step S4, during the running of the program, when the peripheral devices of the single-chip microcomputer are controlled, the operation time of the peripheral devices is shortened and the number of operations on the peripheral devices is reduced; After the work is completed, the operation is concluded and the called peripheral devices are initialized; When a long wait is required, the microcontroller can be controlled to enter a low-power, short-term sleep or pause mode to reduce the power consumption of the microcontroller.

5. The low power consumption management and control method based on state mode according to claim 1, characterized in that: In step S6, before the program enters low power consumption, the variables that need to be retained are retained, and the operation instructions that are not retained are initialized; Determine the device wake-up status based on the retained variable value.

6. The low power consumption management and control method based on state mode according to claim 1, characterized in that: In step S6, when the single-chip microcomputer enters the low power consumption state, the single-chip microcomputer enters the low power mode, stops the CPU, keeps the clock running, and determines whether it is necessary to start the program running through the register.