Battery status determination method, device, electronic device, and storage medium
By comprehensively analyzing multiple register values in the power management chip to determine the battery's charge and discharge status, the problem of misjudgment of the battery status is solved, and a more accurate battery status judgment is achieved.
Patent Information
- Application Number
- CN202011447708.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-11
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2040-12-11
AI Technical Summary
In the prior art, when a power management chip, battery and/or related circuits fail, it is easy to cause status information in the battery status register to be erroneous, making it impossible to accurately determine the battery status.
The charge and discharge status of the battery is determined by comprehensively analyzing the register values of the current current register, the remaining capacity register and the battery status register in the power management chip.
The accuracy of battery status determination is improved, and misjudgment of battery status due to battery status register errors is avoided.
Smart Images

Figure CN114624595B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic equipment, and in particular to a method and device for determining a battery status, an electronic device, and a storage medium. Background Art
[0002] Electronic devices primarily manage their batteries through power management chips, controlling the battery's charge and discharge processes. Electronic devices can obtain power status information by reading the Battery Status register in the power management chip and determine whether the battery is charging, discharging, or fully charged based on this information.
[0003] In the prior art, when a power management chip, battery and / or related circuits fail, it is easy to cause status information in the battery status register to be erroneous, thereby causing the electronic device to be unable to accurately determine the battery status. Summary of the Invention
[0004] In view of the above problems, an embodiment of the present invention is proposed to provide a battery status determination method that overcomes the above problems or at least partially solves the above problems, so as to solve the problem that the battery status cannot be accurately determined when a power management chip, power supply and / or related circuits fail.
[0005] Correspondingly, an embodiment of the present invention further provides a battery status determination device, an electronic device, and a storage medium to ensure the implementation and application of the above method.
[0006] In order to solve the above problem, an embodiment of the present invention discloses a method for determining a battery status, comprising:
[0007] determining a first battery state according to a register value of a current current register corresponding to the battery;
[0008] determining a second battery state according to a register value of the remaining capacity register;
[0009] determining a third battery state according to a register value of the battery state register;
[0010] A charge and discharge state of the battery is determined according to the first battery state, the second battery state, and the third battery state.
[0011] The embodiment of the present invention further discloses a battery status determination device, comprising:
[0012] A first determining module, configured to determine a first battery state according to a register value of a current current register corresponding to the battery;
[0013] a second determining module, configured to determine a second battery state according to a register value of the remaining capacity register;
[0014] a third determining module, configured to determine a third battery state according to a register value of the battery state register;
[0015] A fourth determining module is configured to determine a charge and discharge state of the battery according to the first battery state, the second battery state, and the third battery state.
[0016] An embodiment of the present invention further discloses an electronic device comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:
[0017] Read the current register corresponding to the battery to obtain the first battery status;
[0018] determining a second battery state according to a register value of the remaining capacity register;
[0019] Read the battery status register to obtain the third battery status;
[0020] A charge and discharge state of the battery is determined according to the first battery state, the second battery state, and the third battery state.
[0021] An embodiment of the present invention further discloses a readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute one or more battery status determination methods described in the embodiment of the present invention.
[0022] The embodiments of the present invention include the following advantages:
[0023] In an embodiment of the present invention, a first battery state is determined based on the register value of a current current register corresponding to the battery, a second battery state is determined based on the register value of a remaining capacity register, a third battery state is determined based on the register value of a battery status register, and the charge and discharge state of the battery is determined based on the first battery state, the second battery state, and the third battery state. By comprehensively analyzing the register value of the current current register, the register value of the remaining capacity register, and the register value of the battery status register to determine the charge and discharge state of the battery, compared to the prior art method of determining the charge and discharge state of the battery based solely on the register value of the battery status register, the problem of being unable to accurately determine the charge and discharge state of the battery when the status information in the battery status register is erroneous can be avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1A flowchart showing the steps of an embodiment of a method for determining a battery status of the present invention is shown;
[0025] Figure 2 A structural block diagram of an embodiment of a battery status determination device of the present invention is shown;
[0026] Figure 3 The figure is a structural block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0027] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] Before describing the embodiments of the present invention in detail, the current method for determining the battery status is first introduced.
[0029] Existing methods for determining battery status: Batteries in electronic devices are primarily managed by a power management chip, which controls the battery's charging and discharging processes, monitors the battery's status, and stores battery status information in a battery status register. Electronic devices can determine whether the battery is in a charging state, a discharging state, or a fully charged state based on the register value of the battery status register in the power management chip. When determining the battery status based solely on the register value of the battery status register, if the power management chip, battery, and related circuits are affected by external temperature, the register value of the battery status register can easily be incorrect, causing the electronic device to read an incorrect register value, which in turn prevents the electronic device from accurately determining the battery status.
[0030] One of the core concepts of the embodiment of the present invention is to comprehensively analyze the register value of the current current register, the register value of the remaining capacity register and the register value of the battery status register in the power management chip to determine the charge and discharge status of the battery.
[0031] Reference Figure 1 , shows a flowchart of a method for determining a battery status according to an embodiment of the present invention, which may specifically include the following steps:
[0032] Step 101: Determine a first battery state according to a register value of a current register corresponding to the battery.
[0033] Among them, the current value of the battery terminal is stored in the current register. When the register value of the current register is a positive value, it indicates that the battery is charging and the battery is in a charging state; when the register value of the current register is a negative value, it indicates that the battery is discharging and the battery state is a discharging state; when the register value of the current register is 0, it indicates that the battery is neither charging nor discharging, that is, the battery state is fully charged.
[0034] Optionally, step 101 may be implemented as follows:
[0035] Read the current register corresponding to the battery to obtain the value of the third register;
[0036] When the third register value is positive, determining that the first battery state is a charging state;
[0037] When the third register value is a negative value, determining that the first battery state is a discharge state;
[0038] When the third register value is 0, it is determined that the first battery state is a fully charged state.
[0039] In this embodiment, the electronic device can read the current current register to obtain the third register value stored in the current current register, so that the first battery state can be determined based on the third register value. For example, after reading the third register value, if the third register value is greater than 0 (a positive value), the first battery state is determined to be a charging state; if the third register value is less than 0 (a negative value), the first battery state is determined to be a discharging state; and when the third register value is equal to 0, the first battery state is determined to be a fully charged state. Among them, the process of reading the register value of the current current register can be set according to demand, and this embodiment does not limit this.
[0040] Step 102: Determine a second battery state according to the register value of the remaining capacity register.
[0041] The remaining capacity (RemainingCapacity) register stores the current remaining capacity of the battery. The battery state, ie, the second battery state, can be determined according to the change state of the current remaining capacity of the battery.
[0042] Optionally, step 102 may be implemented as follows:
[0043] Reading the remaining capacitance register at least twice to obtain at least two first register values;
[0044] When the values of the first registers gradually increase in the reading order, determining that the second battery state is a charging state;
[0045] When the values of the first registers gradually decrease in the order in which they are read, determining that the second battery state is a discharge state;
[0046] When the values of the first registers do not change according to the reading sequence, it is determined that the second battery state is a fully charged state.
[0047] In this embodiment, the electronic device can read the register value of the remaining capacity register multiple times at different time points to obtain the first register value at different time points. For example, the electronic device can read the remaining capacity register for the first time at the first second to obtain a first register value, and read the remaining capacity register for the second time at the third second to obtain another first register value. The time interval between two adjacent readings of the remaining capacity register can be set as required, for example, to 1 second, 3 seconds, or 5 seconds. The number of times the remaining capacity register is read can be set as required, and this embodiment does not impose any restrictions on this.
[0048] When multiple first register values are obtained, the electronic device can determine the second battery state based on the change state of the first register value, that is, the change state of the battery's current remaining capacity. For example, if the first register value read for the first time is 50 and the first register value read for the second time is 70, it can be determined that the first register value gradually increases in the reading order, that is, the battery's current remaining capacity continues to increase, and the second battery state can be determined to be a charging state. On the contrary, if the first register value read for the first time is 80 and the first register value read for the second time is 60, it can be determined that the first register value gradually decreases in the reading order, that is, the battery's current remaining capacity continues to decrease, and the second battery state can be determined to be a discharging state. Similarly, if the first register value read for the first time is 80 and the first register value read for the second time is also 80, it can be determined that the first register value does not change in the reading order, that is, the battery's current remaining capacity is constant, and the second battery state can be determined to be a fully charged state.
[0049] Step 103: Determine a third battery status according to the register value of the battery status register.
[0050] Among them, the battery status register is a 16-bit register. In the battery status register, when the fifth bit (bit5) is 1, it indicates that the battery status is fully charged; when the sixth bit (bit6) is 1, it indicates that the battery status is discharged; when both bit5 and bit6 are not 1, it indicates that the battery status is charged.
[0051] Optionally, step 103 may be implemented as follows:
[0052] Read the battery status register to obtain the fourth register value;
[0053] When the fifth bit and the sixth bit of the fourth register value are both not 1, determining that the third battery state is a charging state;
[0054] When the sixth bit of the fourth register value is 1, determining that the third battery state is a discharge state;
[0055] When the fifth bit of the fourth register value is 1, it is determined that the third battery state is a fully charged state.
[0056] In this embodiment, the electronic device can read the battery status register to obtain the fourth register value. When the fifth bit and the sixth bit of the fourth register value are both not 1, the third battery status is determined to be a charging state. When the sixth bit of the fourth register value is 1, the third battery status is determined to be a discharging state. When the fifth bit of the fourth register value is 1, the third battery status is determined to be a fully charged state. The process of the electronic device reading the battery status register can be set as needed and is not limited in this embodiment.
[0057] Step 104: Determine the charge and discharge status of the battery according to the first battery status, the second battery status, and the third battery status.
[0058] In this embodiment, after determining the first battery state, the second battery state, and the third battery state, the battery charge and discharge state can be determined by combining the first battery state, the second battery state, and the third battery state. The current value of the battery terminal is stored in the current current register, the battery's current remaining capacity is stored in the remaining capacity register, and the battery status register stores the battery status information determined by the battery management chip. The battery charge and discharge state is determined based on the first battery state, the second battery state, and the third battery state. The battery charge and discharge state can be determined by comprehensively analyzing the current value of the battery terminal, the battery's current remaining capacity, and the battery's current status information. Compared to the prior art method of determining the battery charge and discharge state based solely on the register value of the battery status register, this method can avoid the problem of being unable to accurately determine the battery charge and discharge state when the status information in the battery status register is erroneous.
[0059] For example, step 104 may be implemented as follows:
[0060] determining that the battery is in a charging state when at least two of the first battery state, the second battery state, and the third battery state are charging states;
[0061] determining that the battery is in a discharging state when at least two of the first battery state, the second battery state, and the third battery state are in a discharging state;
[0062] When at least two of the first battery state, the second battery state, and the third battery state are fully charged states, it is determined that the battery is in the fully charged state.
[0063] For example, the electronic device can determine that the battery is in a charging state when the first battery state and the second battery state are charging states, or determine that the battery is in a charging state when the first battery state, the second battery state and the third battery state are all charging states, or determine that the battery is in a charging state when the second battery state and the third battery state are charging states.
[0064] Similarly, the electronic device can determine that the battery is in a discharging state when the first battery state and the second battery state are in a discharging state, or determine that the battery is in a discharging state when the first battery state, the second battery state and the third battery state are all in a discharging state, or determine that the battery is in a discharging state when the second battery state and the third battery state are in a discharging state.
[0065] Similarly, the electronic device can determine that the battery is fully charged when the first battery status and the second battery status are fully charged, or determine that the battery is fully charged when the first battery status, the second battery status and the third battery status are all fully charged, or determine that the battery is fully charged when the second battery status and the third battery status are fully charged.
[0066] Optionally, step 104 may further include:
[0067] When the first battery state, the second battery state, and the third battery state simultaneously include a charging state, a discharging state, and a fully charged state, it is determined that the battery is in the second battery state.
[0068] In this embodiment, when the first battery state, the second battery state, and the third battery state all include a charging state, a discharging state, and a fully charged state, the battery is determined to be in the second battery state. That is, when the first battery state, the second battery state, and the third battery state are different battery states, the second battery state shall prevail. For example, if the first battery state is a charging state, the second battery state is a discharging state, and the third battery state is a fully charged state, the battery is determined to be in the discharging state.
[0069] In actual applications, the second battery status is determined based on the change in the remaining capacity. Compared with the first battery status and the third battery status, the second battery status is more accurate. When the battery status cannot be determined based on the first battery status, the second battery status and the third battery status, the accuracy of the battery status can be improved based on the second battery status.
[0070] For example, step 104 may also be implemented in the following manner:
[0071] When the first battery state, the second battery state, and the third battery state are the same battery state, determining that the batteries are in the same battery state;
[0072] When different battery states are included among the first battery state, the second battery state, and the third battery state, it is determined that the battery is in the second battery state.
[0073] In this embodiment, when the first battery status, the second battery status, and the third battery status are the same battery status, it can be determined that there are no external factors affecting the battery status, and the first battery status, the second battery status, and the third battery status are all accurate battery statuses. In this case, it can be determined that the batteries are in the same battery status. For example, if the first battery status, the second battery status, and the third battery status are all charging states, it can be determined that the batteries are in a charging state.
[0074] On the contrary, when the first battery status, the second battery status, and the third battery status include different battery states, it can be determined that there is an external factor affecting the battery, and one of the first battery status, the second battery status, and the third battery status may be inaccurate. In this case, the second battery status can be used as the standard. For example, when the first battery status and the third battery status are charging states, and the second battery status is discharging state, it can be determined that the battery is in the discharging state.
[0075] In actual applications, when there may be an inaccurate battery status among the first battery status, the second battery status, and the third battery status, the accuracy of the battery status may be improved by taking the second battery status as the standard.
[0076] In an embodiment of the present invention, a first battery state is determined based on the register value of a current current register corresponding to the battery, a second battery state is determined based on the register value of a remaining capacity register, a third battery state is determined based on the register value of a battery status register, and the charge and discharge state of the battery is determined based on the first battery state, the second battery state, and the third battery state. By comprehensively analyzing the register value of the current current register, the register value of the remaining capacity register, and the register value of the battery status register to determine the charge and discharge state of the battery, the charge and discharge state of the battery can be determined more accurately than the prior art method of determining the charge and discharge state of the battery based solely on the register value of the battery status register.
[0077] Optionally, when determining the second battery state according to the register value of the remaining capacity register, the method may further include:
[0078] Read the full-charge capacity register to obtain the second register value;
[0079] When any first register value is equal to the second register value, it is determined that the second battery state is a fully charged state.
[0080] Among them, the full charge capacity (FullchargeCapacity) register is used to store the package capacity of the battery. The package capacity is the capacity of the battery after it is fully charged. When the package capacity is equal to the current remaining capacity of the battery, it means that the battery capacity is full, that is, the battery is in a fully charged state.
[0081] In this embodiment, the electronic device can read the full-charge capacity register to obtain a second register value. After obtaining the first register value and the second register value, the first register value and the second register value can be compared. When any one of the first register values is equal to the second register value, that is, the current remaining capacity of the battery is equal to the package capacity of the battery after being fully charged, it means that the battery is fully charged, and the second battery state can be determined to be a fully charged state.
[0082] In practical applications, the second battery state can be quickly determined by comparing the first register value and the second register value. For example, after obtaining the first register value for the first time, if the first register value is determined to be equal to the second register value that has already been obtained, the second battery state can be determined to be fully charged, thereby avoiding the need to obtain the first register value again and reducing the power consumption of the electronic device.
[0083] Optionally, when the values of the first registers gradually increase in the order in which they are read, the step of determining that the second battery state is the charging state may be implemented in the following manner:
[0084] When the values of the first registers gradually increase according to the reading sequence and the increase amplitude is not less than the preset charging threshold, it is determined that the second battery state is the charging state.
[0085] In this embodiment, in the process of comparing multiple first register values read sequentially, when each first register value gradually increases in the reading order, the difference between two adjacent first registers can be compared to determine the increase rate. When the difference between the two adjacent first register values is greater than or equal to the preset charging threshold, it can be determined that the increase rate is not less than the preset charging threshold, and the second battery state is the charging state. In combination with the above example, if the first register value read for the first time is 50 and the first register value read for the second time is 70, it can be determined that the first register value gradually increases in the reading order, and the difference between the first register value read for the first time and the first register value read for the second time is not less than the preset charging threshold of 20, then the second battery state can be determined to be the charging state. The specific value of the preset charging threshold can be set according to needs, and this embodiment does not limit this.
[0086] In actual applications, when the first register value gradually increases in the reading order, the increase amplitude can be determined. When the increase amplitude is not lower than the preset charging threshold, the second battery state is determined to be the charging state, which can more accurately determine the second battery state.
[0087] Optionally, when the values of the first registers gradually decrease in the reading order, the step of determining that the second battery state is the discharge state can be implemented as follows:
[0088] When the values of the first registers gradually decrease according to the reading order and the decrease amplitude is not lower than the preset discharge threshold, it is determined that the second battery state is the discharge state.
[0089] In this embodiment, in the process of comparing multiple first register values read sequentially, when each first register value gradually decreases in the reading order, the difference between two adjacent first registers can be compared to determine the reduction amplitude. When the difference between any two adjacent first register values is less than or equal to the preset charging threshold, it can be determined that the reduction amplitude is not less than the preset discharge threshold, and the second battery state is a discharge state. In combination with the above example, if the first register value read for the first time is 70 and the first register value read for the second time is 60, it can be determined that the first register value gradually decreases in the reading order, and the difference between the first register value read for the first time and the first register value read for the second time is not less than the preset discharge threshold of 10, then the second battery state can be determined to be a discharge state. The specific value of the preset discharge threshold can be set according to demand, and this embodiment does not impose any restrictions on this.
[0090] In practical applications, when the first register value gradually decreases in the reading order, the decrease amplitude can be determined. When the decrease amplitude is not lower than the preset discharge threshold, the second battery state is determined to be the discharge state, which can more accurately determine the second battery state.
[0091] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0092] Reference Figure 2 , shows a structural block diagram of an embodiment of a battery status determination device of the present invention, which may specifically include the following modules:
[0093] The first determining module 201 is configured to determine a first battery state according to a register value of a current current register corresponding to the battery.
[0094] The second determining module 202 is configured to determine a second battery state according to a register value of the remaining capacity register.
[0095] The third determining module 203 is configured to determine a third battery status according to the register value of the battery status register.
[0096] The fourth determining module 204 is configured to determine the charge and discharge status of the battery according to the first battery status, the second battery status, and the third battery status.
[0097] Optionally, the second determining module 202 may include:
[0098] The first reading submodule is configured to read the remaining capacitance register at least twice to obtain at least two first register values.
[0099] The first determining submodule is configured to determine that the second battery state is a charging state when the values of the first registers gradually increase in a reading order.
[0100] The second determining submodule is configured to determine that the second battery state is a discharging state when the values of the first registers gradually decrease in a reading order.
[0101] The third determining submodule is configured to determine that the second battery state is a fully charged state when the values of the first registers do not change according to the reading sequence.
[0102] Optionally, the second determining module 202 may further include:
[0103] The second reading submodule is used to read the full-charge capacity register to obtain a second register value.
[0104] The fourth determining submodule is configured to determine that the second battery state is a fully charged state when any first register value is equal to the second register value.
[0105] Optionally, the first determining submodule is specifically configured to determine that the second battery state is a charging state when the values of the first registers gradually increase in a reading order and the increase amplitude is not less than a preset charging threshold.
[0106] Optionally, the second determining submodule is specifically configured to determine that the second battery state is a discharging state when the values of the first registers gradually decrease in a reading order and the decrease amplitude is not less than a preset discharging threshold.
[0107] Optionally, the first determining module 201 may include:
[0108] The third reading submodule is used to read the current register corresponding to the battery to obtain a third register value.
[0109] The fifth determining submodule is configured to determine that the first battery state is a charging state when the third register value is a positive value.
[0110] The sixth determining submodule is configured to determine that the first battery state is a discharging state when the third register value is a negative value.
[0111] The seventh determining submodule is configured to determine that the first battery state is a fully charged state when the third register value is 0.
[0112] Optionally, the third determining module 203 may include:
[0113] The fourth reading submodule is used to read the battery status register to obtain a fourth register value.
[0114] An eighth determining submodule is configured to determine that the third battery state is a charging state when both the fifth bit and the sixth bit of the fourth register value are not 1.
[0115] The ninth determining submodule is configured to determine that the third battery state is a discharging state when the sixth bit of the fourth register value is 1.
[0116] The tenth determining submodule is configured to determine that the third battery state is a fully charged state when the fifth bit of the fourth register value is 1.
[0117] Optionally, the fourth determining module 204 may include:
[0118] The eleventh determining submodule is configured to determine that the battery is in a charging state when at least two of the first battery state, the second battery state, and the third battery state are in a charging state.
[0119] The twelfth determining submodule is configured to determine that the battery is in a discharging state when at least two of the first battery state, the second battery state, and the third battery state are in a discharging state.
[0120] The thirteenth determining submodule is configured to determine that the battery is in a fully charged state when at least two of the first battery state, the second battery state, and the third battery state are in a fully charged state.
[0121] Optionally, the fourth determining module further includes:
[0122] The fourteenth determining submodule is configured to determine that the battery is in the second battery state when the first battery state, the second battery state, and the third battery state simultaneously include a charging state, a discharging state, and a fully charged state.
[0123] Optionally, the fourth determination module 204 is specifically used to determine that the batteries are in the same battery state when the first battery state, the second battery state and the third battery state are the same battery state; when the first battery state, the second battery state and the third battery state include different battery states, determine that the battery is in the second battery state.
[0124] In an embodiment of the present invention, a first battery state is determined based on the register value of a current current register corresponding to the battery, a second battery state is determined based on the register value of a remaining capacity register, a third battery state is determined based on the register value of a battery status register, and the charge and discharge state of the battery is determined based on the first battery state, the second battery state, and the third battery state. By comprehensively analyzing the register value of the current current register, the register value of the remaining capacity register, and the register value of the battery status register to determine the battery state, the charge and discharge state of the battery can be determined more accurately than in the prior art where the charge and discharge state of the battery is determined based solely on the register value of the battery status register.
[0125] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0126] Figure 3 3 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0127] Reference Figure 3 , electronic device 300 may include one or more of the following components: a processing component 302 , a memory 304 , a power component 306 , a multimedia component 308 , an audio component 310 , an input / output (I / O) interface 312 , a sensor component 314 , and a communication component 316 .
[0128] The processing component 302 generally controls the overall operation of the electronic device 300, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 302 may include one or more processors 320 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 302 may include one or more modules to facilitate interaction between the processing component 302 and other components. For example, the processing component 302 may include a multimedia module to facilitate interaction between the multimedia component 308 and the processing component 302.
[0129] The memory 304 is configured to store various types of data to support operations on the device 300. Examples of such data include instructions for any application or method operating on the electronic device 300, contact data, phone book data, messages, pictures, videos, etc. The memory 304 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0130] The power supply assembly 306 provides power to the various components of the electronic device 300. The power supply assembly 306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 300.
[0131] The multimedia component 308 includes a screen that provides an output interface between the electronic device 300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 308 includes a front camera and / or a rear camera. When the electronic device 300 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0132] The audio component 310 is configured to output and / or input audio signals. For example, the audio component 310 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 300 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 304 or transmitted via the communication component 316. In some embodiments, the audio component 310 also includes a speaker for outputting audio signals.
[0133] I / O interface 312 provides an interface between processing component 302 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.
[0134] The sensor assembly 314 includes one or more sensors for providing various aspects of status assessment for the electronic device 300. For example, the sensor assembly 314 can detect the open / closed state of the device 300, the relative positioning of components, such as the display and keypad of the electronic device 300. The sensor assembly 314 can also detect changes in the position of the electronic device 300 or a component of the electronic device 300, the presence or absence of user contact with the electronic device 300, the orientation or acceleration / deceleration of the electronic device 300, and temperature changes of the electronic device 300. The sensor assembly 314 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 314 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 314 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0135] The communication component 316 is configured to facilitate wired or wireless communication between the electronic device 300 and other devices. The electronic device 300 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 316 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0136] In an exemplary embodiment, the electronic device 300 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-described methods.
[0137] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 304 including instructions, and the instructions can be executed by the processor 320 of the electronic device 300 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0138] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform a battery status determination method, the method comprising:
[0139] determining a first battery state according to a register value of a current current register corresponding to the battery;
[0140] determining a second battery state according to a register value of the remaining capacity register;
[0141] determining a third battery state according to a register value of the battery state register;
[0142] A charge and discharge state of the battery is determined according to the first battery state, the second battery state, and the third battery state.
[0143] Optionally, determining the second battery state according to the register value of the remaining capacity register includes:
[0144] Reading the remaining capacitance register at least twice to obtain at least two first register values;
[0145] When the values of the first registers gradually increase in the reading order, determining that the second battery state is a charging state;
[0146] When the values of the first registers gradually decrease in the order in which they are read, determining that the second battery state is a discharge state;
[0147] When the values of the first registers do not change according to the reading sequence, it is determined that the second battery state is a fully charged state.
[0148] Optionally, determining the second battery state according to the register value of the remaining capacity register further includes:
[0149] Read the full-charge capacity register to obtain the second register value;
[0150] When any first register value is equal to the second register value, it is determined that the second battery state is a fully charged state.
[0151] Optionally, when the values of the first registers gradually increase in the reading order, determining that the second battery state is a charging state includes: when the values of the first registers gradually increase in the reading order and the increase is not less than a preset charging threshold, determining that the second battery state is a charging state.
[0152] Optionally, when the values of the first registers gradually decrease in the reading order, determining that the second battery state is a discharge state includes: when the values of the first registers gradually decrease in the reading order and the decrease amplitude is not lower than a preset discharge threshold, determining that the second battery state is a discharge state.
[0153] Optionally, determining the first battery state according to a register value of a current current register corresponding to the battery includes:
[0154] Read the current register corresponding to the battery to obtain the value of the third register;
[0155] When the third register value is positive, determining that the first battery state is a charging state;
[0156] When the third register value is a negative value, determining that the first battery state is a discharge state;
[0157] When the third register value is 0, it is determined that the first battery state is a fully charged state.
[0158] Optionally, determining the third battery status according to a register value of a battery status register includes:
[0159] Read the battery status register to obtain the fourth register value;
[0160] When the fifth bit and the sixth bit of the fourth register value are both not 1, determining that the third battery state is a charging state;
[0161] When the sixth bit of the fourth register value is 1, determining that the third battery state is a discharge state;
[0162] When the fifth bit of the fourth register value is 1, it is determined that the third battery state is a fully charged state.
[0163] Optionally, determining the charge and discharge state of the battery according to the first battery state, the second battery state, and the third battery state includes:
[0164] determining that the battery is in a charging state when at least two of the first battery state, the second battery state, and the third battery state are charging states;
[0165] determining that the battery is in a discharging state when at least two of the first battery state, the second battery state, and the third battery state are in a discharging state;
[0166] When at least two of the first battery state, the second battery state, and the third battery state are fully charged states, it is determined that the battery is in the fully charged state.
[0167] Optionally, determining the charge and discharge status of the battery based on the first battery status, the second battery status and the third battery status also includes: when the first battery status, the second battery status and the third battery status simultaneously include the charging status, the discharging status and the fully charged status, determining that the battery is in the second battery status.
[0168] Optionally, the charge and discharge status of the battery is determined based on the first battery status, the second battery status and the third battery status, including: when the first battery status, the second battery status and the third battery status are the same battery status, determining that the battery is in the same battery status; when the first battery status, the second battery status and the third battery status include different battery statuses, determining that the battery is in the second battery status.
[0169] In an embodiment of the present invention, a first battery state is determined based on the register value of a current current register corresponding to the battery, a second battery state is determined based on the register value of a remaining capacity register, a third battery state is determined based on the register value of a battery status register, and the charge and discharge state of the battery is determined based on the first battery state, the second battery state, and the third battery state. By comprehensively analyzing the register value of the current current register, the register value of the remaining capacity register, and the register value of the battery status register to determine the charge and discharge state of the battery, compared to the prior art method of determining the charge and discharge state of the battery based solely on the register value of the battery status register, the problem of being unable to accurately determine the charge and discharge state of the battery when the status information in the battery status register is erroneous can be avoided.
[0170] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0171] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, apparatus, or computer program products. Thus, embodiments of the present invention may take the form of a fully hardware embodiment, a fully software embodiment, or an embodiment combining software and hardware. Furthermore, embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0172] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the process in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0173] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0174] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0175] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0176] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0177] The above is a detailed introduction to a battery status determination method and device, an electronic device, and a storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present invention.
Claims
1. A method for determining a battery status, characterized in that: include: Determining a first battery state according to a register value of a current current register corresponding to the battery; wherein the register value of the current current register represents a current value at a battery terminal; and the current value at the battery terminal is positive, negative, or 0; Determining a second battery state according to a register value of a remaining capacity register; wherein the register value of the remaining capacity register represents the current remaining capacity of the battery; Determining a third battery state according to a register value of a battery state register; wherein the register value of the battery state register includes values of multiple specified bits; and the first battery state, the second battery state, and the third battery state each include a charging state, a discharging state, and a fully charged state; determining that the battery is in a charging state when at least two of the first battery state, the second battery state, and the third battery state are charging states; When at least two of the first battery state, the second battery state, and the third battery state are in a discharging state, determining that the battery is in a discharging state; determining that the battery is in a fully charged state when at least two of the first battery state, the second battery state, and the third battery state are fully charged; When the first battery state, the second battery state, and the third battery state simultaneously include the charging state, the discharging state, and the fully charged state, it is determined that the battery is in the second battery state.
2. The method according to claim 1, characterized in that The determining the second battery state according to the register value of the remaining capacity register includes: Reading the remaining capacity register at least twice to obtain at least two first register values; When the values of the first registers gradually increase in a reading order, determining that the second battery state is a charging state; When the values of the first registers gradually decrease in the order in which they are read, determining that the second battery state is a discharging state; When the values of the first registers do not change according to the reading order, it is determined that the second battery state is a fully charged state.
3. The method according to claim 2, characterized in that The determining the second battery state according to the register value of the remaining capacity register further includes: Read the full-charge capacity register to obtain the second register value; When any of the first register values is equal to the second register value, it is determined that the second battery state is a fully charged state.
4. The method according to claim 2, characterized in that When the values of the first registers gradually increase in a reading order, determining that the second battery state is a charging state includes: When the values of the first registers gradually increase in the reading order and the increase amplitude is not less than a preset charging threshold, it is determined that the second battery state is a charging state.
5. The method according to claim 2, characterized in that When the values of the first registers gradually decrease in a reading order, determining that the second battery state is a discharge state includes: When the values of the first registers gradually decrease in the reading order and the decrease amplitude is not lower than a preset discharge threshold, it is determined that the second battery state is a discharge state.
6. The method according to any one of claims 1 to 5, characterized in that The determining the first battery state according to the register value of the current current register corresponding to the battery includes: Read the current register corresponding to the battery to obtain the value of the third register; When the third register value is a positive value, determining that the first battery state is a charging state; When the third register value is a negative value, determining that the first battery state is a discharging state; When the third register value is 0, it is determined that the first battery state is a fully charged state.
7. The method according to any one of claims 1 to 5, characterized in that The determining the third battery state according to the register value of the battery state register includes: Read the battery status register to obtain the fourth register value; When the fifth bit and the sixth bit of the fourth register value are both not 1, determining that the third battery state is a charging state; When the sixth bit of the fourth register value is 1, determining that the third battery state is a discharge state; When the fifth bit of the fourth register value is 1, it is determined that the third battery state is a fully charged state.
8. A battery status determination device, characterized in that: include: a first determining module, configured to determine a first battery state according to a register value of a current current register corresponding to the battery; wherein the register value of the current current register represents a current value at a battery terminal; and the current value at the battery terminal is positive, negative, or 0; a second determining module, configured to determine a second battery state according to a register value of a remaining capacity register; wherein the register value of the remaining capacity register represents a current remaining capacity of the battery; a third determining module, configured to determine a third battery state according to a register value of a battery state register; wherein the register value of the battery state register includes values of a plurality of designated bits; and the first battery state, the second battery state, and the third battery state each include a charging state, a discharging state, and a fully charged state; A fourth determination module is configured to determine that the battery is in a charging state when at least two of the first battery state, the second battery state, and the third battery state are in a charging state; to determine that the battery is in a discharging state when at least two of the first battery state, the second battery state, and the third battery state are in a discharging state; to determine that the battery is in a fully charged state when at least two of the first battery state, the second battery state, and the third battery state are in a fully charged state; and to determine that the battery is in the second battery state when the first battery state, the second battery state, and the third battery state simultaneously include the charging state, the discharging state, and the fully charged state.
9. An electronic device, characterized in that: The system includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations: Reading a current register corresponding to the battery to obtain a first battery state; wherein a register value of the current register represents a current value at a battery terminal; and the current value at the battery terminal is positive, negative, or 0; Determining a second battery state according to a register value of a remaining capacity register; wherein the register value of the remaining capacity register represents the current remaining capacity of the battery; Reading a battery status register to obtain a third battery status; wherein the register value of the battery status register includes values of multiple specified bits; and the first battery status, the second battery status, and the third battery status each include a charging state, a discharging state, and a fully charged state; determining that the battery is in a charging state when at least two of the first battery state, the second battery state, and the third battery state are charging states; When at least two of the first battery state, the second battery state, and the third battery state are in a discharging state, determining that the battery is in a discharging state; determining that the battery is in a fully charged state when at least two of the first battery state, the second battery state, and the third battery state are fully charged; When the first battery state, the second battery state, and the third battery state simultaneously include the charging state, the discharging state, and the fully charged state, it is determined that the battery is in the second battery state.
10. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the battery status determination method as described in one or more of method claims 1-7.
Citation Information
Patent Citations
Measurement method and unit as well as control unit and system for accumulator capacity
CN102053227A
Method and device for determining battery state
CN104977535A
Method for controlling battery status based on domestic Fei Teng processor
CN105511581A
Electric quantity display system for electric bicycle accumulator cell
CN200986955Y