1. Technical Field
The present disclosure relates to electronic devices, and more particularly to a method for saving energy used by the electronic devices.
2. Description of Related Art
A typical electronic device often enters a sleep mode, for energy saving, such that CPU clock frequency is decreased, and peripheral devices connected to the CPU are disabled, when the typical electronic device is not being used. At the same time, for the sake of interrupt requests capable of being monitored by the typical electronic device in the sleep mode, an interrupt monitoring program is stored in a dynamic memory connected to the CPU, and the dynamic memory remains in an auto-refresh mode. However, the dynamic memory in the auto-refresh mode still consumes a great deal of energy.
Therefore, there is room for improvement in the art.
Many aspects of the embodiments can be better understood with references to the following drawings. The components in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the embodiments. Moreover, in the drawings, like reference numerals designate corresponding parts throughout two views.
The disclosure is illustrated by way of example and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean at least one.
Referring to
The dynamic memory 110 includes an auto-refresh mode and a self-refresh mode, and is capable of switching between the auto-refresh mode and the self-refresh mode. Energy consumed by the dynamic memory 110 in the auto-refresh mode is greater than that in the self-refresh mode. The dynamic memory 110 is used for storing an interrupt monitoring program. The interrupt monitoring program is used for monitoring whether an interrupt request is generated, and generating an interrupt signal when the interrupt request is generated. A default mode of the dynamic memory 110 is the auto-refresh mode. The dynamic memory 110 may be a SDRAM.
The CPU 120 often integrates a static memory 122 thereinto. The static memory 122 can be used as a buffer memory when the CPU performs a task. The static memory 122 may be a SRAM.
The detection unit 130 is used for detecting whether the electronic device 100 is needed to enter the sleep mode; and generating a detection signal when it is determined that the electronic device 100 is needed to enter the sleep mode. In the embodiment, the detection unit 130 is a key arranged on the electronic device 100, and when the key is pressed, the detection signal is generated.
The copy unit 140 is used for copying the interrupt monitoring program from the dynamic memory 110 to the static memory 122 in response to the detection signal, and running the interrupt monitoring program in the static memory 122 for monitoring whether an interrupt request is generated.
The set unit 150 is adapted to set the dynamic memory 110 in the self-refresh mode in response to the detection signal, and backup current system parameters of the dynamic memory 110 and the electronic device 100, thus the electronic device 100 enters the sleep mode. Because the energy consumed by the dynamic memory 110 in the auto-refresh mode is greater than that in the self-refresh mode, the electronic device 100 can use less energy than the typical electronic device.
The set unit 150 is further used for responding to the interrupt signal to set the dynamic memory 110 into the auto-refresh mode, and recover the backup system parameters of the dynamic memory 110 and the electronic device 100 such that the electronic device 100 enters the normal mode responding to the interrupt request.
The deletion unit 160 is used for responding to the interrupt signal to delete the interrupt monitoring program from the static memory 122, such that a running speed of the CPU 120 is not decreased because of the interrupt monitoring program stored in the static memory 122.
Referring to
In step S801, it is detected whether an electronic device is needed to enter the sleep mode. If the electronic device is needed to enter the sleep mode, step S803 is implemented. If the electronic device is not needed to enter the sleep mode, step S801 is repeated. In the embodiment, the electronic device 100 arranges a key thereon, and when the key is pressed, the electronic device enters the sleep mode.
In step S803, the interrupt monitoring program is copied from the dynamic memory to the static memory, and the interrupt monitoring program in the static memory is run to monitor whether an interrupt request is generated when the electronic device enters the sleep mode.
In step S805, the dynamic memory is set in the self-refresh mode, current system parameters of the dynamic memory and the electronic device are backed up, and then the electronic device enters the sleep mode. Because the energy consumed by the dynamic memory in the auto-refresh mode is greater than in the self-refresh mode, the electronic device using the above method can save more energy than the typical electronic device.
In step S807, it is determined whether an interrupt request is generated. If it is determined that the interrupt request is generated, step S809 is implemented. If it is determined that the interrupt request is not generated, step S807 is repeated.
In step S809, the dynamic memory is set in the auto-refresh mode, and the backup system parameters of the dynamic memory and the electronic device is recovered such that the electronic device enters the normal mode for responding to the interrupt request.
In step S811, the interrupt monitoring program is deleted from the static memory, such that a running speed of the CPU is not decreased because of the interrupt monitoring program stored in the static memory.
It is to be understood, even though information and advantages of the present embodiments have been set forth in the foregoing description, together with details of the structures and functions of the present embodiments, the disclosure is illustrative only; and that changes may be made in detail, especially in matters of shape, size, and arrangement of parts within the principles of the present embodiments to the full extent indicated by the broad general meaning of the terms in which the appended claims are expressed.
Number | Date | Country | Kind |
---|---|---|---|
201010279657.8 | Sep 2010 | CN | national |