Background technology
Along with the development of modern science and technology, the portable equipment such as mobile phone, PAD, notebook are seen everywhere.The function that portable product provides is also more and more, and people more need to monitor accurately battery electric quantity, so that rational managing electrical power.
By the battery electric quantity detection technique, can accurately calculate the battery of mobile device.Of common occurrence in mobile terminal, notebook computer.
Current, most of handheld devices are all by measuring cell voltage, estimating corresponding battery dump energy.By system battery voltage and capacity corresponding relation, obtain the rough lattice benchmark shown of electric weight common on mobile phone.This lattice shows that the mode of electric weight is too coarse, show often inaccurate, particularly for the battery of long-time use, lattice shows that it is full lattice that electric weight shows, but can not use time enough, therefore, this mode more and more can not meet the user electric weight is monitored to requirement accurately, and the user needs to know more accurately the number percent of dump energy.
And, due to after the battery loading, along with the variation of load, cell voltage also has fluctuation, if the charge value shown gets according to the magnitude of voltage conversion fully, just there will be charge value larger fluctuation to occur, affect the monitoring of user to battery electric quantity.
Summary of the invention
Fundamental purpose of the present invention is to provide a kind of method that residual battery electricity quantity of mobile terminal shows, the method can be relatively accurately and the method for stability Calculation and demonstration electric weight, make electric weight more stablely to be shown to 1%, the variation of electric weight does not have the saltus step that is greater than 1%, improves the accuracy to the battery electric quantity monitoring.
A kind of method that provides residual battery electricity quantity of mobile terminal to show is provided another object of the present invention, and it is simple, with low cost that the method realizes, is convenient to be applied in various mobile terminals.
Based on this, implementation method of the present invention comprises the steps.
1, detect electric weight: after detecting the one-shot battery magnitude of voltage, by battery voltage value, calculate the battery dump energy value;
2, comparing electrical value: after detecting electric weight, the battery dump energy value is not to upgrade current demonstration charge value, but compares with current demonstration charge value at once;
3, upgrade and show charge value: the continuous detecting electric weight, when current calculating battery dump energy value is greater than or less than the certain number of times of current demonstration charge value continuously, then upgrade current demonstration charge value.
The present invention charges and two voltage-electric quantity curve of standby by utilization, in conjunction with repeatedly more current calculating charge value and current demonstration charge value, progressively upgrades current demonstration charge value, has solved electric weight saltus step problem, can show exactly electric weight.
Described number of times, generally be more than or equal to 1 time.Upgrading the method for current demonstration charge value, is not directly current demonstration charge value to be equaled to current calculating charge value, but makes current demonstration charge value only increase or reduce 1.
Described demonstration charge value is digital value.
In the time of due to charging, cell voltage has virtual height, so charging and standby adopt respectively two different voltage-electric quantity curve.For user's good experience, in the time of charging, current demonstration charge value only allows to increase and can not reduce in addition, and in the time of standby, current demonstration charge value only allows to reduce can not increase.
The setting at electric weight interval update time is to decide according to the absolute value of current calculating charge value and current demonstration charge value difference.When the absolute value of this difference is larger, illustrate that current demonstration charge value and the current charge value recorded differ larger, need upgrade as early as possible, arrange update time just less.
The mode that the present invention adopts the repeated detection electric weight to be contrasted, can monitor the numerical value of the actual electric weight of battery exactly, can calculate more exactly and show electric weight, makes the demonstration of electric weight have enough reliabilities, is convenient to the actual electric weight of user monitoring battery.
And it is easy, with low cost that the present invention realizes, be convenient to be applied in existing various mobile terminals.
Embodiment
Below, by reference to the accompanying drawings shown in, specific embodiment of the invention is elaborated, should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.As shown in Figure 3, implementation method of the present invention comprises the following steps:
The first step: test out the cell voltage-time curve of charging and discharging, according to this curve, make electric weight number percent-voltage curve;
Discharge curve can according to test to the cell voltage-time curve of standby electric discharge obtain as shown in Figure 1, for example electric weight can obtain with the proportional relation of stand-by time.As shown in the table:
Electric weight |
0% |
10% |
30% |
50% |
70% |
90% |
100% |
Voltage (mv) |
3400 |
3600 |
3700 |
3800 |
3900 |
4000 |
4200 |
Discharge curve can be shown according to this, with straight line or secondary and above-mentioned curve connection acquisition.
Charging curve can obtain on basis as shown in Figure 2 at the standby curve, for example can be on the corresponding standby voltage value of same electric weight basis, and magnitude of voltage during the test charging, this electric weight corresponding voltage value during as charging.As shown in the table:
Electric weight |
0% |
10% |
30% |
50% |
70% |
90% |
100% |
Voltage (mv) |
3500 |
3700 |
3800 |
3900 |
3980 |
4080 |
4280 |
Charging curve can be shown according to this, with straight line or secondary and upper curve connection acquisition.
Second step: the electric weight update algorithm, under charging and standby two states, there is difference in cell voltage, so the electric weight that needs to distinguish under charging and standby two states upgrades.
(1), after starting, at first judgement is in charging or standby;
(2) read battery current voltage value (detecting electric weight), for the cell voltage that makes to read is more accurate, can average by repeatedly reading magnitude of voltage;
(3) judge whether under special operation condition, when special operation condition refers to working current higher than normal standby as shown in Figure 2 during the standby current of (non-working condition), as in conversation or shooting etc.If, under special operation condition, voltage is compensated, compensation method can be when entering this operating mode, to voltage compensation from this operating mode exits to the voltage difference after exiting; If not the battery voltage value of reading is constant.
(4) if charged state is called the voltage-electric quantity curve of charging, calculate corresponding charge value; If at holding state, call standby voltage-electric quantity curve and calculate corresponding charge value.
(5) calculate the difference diff of current calculating electric weight and current demonstration electric weight, according to difference diff, determine that cell voltage upgrades the electric weight time T.
A) diff=0, current calculating electric weight and current demonstration charge value are equal, and current demonstration charge value does not need to change, and arranges and reads the cell voltage renewal electric weight time interval T0 next time;
B) diff > 0, current calculating charge value is greater than current demonstration charge value, the variable up_count that will the current calculating charge value of sign be greater than current demonstration electric weight number of times increases by 1, will indicate that the variable down_count that current calculating charge value is less than current demonstration electric weight number of times is set to 0 simultaneously.Next judge whether up_count is greater than the maximal value of setting, if up_count is greater than the setting maximal value, and, in charged state, current demonstration charge value is increased to 1; If up_count is less than or equal to the setting maximal value, do not change current demonstration charge value, arrange and read the cell voltage time interval T1 next time according to the size of diff absolute value.
C) diff<0, current calculating charge value is less than current demonstration charge value, the variable down_count that will the current calculating charge value of sign be less than current demonstration electric weight number of times increases by 1, will indicate that the variable up_count that current calculating charge value is greater than current demonstration electric weight number of times is set to 0 simultaneously.Next judge whether down_count is greater than the maximal value of setting, if down_count is greater than the setting maximal value, and, at holding state, current demonstration charge value is reduced to 1; If down_count is less than or equal to the setting maximal value, do not change current demonstration charge value, arrange and read the cell voltage time interval T2 next time according to the size of diff absolute value.
(6) calculating of T, the size of T becomes inverse correlation with the size of diff absolute value, and, when current calculating charge value and current demonstration charge value differ larger, the next update time of electric weight is shorter.
A) when | diff|<n1, T0=a1;
B) when n1=<| diff|<=n2, T1=a2;
C) when n2<| diff|, T2=a3;
N1 wherein, n2 is positive integer, and n1<n2, desirable n1=n2/2, n1 can be by the experience value, as desirable 10;
A1, a2, a3 etc. are positive integer, and a1 > a2 > and a3, desirable a1=2*a2, a2=2*a3, the value of a1 is relevant with battery capacity, and shown in desirable Fig. 2, standby T.T. is divided by 100.
Above-mentioned each example of the present invention can be lithium battery, also can be other rechargeable batteries.The present invention charges and two voltage-electric quantity curve of standby by design, the virtual height problem that while having solved charging, electric weight shows.By repeatedly more current calculating charge value and current demonstration charge value, progressively upgrade current demonstration charge value, solved electric weight saltus step problem.By the absolute difference size of current calculating charge value and current demonstration charge value, determine and next electric weight update time make battery electric quantity accurately and timely to upgrade.To sum up can make the demonstration of electric weight accurately with stable, improve accuracy and the satisfaction of user's detection battery electric quantity.
The foregoing is only preferred embodiment of the present invention; not thereby limit the scope of the claims of the present invention; the variable set up that this explanation is used all can be equal to replacement, every technical scheme of the present invention is modified or is equal to replacement, all in scope of patent protection of the present invention.