CN114624595A - Battery state determination method and device, electronic equipment and storage medium - Google Patents

Battery state determination method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114624595A
CN114624595A CN202011447708.3A CN202011447708A CN114624595A CN 114624595 A CN114624595 A CN 114624595A CN 202011447708 A CN202011447708 A CN 202011447708A CN 114624595 A CN114624595 A CN 114624595A
Authority
CN
China
Prior art keywords
state
battery
battery state
register
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011447708.3A
Other languages
Chinese (zh)
Inventor
苏梦岩
袁俊卿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Loongson Technology Corp Ltd
Original Assignee
Loongson Technology Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Loongson Technology Corp Ltd filed Critical Loongson Technology Corp Ltd
Priority to CN202011447708.3A priority Critical patent/CN114624595A/en
Publication of CN114624595A publication Critical patent/CN114624595A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R31/00Arrangements for testing electric properties; Arrangements for locating electric faults; Arrangements for electrical testing characterised by what is being tested not provided for elsewhere
    • G01R31/36Arrangements for testing, measuring or monitoring the electrical condition of accumulators or electric batteries, e.g. capacity or state of charge [SoC]
    • G01R31/367Software therefor, e.g. for battery testing using modelling or look-up tables

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Charge And Discharge Circuits For Batteries Or The Like (AREA)
  • Secondary Cells (AREA)

Abstract

The embodiment of the invention provides a battery state determination method and device, electronic equipment and a storage medium, and relates to the technical field of electronic equipment. The method comprises the following steps: the method comprises the steps of determining a first battery state according to a register value of a current register corresponding to a battery, determining a second battery state according to a register value of a residual electric capacity register, determining a third battery state according to a register value of a battery state register, and determining the charging and discharging states of the battery according to the first battery state, the second battery state and the third battery state. The charging and discharging state of the battery is determined by comprehensively analyzing the register value of the current register, the register value of the residual capacity register and the register value of the battery state register.

Description

Battery state determination method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of electronic devices, and in particular, to a method and an apparatus for determining a battery status, an electronic device, and a storage medium.
Background
The electronic equipment mainly manages the battery in the electronic equipment through the power management chip and controls the charging and discharging process of the battery. The electronic device can obtain the state information of the power supply by reading a battery state (Battery status) register in the power supply management chip, and determine that the battery is in a charging state, a discharging state or a fully charging state according to the state information.
In the prior art, when a power management chip, a battery and/or related circuits have faults, state information in a battery state register is easy to be wrong, so that electronic equipment cannot accurately determine the state of the battery.
Disclosure of Invention
In view of the above problems, embodiments of the present invention are provided to provide a battery state determination method that overcomes or at least partially solves the above problems, so as to solve the problem that the battery state cannot be accurately determined when a power management chip, a power supply and/or related circuits fail.
Correspondingly, the embodiment of the invention also provides a battery state determining device, electronic equipment and a storage medium, which are used for ensuring the realization and application of the method.
In order to solve the above problem, an embodiment of the present invention discloses a battery state determining method, including:
determining a first battery state according to a register value of a current register corresponding to a battery;
determining a second battery state according to the register value of the residual electric capacity register;
determining a third battery state according to the register value of the battery state register;
and determining the charge and discharge state of the battery according to the first battery state, the second battery state and the third battery state.
The embodiment of the invention also discloses a battery state determining device, which comprises:
the first determining module is used for determining a first battery state according to the register value of the current register corresponding to the battery;
the second determining module is used for determining a second battery state according to the register value of the residual electric capacity register;
the third determining module is used for determining a third battery state according to the register value of the battery state register;
and the fourth determination module is used for determining the charge and discharge state of the battery according to the first battery state, the second battery state and the third battery state.
An embodiment of the present invention also discloses an electronic device comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for:
reading a current register corresponding to a battery to obtain a first battery state;
determining a second battery state according to the register value of the residual electric capacity register;
reading the battery state register to obtain a third battery state;
and determining the charge and discharge state of the battery according to the first battery state, the second battery state and the third battery state.
The embodiment of the invention also discloses a readable storage medium, and when instructions in the storage medium are executed by a processor of the electronic equipment, the electronic equipment can execute one or more of the battery state determination methods in the embodiment of the invention.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, the first battery state is determined according to the register value of the current register corresponding to the battery, the second battery state is determined according to the register value of the residual electric capacity register, the third battery state is determined according to the register value of the battery state register, and the charging and discharging state of the battery is determined according to the first battery state, the second battery state and the third battery state. Compared with the prior art that the charging and discharging state of the battery is determined only according to the register value of the battery state register, the problem that the charging and discharging state of the battery cannot be determined accurately when state information in the battery state register is wrong can be solved.
Drawings
FIG. 1 is a flow chart illustrating the steps of one embodiment of a battery state determination method of the present invention;
FIG. 2 is a block diagram illustrating the structure of an embodiment of a battery state determining apparatus according to the present invention;
fig. 3 is a block diagram illustrating a structure of an electronic device according to an example embodiment.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Before describing embodiments of the present invention in detail, a description will be given of a current battery state determination method.
The existing battery state determination method comprises the following steps: the battery in the electronic equipment is mainly managed by a power management chip, the power management chip controls the charging and discharging processes of the battery, monitors the state of the battery and stores the state information of the battery in a battery state register. The electronic device can determine that the battery is in a charging state, a discharging state or a fully charged state according to the register value of the battery state register by reading the register value of the battery state register in the power management chip. When the battery state is determined only according to the register value of the battery state register, when the power management chip, the battery and the related circuits are affected by the external temperature, the register value of the battery state register is easy to be wrong, so that the electronic equipment reads the wrong register value, and the electronic equipment cannot accurately determine the battery state.
One of the core ideas of the embodiment of the invention is to comprehensively analyze the register value of the current register, the register value of the residual electric capacity register and the register value of the battery state register in the power management chip to determine the charging and discharging state of the battery.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a battery status determining method according to the present invention is shown, which may specifically include the following steps:
step 101, determining a first battery state according to a register value of a current register corresponding to a battery.
The Current register (Current) stores the Current value of the battery terminal, and when the register value of the Current register is a positive value, the Current register indicates that the battery is being charged and the battery is in a charging state; when the register value of the current register is a negative value, the battery is discharged, and the battery state is a discharge state; when the register value of the current register is 0, it indicates that the battery is not charged or discharged, i.e. the battery status is a fully charged status.
Alternatively, step 101 may be implemented as follows:
reading a current register corresponding to the battery to obtain a third register value;
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, the first battery state is determined to be a fully charged state.
In this embodiment, the electronic device may read the current register to obtain a third register value stored in the current register, so that the first battery state may be determined according to the third register value. Exemplarily, after the third register value is read, if the third register value is greater than 0 (positive value), the first battery state is determined to be the charging state; if the third register value is less than 0 (negative value), determining that the first battery state is a discharging state; and determining that the first battery state is a fully charged state when the third register value is equal to 0. The process of reading the register value of the current register may be set according to a requirement, which is not limited in this embodiment.
And step 102, determining a second battery state according to the register value of the residual electric capacity register.
Wherein, the remaining capacity (remaining capacity) register stores the current remaining capacity of the battery, and the state of the battery, i.e., the second battery state, can be determined according to the change state of the current remaining capacity of the battery.
Alternatively, step 102 may be implemented as follows:
reading the residual electric capacity register at least twice to obtain at least two first register values;
when the values of the first registers gradually increase according to the reading sequence, determining that the second battery state is a charging state;
when the values of the first registers are gradually reduced according to the reading sequence, determining that the second battery state is a discharging state;
and when the values of the first registers are not changed according to the reading sequence, determining that the second battery state is a fully charged state.
In this embodiment, the electronic device may read the register value of the residual capacitance register for multiple times at different time points, respectively, to obtain the first register value at different time points. For example, the electronic device may read the remaining capacity register for a first time in a first second to obtain a first register value, and read the remaining capacity register for a second time in a third second to obtain another first register value. The time interval between two adjacent readings of the remaining capacity register may be set according to the requirement, and may be, for example, 1 second, 3 seconds or 5 seconds. The number of times of reading the remaining capacity register may be set according to a requirement, which is not limited in this embodiment.
When the plurality of first register values are acquired, the electronic device may determine the second battery state according to a change state of the first register values, that is, a change state of a currently remaining capacity of the battery. 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 may be determined that the first register values are gradually increased in the reading order, that is, the current remaining capacity of the battery is continuously increased, and at this time, it may be determined that the second battery state is the charging state. In contrast, 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 may be determined that the first register values are gradually decreased in the reading order, that is, the current remaining capacity of the battery is continuously decreased, and at this time, it may be determined that the second battery state is the discharge 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 80, it may be determined that the first register value is unchanged according to the reading sequence, that is, the current remaining capacity of the battery is constant, and at this time, it may be determined that the second battery state is a fully charged state.
And step 103, determining a third battery state according to the register value of the battery state register.
The battery state register is a 16-bit register, and in the battery state register, when the fifth bit (bit5) is 1, the battery state is a fully charged state, when the sixth bit (bit6) is 1, the battery state is a discharged state, and when neither bit5 nor bit6 is 1, the battery state is a charged state.
Alternatively, step 103 may be implemented as follows:
reading the battery state register to obtain a fourth register value;
when the fifth bit and the sixth bit of the fourth register value are 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, the third battery state is determined to be a fully charged state.
In this embodiment, the electronic device may read the battery status register, obtain the fourth register value, determine that the third battery status is the charging status when neither the fifth bit nor the sixth bit of the fourth register value is 1, determine that the third battery status is the discharging status when the sixth bit of the fourth register value is 1, and determine that the third battery status is the fully charged status when the fifth bit of the fourth register value is 1. The process of reading the battery status register by the electronic device may be set according to requirements, and the embodiment is not limited herein.
And 104, determining the charge and discharge state of the battery according to the first battery state, the second battery state and the third battery state.
In this embodiment, after the first battery state, the second battery state, and the third battery state are determined, the first battery state, the second battery state, and the third battery state may be integrated to determine the charge/discharge state of the battery. The current register stores the current value of the battery terminal, the residual capacity register stores the current residual capacity of the battery, and the battery state register stores the state information of the battery determined by the battery management chip. And determining the charge and discharge state of the battery according to the first battery state, the second battery state and the third battery state, and comprehensively analyzing the current value of the battery terminal, the current residual capacity of the battery and the current state information of the battery to determine the charge and discharge state of the battery. Compared with the method for determining the battery charging and discharging state only according to the register value of the battery state register in the prior art, the method can solve the problem that the battery charging and discharging state cannot be determined accurately when the state information in the battery state register is wrong.
Illustratively, step 104 may be implemented by:
determining that the battery is in a charged state when at least two of the first battery state, the second battery state, and the third battery state are in charged states;
determining that the battery is in a discharged state when at least two of the first battery state, the second battery state, and the third battery state are in a discharged 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 in the fully charged state.
For example, the electronic device may determine that the battery is in the charging state when the first battery state and the second battery state are in the charging state, or determine that the battery is in the 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 the charging state when the second battery state and the third battery state are in the charging states.
Similarly, the electronic device may determine that the battery is in the discharge state when the first battery state and the second battery state are in the discharge state, or determine that the battery is in the discharge state when the first battery state, the second battery state, and the third battery state are all in the discharge state, or determine that the battery is in the discharge state when the second battery state and the third battery state are in the discharge state.
Similarly, the electronic device may determine that the battery is in the fully charged state when the first battery state and the second battery state are in the fully charged state, or determine that the battery is in the fully charged state when the first battery state, the second battery state, and the third battery state are all in the fully charged state, or determine that the battery is in the fully charged state when the second battery state and the third battery state are in the fully charged state.
Optionally, step 104 may further include:
and when the first battery state, the second battery state and the third battery state simultaneously comprise a charging state, a discharging state and a full-charging state, determining that the battery is in the second battery state.
In this embodiment, when the first battery state, the second battery state, and the third battery state simultaneously include the charge state, the discharge state, and the full charge state, it is determined that the battery is 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 is taken as the standard. For example, if the first battery state is a charged state, the second battery state is a discharged state, and the third battery state is a fully charged state, it is determined that the battery is in the discharged state.
In practical application, the second battery state is determined according to the change state of the residual electric capacity, the accuracy is higher compared with the first battery state and the third battery state, and when the battery state cannot be determined according to the first battery state, the second battery state and the third battery state, the accuracy of the battery state can be improved based on the second battery state.
Illustratively, step 104 may also be implemented by:
when the first battery state, the second battery state and the third battery state are the same battery state, determining that the batteries are the same battery state;
when the first battery state, the second battery state and the third battery state comprise different battery states, determining that the battery is in the second battery state.
In this embodiment, when the first battery state, the second battery state, and the third battery state are the same battery state, it may be determined that there is no influence of external factors, and the first battery state, the second battery state, and the third battery state are all accurate battery states, and at this time, it may be determined that the batteries are in the same battery state. For example, if the first battery state, the second battery state, and the third battery state are all charge states, it may be determined that the battery is in a charge state.
Conversely, when the first battery state, the second battery state, and the third battery state include different battery states, it may be determined that there is an influence of the external factor, and an inaccurate battery state may exist among the first battery state, the second battery state, and the third battery state, and at this time, the second battery state may be used as a reference. For example, when the first battery state and the third battery state are a charged state and the second battery state is a discharged state, it may be determined that the battery is in a discharged state.
In practical application, when the first battery state, the second battery state and the third battery state may have inaccurate battery states, the accuracy of the battery states can be improved with the second battery state as a standard.
In the embodiment of the invention, the first battery state is determined according to the register value of the current register corresponding to the battery, the second battery state is determined according to the register value of the residual electric capacity register, the third battery state is determined according to the register value of the battery state register, and the charging and discharging state of the battery is determined according to the first battery state, the second battery state and the third battery state. The charging and discharging state of the battery is determined by comprehensively analyzing the register value of the current register, the register value of the residual capacity register and the register value of the battery state register.
Optionally, when determining the second battery state according to the register value of the remaining electric capacity register, the method may further include:
reading the full-capacity register to obtain a second register value;
when any of the first register values is equal to the second register value, the second battery state is determined to be a fully charged state.
The full capacity (full charge capacity) register is used for storing the packing capacity of the battery, the packing capacity is the capacity of the fully charged battery, and when the packing capacity is equal to the current residual capacity of the battery, the full capacity of the battery is indicated, that is, the battery is in a fully charged state.
In this embodiment, the electronic device may read the full capacity register to obtain the second register value. After the first register value and the second register value are obtained, the first register value and the second register value can be compared, and 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 packaging capacity of the fully charged battery, which indicates that the battery is fully charged, the second battery state can be determined to be a fully charged state.
In practical application, the second battery state can be rapidly determined by comparing the first register value with the second register value. For example, after the first register value is obtained for the first time, if it is determined that the first register value is equal to the obtained second register value, it may be determined that the second battery state is a fully charged state, so that it may be avoided to obtain the first register value again, and power consumption of the electronic device may be reduced.
Alternatively, when the respective first register values gradually increase in the reading order, the step of determining that the second battery state is the charging state may be implemented as follows:
and when the values of the first registers gradually increase according to the reading sequence and the increasing amplitude is not lower than a preset charging threshold value, determining that the second battery state is a charging state.
In this embodiment, in the process of comparing the plurality of first register values read in the sequence, when each first register value gradually increases according to the reading sequence, the difference between two adjacent first registers may be compared to determine the increase range, and when the difference between two adjacent first register values is greater than or equal to the preset charging threshold, it may be determined that the increase range is not lower than the preset charging threshold, and the second battery state is the charging state. With reference to the foregoing 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 may be determined that the first register values gradually increase according to the reading sequence, 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 lower than the preset charging threshold 20, and then it may be determined that the second battery state is the charging state. The specific value of the preset charging threshold may be set according to the requirement, which is not limited in this embodiment.
In practical application, when the first register value gradually increases according to the reading sequence, the increasing amplitude can be determined, and when the increasing amplitude is not lower than the preset charging threshold, the second battery state is determined to be the charging state, so that the second battery state can be determined more accurately.
Alternatively, when the respective first register values are gradually decreased in the reading order, the step of determining that the second battery state is the discharge state may be implemented as follows:
and when the values of the first registers are gradually reduced according to the reading sequence and the reduction amplitude is not lower than a preset discharge threshold value, determining that the second battery state is a discharge state.
In this embodiment, in the process of comparing the plurality of first register values read in sequence, when each first register value gradually decreases according to the reading sequence, the difference between two adjacent first registers may be compared to determine the decrease range, and when the difference between any two adjacent first register values is less than or equal to the preset charging threshold, it may be determined that the decrease range is not less than the preset discharging threshold, and the second battery state is the discharging state. With reference to 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 may be determined that the first register values gradually decrease according to 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 lower than the preset discharge threshold 10, and at this time, it may be determined that the second battery state is the discharge state. The specific value of the preset discharge threshold may be set according to the requirement, and this embodiment does not limit this.
In practical application, when the first register value is gradually reduced according to the reading sequence, the reduction amplitude can be determined, and when the reduction amplitude is not lower than a preset discharge threshold, the second battery state is determined to be a discharge state, so that the second battery state can be more accurately determined.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 2, a block diagram of a battery status determining apparatus according to an embodiment of the present invention is shown, which may specifically include the following modules:
the first determining module 201 is configured to determine a first battery state according to a register value of a current register corresponding to a battery.
The second determining module 202 is configured to determine the second battery state according to the register value of the remaining electric capacity register.
The third determining module 203 is configured to determine a third battery status according to the register value of the battery status register.
The fourth determining module 204 is configured to determine a charge/discharge state of the battery according to the first battery state, the second battery state, and the third battery state.
Optionally, the second determining module 202 may include:
and the first reading submodule is used for reading the residual electric capacity register at least twice to obtain at least two first register values.
And the first determining submodule is used for determining that the second battery state is the charging state when the values of the first registers gradually increase according to the reading sequence.
And the second determining submodule is used for determining that the second battery state is a discharging state when the values of the first registers gradually decrease according to the reading sequence.
And the third determining submodule is used for determining that the second battery state is a fully charged state when the values of the first registers are not changed according to the reading sequence.
Optionally, the second determining module 202 may further include:
and the second reading submodule is used for reading the full-capacity register to obtain a second register value.
And the fourth determining submodule is used for determining the second battery state as a full charge state when any first register value is equal to the second register value.
Optionally, the first determining submodule is specifically configured to determine that the second battery state is the charging state when the first register values gradually increase in the reading order and the increase amplitude is not lower than the preset charging threshold.
Optionally, the second determining submodule is specifically configured to determine that the second battery state is a discharge state when the first register values gradually decrease according to the reading order and the decrease amplitude is not lower than the preset discharge threshold.
Optionally, the first determining module 201 may include:
and the third reading submodule is used for reading the current register corresponding to the battery to obtain a third register value.
And the fifth determining submodule is used for determining that the first battery state is the charging state when the third register value is a positive value.
And the sixth determining submodule is used for determining that the first battery state is a discharging state when the third register value is a negative value.
And the seventh determining submodule is used for determining that the first battery state is a fully charged state when the third register value is 0.
Optionally, the third determining module 203 may include:
and the fourth reading submodule is used for reading the battery state register to obtain a fourth register value.
And the eighth determining submodule is used for determining that the third battery state is the charging state when the fifth bit and the sixth bit of the fourth register value are not 1.
A ninth determining submodule for determining that the third battery state is a discharging state when a sixth bit of the fourth register value is 1.
A tenth determination submodule for determining that the third battery state is the fully charged state when a fifth bit of the fourth register value is 1.
Optionally, the fourth determining module 204 may include:
an eleventh determining submodule for determining that the battery is in the charged state when at least two of the first battery state, the second battery state, and the third battery state are in the charged state.
A twelfth determination submodule for determining that the battery is in a discharged state when at least two of the first battery state, the second battery state, and the third battery state are in a discharged state.
A thirteenth determination submodule for 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 in the fully charged state.
Optionally, the fourth determining module further includes:
a fourteenth determining submodule, 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 charge state, a discharge state, and a full charge state.
Optionally, the fourth determining module 204 is specifically configured 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 in the same battery state; when the first battery state, the second battery state and the third battery state comprise different battery states, determining that the battery is in the second battery state.
In the embodiment of the invention, the first battery state is determined according to the register value of the current register corresponding to the battery, the second battery state is determined according to the register value of the residual electric capacity register, the third battery state is determined according to the register value of the battery state register, and the charging and discharging state of the battery is determined according to the first battery state, the second battery state and the third battery state. The battery state is determined by comprehensively analyzing the register value of the current register, the register value of the residual capacity register and the register value of the battery state register.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
FIG. 3 is a block diagram illustrating the structure of an electronic device in accordance with 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, an exercise device, a personal digital assistant, and the like.
Referring to fig. 3, electronic device 300 may include one or more of the following components: processing component 302, memory 304, power component 306, multimedia component 308, audio component 310, input/output (I/O) interface 312, sensor component 314, and communication component 316.
The processing component 302 generally controls overall operation of the electronic device 300, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing elements 302 may include one or more processors 320 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 302 can include one or more modules that 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.
The memory 304 is configured to store various types of data to support operations at the device 300. Examples of such data include instructions for any application or method operating on the electronic device 300, contact data, phonebook data, messages, pictures, videos, and the like. The memory 304 may be implemented by any type or combination of volatile or non-volatile memory devices, 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 or optical disks.
The power supply component 306 provides power to the various components of the electronic device 300. The power components 306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 300.
The multimedia component 308 comprises a screen providing an output interface between the electronic device 300 and a 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 an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a 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 facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 300 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 310 is configured to output and/or input audio signals. For example, the audio component 310 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 300 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 304 or transmitted via the communication component 316. In some embodiments, audio component 310 also includes a speaker for outputting audio signals.
The I/O interface 312 provides an interface between the processing component 302 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
Sensor assembly 314 includes one or more sensors for providing various aspects of status assessment for electronic device 300. For example, sensor assembly 314 may detect an open/closed state of device 300, the relative positioning of components, such as a display and keypad of electronic device 300, sensor assembly 314 may also detect a change in the position of electronic device 300 or a component of electronic device 300, the presence or absence of user contact with electronic device 300, the orientation or acceleration/deceleration of electronic device 300, and a change in the temperature of electronic device 300. Sensor assembly 314 may include a proximity sensor configured to detect the presence of a nearby object 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 acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 316 is configured to facilitate wired or wireless communication between the electronic device 300 and other devices. The electronic device 300 may 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 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
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, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 304, that are executable by the processor 320 of the electronic device 300 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform a battery state determination method, the method comprising:
determining a first battery state according to a register value of a current register corresponding to a battery;
determining a second battery state according to the register value of the residual electric capacity register;
determining a third battery state according to the register value of the battery state register;
and determining the charge and discharge state of the battery according to the first battery state, the second battery state and the third battery state.
Optionally, determining the second battery state according to the register value of the remaining electric capacity register includes:
reading the residual electric capacity register at least twice to obtain at least two first register values;
when the values of the first registers gradually increase according to the reading sequence, determining that the second battery state is a charging state;
when the values of the first registers are gradually reduced according to the reading sequence, determining that the second battery state is a discharging state;
and when the values of the first registers are not changed according to the reading sequence, determining that the second battery state is a fully charged state.
Optionally, determining the second battery state according to the register value of the remaining electric capacity register, further comprising:
reading the full-capacity register to obtain a second register value;
when any of the first register values is equal to the second register value, the second battery state is determined to be a fully charged state.
Optionally, when the respective first register values gradually increase in the reading order, determining that the second battery state is the charging state includes: and when the values of the first registers gradually increase according to the reading sequence and the increasing amplitude is not lower than a preset charging threshold value, determining that the second battery state is a charging state.
Optionally, when the respective first register values gradually decrease in the reading order, determining that the second battery state is a discharge state includes: and when the values of the first registers are gradually reduced according to the reading sequence and the reduction amplitude is not lower than a preset discharge threshold value, determining that the second battery state is a discharge state.
Optionally, determining the first battery state according to a register value of a current register corresponding to the battery includes:
reading a current register corresponding to the battery to obtain a third register value;
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, the first battery state is determined to be a fully charged state.
Optionally, determining the third battery state according to the register value of the battery state register includes:
reading the battery state register to obtain a fourth register value;
when the fifth bit and the sixth bit of the fourth register value are 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, the third battery state is determined to be a fully charged state.
Optionally, determining the charge-discharge state of the battery according to the first battery state, the second battery state and the third battery state includes:
determining that the battery is in a charged state when at least two of the first battery state, the second battery state, and the third battery state are in charged states;
determining that the battery is in a discharged state when at least two of the first battery state, the second battery state, and the third battery state are in a discharged 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 in the fully charged state.
Optionally, determining a charge/discharge state of the battery according to the first battery state, the second battery state, and the third battery state, further includes: and when the first battery state, the second battery state and the third battery state simultaneously comprise a charging state, a discharging state and a full-charging state, determining that the battery is in the second battery state.
Optionally, determining the charge-discharge state of the battery according to the first battery state, the second battery state and the third battery state includes: 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; when the first battery state, the second battery state and the third battery state comprise different battery states, determining that the battery is in the second battery state.
In the embodiment of the invention, the first battery state is determined according to the register value of the current register corresponding to the battery, the second battery state is determined according to the register value of the residual electric capacity register, the third battery state is determined according to the register value of the battery state register, and the charging and discharging state of the battery is determined according to the first battery state, the second battery state and the third battery state. Compared with the prior art that the charging and discharging state of the battery is determined only according to the register value of the battery state register, the problem that the charging and discharging state of the battery cannot be determined accurately when state information in the battery state register is wrong can be solved.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a predictive manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The foregoing describes in detail a battery state determination method and apparatus, an electronic device, and a storage medium, which are provided by the present invention, and specific examples are applied herein to illustrate the principles and embodiments of the present invention, and the description of the foregoing examples is only used to help understand the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (12)

1. A battery state determination method, comprising:
determining a first battery state according to a register value of a current register corresponding to a battery;
determining a second battery state according to the register value of the residual electric capacity register;
determining a third battery state according to the register value of the battery state register;
and determining the charge and discharge state of the battery according to the first battery state, the second battery state and the third battery state.
2. The method of claim 1, wherein determining the second battery state based on the register value of the remaining electric capacity register comprises:
reading the residual electric capacity register at least twice to obtain at least two first register values;
when the first register values are gradually increased according to the reading sequence, determining that the second battery state is a charging state;
when the values of the first registers are gradually reduced according to the reading sequence, determining that the second battery state is a discharging state;
and when the values of the first registers are not changed according to the reading sequence, determining that the second battery state is a fully charged state.
3. The method of claim 2, wherein determining the second battery state based on the register value of the remaining electric capacity register further comprises:
reading the full-capacity register to obtain a second register value;
when any of the first register values is equal to the second register value, determining that the second battery state is a fully charged state.
4. The method of claim 2, wherein determining the second battery state as the second battery state is the charged state as the respective first register values gradually increase in the reading order comprises:
and when the first register values gradually increase according to the reading sequence and the increasing amplitude is not lower than a preset charging threshold value, determining that the second battery state is a charging state.
5. The method of claim 2, wherein said determining that said second battery state is a discharged state when each of said first register values is decreasing in read order comprises:
and when the first register values are gradually reduced according to the reading sequence and the reduction amplitude is not lower than a preset discharge threshold value, determining that the second battery state is a discharge state.
6. The method according to any one of claims 1-5, wherein determining the first battery state based on the register value of the current register corresponding to the battery comprises:
reading a current register corresponding to the battery to obtain a third register value;
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 discharge state;
and when the third register value is 0, determining that the first battery state is a fully charged state.
7. The method of any of claims 1-5, wherein determining the third battery state based on the register value of the battery state register comprises:
reading the battery state register to obtain a fourth register value;
when the fifth bit and the sixth bit of the fourth register value are not both 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;
determining that the third battery state is a fully charged state when the fifth bit of the fourth register value is 1.
8. The method according to any one of claims 1-7, wherein said determining a charge-discharge state of the battery based on the first battery state, the second battery state, and the third battery state comprises:
determining that the battery is in a charged state when at least two of the first battery state, the second battery state, and the third battery state are charged states;
determining that the battery is in a discharged state when at least two of the first battery state, the second battery state, and the third battery state are discharged states;
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 in a fully charged state.
9. The method of claim 8, wherein determining the charge-discharge state of the battery based on the first battery state, the second battery state, and the third battery state further comprises:
determining that the battery is in the second battery state when the state of charge, the state of discharge, and the state of full charge are included in the first battery state, the second battery state, and the third battery state at the same time.
10. A battery state determining apparatus, characterized by comprising:
the first determining module is used for determining a first battery state according to the register value of the current register corresponding to the battery;
the second determining module is used for determining a second battery state according to the register value of the residual electric capacity register;
the third determining module is used for determining a third battery state according to the register value of the battery state register;
and the fourth determination module is used for determining the charge and discharge state of the battery according to the first battery state, the second battery state and the third battery state.
11. An electronic device comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors the one or more programs including instructions for:
reading a current register corresponding to the battery to obtain a first battery state;
determining a second battery state according to the register value of the residual electric capacity register;
reading the battery state register to obtain a third battery state;
and determining the charge and discharge state of the battery according to the first battery state, the second battery state and the third battery state.
12. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the battery status determination method according to one or more of the method claims 1-9.
CN202011447708.3A 2020-12-11 2020-12-11 Battery state determination method and device, electronic equipment and storage medium Pending CN114624595A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011447708.3A CN114624595A (en) 2020-12-11 2020-12-11 Battery state determination method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011447708.3A CN114624595A (en) 2020-12-11 2020-12-11 Battery state determination method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114624595A true CN114624595A (en) 2022-06-14

Family

ID=81895410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011447708.3A Pending CN114624595A (en) 2020-12-11 2020-12-11 Battery state determination method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114624595A (en)

Similar Documents

Publication Publication Date Title
US10205332B2 (en) Efficient two way charging method using master and slave devices
CN107134823B (en) Charging prompting method and device
KR101900405B1 (en) Method and device for charge management, program and recording medium
RU2632120C2 (en) Method and device for controlling terminal device charging
CN104219383A (en) Terminal power information prompting method and device
US11218014B2 (en) Circuitry and method for detecting temperature of wireless charging coil, and storage medium
EP3173898A1 (en) Screen protection method and apparatus
CN104464674B (en) Liquid crystal display method of adjustment and device
CN105353901A (en) Method and apparatus for determining validity of touch operation
CN108539804B (en) Battery charging control method, battery charging control device and electronic equipment
CN107368280A (en) Method for controlling volume, device and the interactive voice equipment of interactive voice
US11686776B2 (en) Prediction method and apparatus of battery health, and storage medium
CN107733021B (en) Control method and device of electronic equipment
CN105183326A (en) List display method and apparatus
EP3828716A1 (en) Method and apparatus for identifying electronic device, terminal device, and electronic device
CN106446827B (en) Iris recognition function detection method and device
CN114624595A (en) Battery state determination method and device, electronic equipment and storage medium
CN104202470A (en) Terminal power supply control method and terminal power supply control device
CN109066865A (en) The calibration method and terminal of battery capacity
CN116859248A (en) Battery cycle life prediction method, device and storage medium
CN109038697A (en) Charge control method and battery charge controller, electronic equipment
CN112421702B (en) Lithium battery charging method and device
CN105306826A (en) Camera function setting method and device
CN106896921A (en) Mobile device control method and device
US11635468B2 (en) Method, apparatus and storage medium for determining charging time length of battery

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination