A sleep mode control method and electronic device
By sending sleep command packets and processing sleep flag data on the CAN bus between MCUs of electronic devices, the problem of increased power consumption caused by the inability to enter sleep mode in time in the existing technology is solved, and the MCU power consumption is reduced and energy is saved. effect.
Patent Information
- Application Number
- CN202110767847.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-07
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-07-07
AI Technical Summary
The existing sleep mode control methods of medical device products require manual operation or rely on external environment detection, resulting in the inability to enter sleep mode in time, resulting in a significant increase in power consumption of the device.
By sending sleep command packets on the CAN bus between the microcontroller MCU of the electronic device's driver board, central control board and key board, write the sleep flag data to the backup register, reset the MCU, and configure the IO port function according to the sleep mode , when the CAN line is interrupted, write the non-sleep flag data to initialize the non-sleep mode.
Effectively reduce the power consumption of the MCU when it is in sleep mode, reduce the power consumption of electronic devices, and save energy.
Smart Images

Figure CN113517061B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a sleep mode control method and electronic device. Background Art
[0002] At present, there are two main methods for controlling the sleep mode of medical devices: one is for the user to manually set it to sleep mode, which requires manual operation, is inconvenient and may cause discomfort due to forgetting the operation; the other is to determine whether to enter sleep control by detecting the external environment. This method will obviously lead to inevitable misjudgment due to weather reasons or room shading effects, and the device cannot enter sleep mode in time, resulting in a significant increase in power consumption.
[0003] Application Contents
[0004] The purpose of the embodiments of the present application is to provide a sleep mode control method and electronic device, which can solve the problem of increased power consumption of the device due to the inability to enter the sleep mode in time in the prior art.
[0005] In order to solve the above technical problems, this application is implemented as follows:
[0006] In a first aspect, a sleep mode control method is provided, which is applied to an electronic device having a driver board, a central control board and a key board, wherein the microcontroller MCU of the driver board, the MCU of the central control board and the MCU of the key board are all mounted on a controller area network CAN bus, and the method comprises the following steps:
[0007] When the driver board does not receive a heartbeat data packet or a key data packet within a first preset time period, the driver board sends a sleep instruction packet to each MCU on the CAN bus, writes sleep flag data to its own backup register, and resets its own MCU;
[0008] After the MCU in the driver board is reset, the driver board reads the backup register through the MCU, and if the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode;
[0009] When a CAN line interruption occurs, the driver board writes non-sleep flag data to its own backup register and resets its own MCU;
[0010] After the MCU in the driving board is reset, the driving board initializes a non-sleep mode through the MCU.
[0011] In a second aspect, an electronic device is provided, comprising a driving board, a central control board and a key board, wherein the microcontroller MCU of the driving board, the MCU of the central control board and the MCU of the key board are all mounted on a controller area network CAN bus;
[0012] Wherein, the driving board is used for:
[0013] When the driver board does not receive a heartbeat data packet or a key data packet within a first preset time, it sends a sleep instruction packet to each MCU on the CAN bus, writes sleep flag data to its own backup register, and resets its own MCU;
[0014] After the MCU in the driver board is reset, the backup register is read by the MCU, and if the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode;
[0015] When a CAN line interruption occurs, the non-sleep flag data is written to its own backup register and its own MCU is reset;
[0016] After the MCU in the driving board is reset, the non-sleep mode is initialized by the MCU.
[0017] In a third aspect, an electronic device is provided, which includes a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the method described in the first aspect.
[0018] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0019] The embodiment of the present application switches the MCU to sleep mode by writing sleep flag data to the backup register and configures the functions of the MCU's IO ports according to the sleep mode, which can reduce the power consumption of the MCU when it is in sleep mode, reduce the power consumption of electronic devices, and thus save energy. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a flow chart of a sleep mode control method provided in an embodiment of the present application;
[0021] Figure 2 This is a flowchart of a specific implementation method of the sleep mode control method provided in an embodiment of the present application;
[0022] Figure 3 is another specific implementation flow chart of the sleep mode control method provided in the embodiment of the present application;
[0023] Figure 4 This is another specific implementation flow chart of the sleep mode control method provided in the embodiment of the present application;
[0024] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] The sleep mode control method provided in the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0027] like Figure 1 As shown, it is a flow chart of a sleep mode control method provided in an embodiment of the present application. The method is applied to an electronic device having a driving board, a central control board and a key board. The MCU (Micro Controller Unit) of the driving board, the MCU of the central control board and the MCU of the key board are all mounted on a CAN (Controller Area Network) bus. The method includes the following steps:
[0028] Step 101, when the driver board does not receive a heartbeat data packet or a key data packet within a first preset time period, the driver board sends a sleep instruction packet to each MCU on the CAN bus, writes sleep flag data to its own backup register, and resets its own MCU.
[0029] Step 102, after the MCU in the driver board is reset, the driver board reads the backup register through the MCU, and if the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode.
[0030] Step 103, when a CAN line interruption occurs, the driver board writes non-sleep flag data to its own backup register and resets its own MCU.
[0031] Step 104: After the MCU in the driver board is reset, the driver board initializes the non-sleep mode through the MCU.
[0032] The embodiment of the present application switches the MCU to sleep mode by writing sleep flag data to the backup register and configures the functions of the MCU's IO ports according to the sleep mode, which can reduce the power consumption of the MCU when it is in sleep mode, reduce the power consumption of electronic devices, and thus save energy.
[0033] like Figure 2 As shown, it is a flowchart of a specific implementation method of the sleep mode control method provided in an embodiment of the present application, which is applied to an electronic device having a driving board, a central control board and a key board. The method includes the following steps:
[0034] Step 201 , the driver board determines whether a heartbeat data packet or a key data packet is received within a first preset time period, if yes, execute step 202 ; otherwise, execute step 203 .
[0035] Among them, the first preset duration can be 2 minutes.
[0036] Step 202: The driver board sends device status information.
[0037] Specifically, when the driver board receives a heartbeat data packet or a key data packet from the central control board within a preset time, the driver board sends device status information to the central control board; when the driver board receives a heartbeat data packet or a key data packet from the key board within a preset time, the driver board sends device status information to the key board.
[0038] Among them, the device status information includes lock status, AC / DC power supply mode, angle information and height information.
[0039] It should be noted that, for electronic devices with a central control board, the driver board can send device status information driven by a heartbeat data packet or a key data packet; for electronic devices without a central control board, the driver board can also actively send status data information.
[0040] Step 203: the driver board sends a sleep instruction packet to each MCU on the CAN bus, writes sleep flag data to its own backup register, and resets its own MCU.
[0041] Among them, the MCU of the driver board, the MCU of the central control board and the MCU of the key board are all mounted on the CAN bus.
[0042] Step 204, after the MCU in the driver board is reset, the driver board reads the backup register through the MCU, and if the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode.
[0043] Specifically, when the MCU of the driver board reads the sleep flag data from the backup register, the driver board turns off the MCU's CAN data transmission function, so that the MCU is only in the data receiving state, so as to reduce the power consumption of the MCU when it is in sleep mode; the driver board also configures the pins in the MCU responsible for receiving CAN signals to line interrupt mode, and can wake up the MCU when there is data on the CAN bus. In this embodiment, the driver board can set the pins in the MCU responsible for receiving CAN signals to the IO port interrupt function of a normal MCU; accordingly, when the MCU is in sleep mode, it can respond to IO port line interrupts, but cannot respond to CAN receive interrupts.
[0044] Step 205: When a CAN line interruption occurs, the driver board writes non-sleep flag data to its own backup register and resets its own MCU.
[0045] Step 206: After the MCU in the driver board is reset, the driver board quickly initializes the non-sleep mode through the MCU.
[0046] The embodiment of the present application switches the MCU to sleep mode by writing sleep flag data to the backup register and configures the functions of the MCU's IO ports according to the sleep mode, which can reduce the power consumption of the MCU when it is in sleep mode, reduce the power consumption of electronic devices, and thus save energy.
[0047] like Figure 3 As shown, it is a flowchart of another specific implementation method of the sleep mode control method provided in the embodiment of the present application, which is applied to an electronic device having a driving board, a central control board and a key board. The method includes the following steps:
[0048] Step 301: the central control board sends a heartbeat data packet to the driving board every second preset time period, and sends a key data packet to the driving board when detecting a user operation on a key on the central control board.
[0049] The second preset duration may be 1 second.
[0050] In step 302, when the central control board receives a sleep instruction packet from the driver board, or does not receive device status information from the driver board within a third preset time period, the central control board writes sleep flag data to its own backup register and resets its own MCU.
[0051] Among them, the third preset time length can be 3 seconds, and the device status information includes lock status, AC / DC power supply mode, angle information and height information, etc.
[0052] Step 303, after the MCU in the central control board is reset, the central control board reads the backup register through the MCU, and if the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode.
[0053] Specifically, when the MCU of the central control board reads the sleep flag data from the backup register, the central control board turns off the MCU's CAN data transmission function, so that the MCU is only in the data receiving state, so as to reduce the power consumption of the MCU when it is in sleep mode; the central control board also configures the pins responsible for receiving CAN signals and the pins responsible for key input in the MCU to line interrupt mode, and can wake up the MCU when there is data on the CAN bus. In this embodiment, the central control board can set the pins responsible for receiving CAN signals and the pins responsible for key input in the MCU to the IO port interrupt function of the ordinary MCU; accordingly, when the MCU is in sleep mode, it can respond to the IO port line interrupt, but cannot respond to the CAN receive interrupt.
[0054] Step 304: When a CAN line interruption or a key line interruption occurs, the central control board writes non-sleep flag data to its own backup register and resets its own MCU.
[0055] Step 305, after the MCU in the central control board is reset, the central control board quickly initializes the non-sleep mode through the MCU, sends an invalid data packet to the CAN bus, and sends a key data packet to the driver board when detecting the user's operation on the key on the central control board.
[0056] The invalid data packet sent to the CAN bus is used to trigger the MCU in sleep mode mounted on the CAN bus in broadcast mode, and the MCU can be awakened by a line interrupt.
[0057] The embodiment of the present application switches the MCU to sleep mode by writing sleep flag data to the backup register and configures the functions of the MCU's IO ports according to the sleep mode, which can reduce the power consumption of the MCU when it is in sleep mode, reduce the power consumption of electronic devices, and thus save energy.
[0058] like Figure 4 As shown, it is a flowchart of another specific implementation method of the sleep mode control method provided in the embodiment of the present application, which is applied to an electronic device having a driving board, a central control board and a key board. The method includes the following steps:
[0059] Step 401: When the keypad detects that a user operates a key on the keypad, the keypad sends a key data packet to the driver board.
[0060] Step 402, when the keypad receives a sleep instruction packet from the driver board, or the keypad does not receive device status information from the driver board within a third preset time period, the keypad writes sleep flag data to its own backup register and resets its own MCU.
[0061] Among them, the third preset time length can be 3 seconds, and the device status information includes lock status, AC / DC power supply mode, angle information and height information, etc.
[0062] Step 403, after the MCU in the keypad is reset, the keypad reads the backup register through the MCU, and if the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode.
[0063] Specifically, when the MCU of the keypad reads the sleep flag data from the backup register, the keypad turns off the MCU's CAN data transmission function, so that the MCU is only in the data receiving state, so as to reduce the power consumption of the MCU when it is in sleep mode; the keypad also configures the pins responsible for receiving CAN signals and the pins responsible for key input in the MCU to line interrupt mode, and can wake up the MCU when there is data on the CAN bus. In this embodiment, the keypad can set the pins responsible for receiving CAN signals and the pins responsible for key input in the MCU to the IO port interrupt function of a normal MCU; accordingly, when the MCU is in sleep mode, it can respond to IO port line interrupts, but cannot respond to CAN receive interrupts.
[0064] Step 404: When a CAN line interruption or a key line interruption occurs, the keypad writes non-sleep flag data to its own backup register and resets its own MCU.
[0065] Step 405, after the MCU in the keypad is reset, the keypad quickly initializes the non-sleep mode through the MCU, sends an invalid data packet to the CAN bus, and sends a key data packet to the driver board when detecting the user's operation on the key on the keypad.
[0066] The invalid data packet sent to the CAN bus is used to trigger the MCU in sleep mode mounted on the CAN bus in broadcast mode, and the MCU can be awakened by a line interrupt.
[0067] The embodiment of the present application switches the MCU to sleep mode by writing sleep flag data to the backup register and configures the functions of the MCU's IO ports according to the sleep mode, which can reduce the power consumption of the MCU when it is in sleep mode, reduce the power consumption of electronic devices, and thus save energy.
[0068] The scope of the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
[0069] like Figure 5, which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, includes a driving board 510, a central control board 520 and a key board 530, wherein the MCU of the driving board 510, the MCU of the central control board 520 and the MCU of the key board 530 are all mounted on the CAN bus;
[0070] The driving board 510 is used for:
[0071] When the driver board 510 does not receive a heartbeat data packet or a key data packet within a first preset time period, it sends a sleep instruction packet to each MCU on the CAN bus, writes sleep flag data to its own backup register, and resets its own MCU;
[0072] After the MCU in the driver board 510 is reset, the backup register is read by the MCU. If the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode.
[0073] When a CAN line interruption occurs, the non-sleep flag data is written to its own backup register and its own MCU is reset;
[0074] After the MCU in the driving board 510 is reset, the non-sleep mode is initialized by the MCU.
[0075] In addition, the drive board 510 is also used for:
[0076] When the driving board 510 receives a heartbeat data packet or a key data packet within a first preset time period, the device status information is sent.
[0077] The device status information includes lock status, AC / DC power supply mode, angle information and height information.
[0078] The central control panel 520 is used for:
[0079] After receiving the sleep instruction packet from the driver board 510, write the sleep flag data to its own backup register and reset its own MCU;
[0080] After the MCU in the central control board 520 is reset, the backup register is read by the MCU. If the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode.
[0081] When a CAN line interruption or a key line interruption occurs, the non-sleep flag data is written to its own backup register and its own MCU is reset;
[0082] After the MCU in the central control board 520 is reset, an invalid data packet is sent to the CAN bus, and when a user operation on a key on the central control board 520 is detected, a key data packet is sent to the driving board 510 .
[0083] The keypad 530 is used for:
[0084] After receiving the sleep instruction packet from the driver board 510, write the sleep flag data to its own backup register and reset its own MCU;
[0085] After the MCU in the keypad 530 is reset, the backup register is read by the MCU. If the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode.
[0086] When a CAN line interruption or a key line interruption occurs, the non-sleep flag data is written to its own backup register and its own MCU is reset;
[0087] After the MCU in the keypad 530 is reset, an invalid data packet is sent to the CAN bus, and when a user operation on a key on the keypad 530 is detected, a key data packet is sent to the driving board 510 .
[0088] The embodiment of the present application switches the MCU to sleep mode by writing sleep flag data to the backup register and configures the functions of the MCU's IO ports according to the sleep mode, which can reduce the power consumption of the MCU when it is in sleep mode, reduce the power consumption of electronic devices, and thus save energy.
[0089] The electronic device in the embodiments of the present application may be a terminal, or a component or a chip in the terminal. The electronic device may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device may be a server, a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiments of the present application.
[0090] The electronic device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0091] The electronic device provided in the embodiment of the present application can achieve Figures 1 to 3 To avoid repetition, the various processes implemented by the electronic device in the method embodiment are not described here.
[0092] Optionally, an embodiment of the present application also provides an electronic device, including a processor, a memory, and a program stored in the memory and executable on the processor. When the program is executed by the processor, the various processes of the above-mentioned sleep mode control method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0093] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the control method of the sleep mode described above is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0094] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0095] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0096] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A sleep mode control method, characterized in that: Applicable to an electronic device having a driving board, a central control board and a key board, the microcontroller MCU of the driving board, the MCU of the central control board and the MCU of the key board are all mounted on a controller area network CAN bus, and the method comprises the following steps: When the driver board does not receive a heartbeat data packet or a key data packet within a first preset time period, the driver board sends a sleep instruction packet to each MCU on the CAN bus, writes sleep flag data to its own backup register, and resets its own MCU; After the MCU in the driver board is reset, the driver board reads the backup register through the MCU, and if the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode; When a CAN line interruption occurs, the driver board writes non-sleep flag data to its own backup register and resets its own MCU; After the MCU in the driving board is reset, the driving board initializes a non-sleep mode through the MCU.
2. The method according to claim 1, characterized in that Also includes: When the driver board receives a heartbeat data packet or a key data packet within a first preset time period, the driver board sends device status information.
3. The method according to claim 2, characterized in that The device status information includes locking status, AC / DC power supply mode, angle information and height information.
4. The method according to claim 1, characterized in that: After the driver board sends a sleep instruction packet to each MCU on the CAN bus, the method further includes: The central control board writes sleep flag data to its own backup register and resets its own MCU; After the MCU in the central control board is reset, the central control board reads the backup register through the MCU of the central control board, and if the sleep flag data is read, the function of the IO port of the MCU of the central control board is configured according to the sleep mode; When a CAN line interruption or a key line interruption occurs, the central control board writes non-sleep flag data to its own backup register and resets its own MCU; After the MCU in the central control board is reset, the central control board sends an invalid data packet to the CAN bus, and sends a key data packet to the driving board when detecting a user's operation on a key on the central control board.
5. The method according to claim 1, characterized in that After the driver board sends a sleep instruction packet to each MCU on the CAN bus, the method further includes: The keypad writes sleep flag data to its own backup register and resets its own MCU; After the MCU in the keypad is reset, the keypad reads the backup register through the MCU, and if the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode; When a CAN line interruption or a key line interruption occurs, the key board writes non-sleep flag data to its own backup register and resets its own MCU; After the MCU in the keypad is reset, the keypad sends an invalid data packet to the CAN bus, and sends a key data packet to the driving board when detecting a user's operation on a key on the keypad.
6. An electronic device, characterized in that: It includes a driving board, a central control board and a key board, wherein the MCU of the driving board, the MCU of the central control board and the MCU of the key board are all mounted on the CAN bus; Wherein, the driving board is used for: When the driver board does not receive a heartbeat data packet or a key data packet within a first preset time, it sends a sleep instruction packet to each MCU on the CAN bus, writes sleep flag data to its own backup register, and resets its own MCU; After the MCU in the driver board is reset, the backup register is read by the MCU, and if the sleep flag data is read, the function of the IO port of the MCU is configured according to the sleep mode; When a CAN line interruption occurs, the non-sleep flag data is written to its own backup register and its own MCU is reset; After the MCU in the driving board is reset, the non-sleep mode is initialized by the MCU.
7. The electronic device according to claim 6, characterized in that: The driver board is also used for: When the driver board receives a heartbeat data packet or a key data packet within a first preset time period, the device status information is sent.
8. The electronic device according to claim 7, characterized in that: The device status information includes locking status, AC / DC power supply mode, angle information and height information.
9. The electronic device according to claim 6, characterized in that: The central control panel is used for: After receiving the sleep instruction packet from the driver board, write the sleep flag data to its own backup register and reset its own MCU; After the MCU in the central control board is reset, the backup register is read by the MCU of the central control board. If the sleep flag data is read, the function of the IO port of the MCU of the central control board is configured according to the sleep mode; When a CAN line interruption or a key line interruption occurs, the non-sleep flag data is written to its own backup register and its own MCU is reset; After the MCU in the central control board is reset, an invalid data packet is sent to the CAN bus, and when a user operation on a key on the central control board is detected, a key data packet is sent to the driving board.
10. The electronic device according to claim 6, characterized in that: The keypad is used for: After receiving the sleep instruction packet from the driver board, write the sleep flag data to its own backup register and reset its own MCU; After the MCU in the keypad is reset, the backup register is read by the MCU of the keypad, and if the sleep flag data is read, the function of the IO port of the MCU of the keypad is configured according to the sleep mode; When a CAN line interruption or a key line interruption occurs, the non-sleep flag data is written to its own backup register and its own MCU is reset; After the MCU in the keypad is reset, an invalid data packet is sent to the CAN bus, and when a user operation on a key on the keypad is detected, a key data packet is sent to the driving board.
