CN101359037A - Method for implementing gradation for battery voltage of mobile terminal and the mobile terminal - Google Patents
Method for implementing gradation for battery voltage of mobile terminal and the mobile terminal Download PDFInfo
- Publication number
- CN101359037A CN101359037A CNA200810119906XA CN200810119906A CN101359037A CN 101359037 A CN101359037 A CN 101359037A CN A200810119906X A CNA200810119906X A CN A200810119906XA CN 200810119906 A CN200810119906 A CN 200810119906A CN 101359037 A CN101359037 A CN 101359037A
- Authority
- CN
- China
- Prior art keywords
- electric pressure
- divided
- array
- macrodefinition
- voltage
- 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.)
- Granted
Links
Images
Landscapes
- Telephone Function (AREA)
Abstract
The invention provides a mobile terminal battery voltage grading method and the mobile terminal thereof; the method comprises the following steps: establishing a voltage grading macro definition table, and defining the voltage grading macro definition table and a maximum voltage grade macro definition in the header file provided to an upper layer of module; defining a voltage grading array element structure and a voltage grading array in a voltage grade processing module file; obtaining the voltage grading array element value from the voltage grading macro definition table; and determining the voltage grade matching with the collected mobile terminal battery voltage, according to the voltage grading array element value. Through the technical proposal, program files do not need to be amended during the voltage grading modification so as to reduce the workload and save human resources.
Description
Technical field
The present invention relates to battery of mobile terminal, particularly relate to implementation method and this portable terminal that a kind of battery of mobile terminal electric pressure is divided.
Background technology
Portable terminal is with changing service time as electric weight grade on the mobile phone, and what of battery electric quantity this variation can reflect.Usually the implementation method of electric weight change of rank is by the hardware check cell voltage, becoming digital signal by analog to digital conversion then gathers for CPU, mobile phone CPU compares step by step by digital quantity that collects and the battery charge level table that pre-sets, match an only grade, then the numerical value of representing this grade is passed to display module, display module can regularly read this value, refreshes battery electric quantity according to this value and shows.
Generally the scope of the battery of mobile phone voltage of known models is determined, the different model mobile phone is different to the requirement of electric weight, and the grade of division also is not quite similar.The table of grading of battery of mobile phone voltage is corresponding bivariate table in software, and we are called the electric pressure table to it.The division progression difference of its electric pressure of mobile phone of the corresponding different model of same battery.This just requires will revise the electric pressure table as the case may be when software is realized, fixes for this table of mobile phone of same model.The normally modular structural design of cell phone software, its basic framework of the mobile phone of difference in functionality is constant.For the variation of electric pressure, unique what will revise is exactly this electric pressure table.
Software programmer only is concerned about the structure of electric pressure table, and is indifferent to the particular content in the table.The programmer is described as a two-dimensional array model to the corresponding relation of cell voltage and display level, corresponding two elements of each grade: voltage and display level.Find display level by comparative voltage.It is to add content in table that the work of getting off after the structure of electric pressure table has been arranged.Concrete electric pressure relation is determined by repetition test according to product needed by the hardware personnel.Normally the hardware personnel give the software developer test figure, and the software developer revises the size of array and the numerical value of array element.So each mobile phone upgrading all need be revised this table by the peopleware.The size of table will change.
In the implementation method that the mobile phone electric pressure of prior art is divided, usually electric pressure is divided the structure that directly is defined as two-dimensional array and put into program file.Exemplarily, when realizing, electric pressure is divided the structure that directly is defined as two-dimensional array put into following A.c file with the C language.
This A.c file comprises:
Maximum voltage grade macro definition
#define?MAX_VOLTAGE_LEVEL?6
Electric pressure array element organization definition
Typedef?struct
{
SINT32?voltage;
SINT32?value;
}T_VOL_CFG;
The final electric pressure that generates is divided array
T_VOL_CFG?voltage_table[MAX_VOLTAGE_LEVEL]=
{
{ v1, t1} ,/* 0-v1, a step voltage span */
V2, and t2} ,/* v1-v2, secondary voltage span */
V3, and t3} ,/* v2-v3, tertiary voltage span */
V4, and t4} ,/* v3-v4, level Four voltage span */
V5, and t5} ,/* v4-v5, Pyatyi voltage span */
V6, and t6} ,/* v5-v6, six step voltage span */
};
In this example, be example, wherein, when battery of mobile phone voltage is positioned at the 0-v1 scope, be shown as one-level cell voltage is divided into 6 grades; When battery of mobile phone voltage is positioned at the v1-v2 scope, be shown as secondary; When battery of mobile phone voltage is positioned at the v2-v3 scope, be shown as three grades; When battery of mobile phone voltage is positioned at the v3-v4 scope, be shown as level Four; When battery of mobile phone voltage is positioned at the v4-v5 scope, be shown as Pyatyi; When battery of mobile phone voltage is positioned at the v5-v6 scope, be shown as six grades.Wherein the t value representation is when the corresponding voltage grade, every t duration inquiry cell voltage; For example, when current voltage was one-level, the t1 duration was inquired about cell voltage at interval; When current voltage was secondary, the t2 duration was inquired about cell voltage at interval; By that analogy, other rank is similar, does not repeat them here.
When this program file utilizes said method, when needs are revised the electric pressure division of battery of mobile phone, when upgrading as mobile phone, all need directly this program file to be made amendment by the programmer at every turn, thereby, directly caused the maintainability of code poor, increased the workload of development and maintenance.
Summary of the invention
The purpose of this invention is to provide implementation method and this portable terminal that a kind of battery of mobile terminal electric pressure is divided, cause mobile battery electric pressure table not easy care, technical matters that maintenance workload is bigger with the implementation method that solves prior art.
To achieve these goals, the invention provides the implementation method that a kind of battery of mobile terminal electric pressure is divided, wherein, comprise the steps:
Set up electric pressure and divide macrodefinition table, and the described electric pressure of definition is divided macrodefinition table and maximum voltage grade macro definition in offering the header file of upper layer module; Described electric pressure is divided macrodefinition table, is used to define the corresponding relation between described cell voltage and the electric pressure; Described maximum voltage grade macro definition is used to define the greatest level number that described cell voltage desire is divided;
Definition electric pressure array element structure and electric pressure are divided array in electric pressure processing module file, determine the element number of described electric pressure division array according to described maximum voltage grade macro definition, and obtain the value that described electric pressure is divided array in the content from described electric pressure division macrodefinition table;
According to the value of described electric pressure division array, determine the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
Preferably, described implementation method wherein, also comprises when needs are revised the electric pressure division:
Revise described maximum voltage grade macro definition value in the described header file and/or described electric pressure and divide content in the macrodefinition table;
Determine the element number of amended described electric pressure division array and the value of element according to the content in amended described maximum voltage grade macro definition value and/or the described electric pressure division macrodefinition table;
According to the value of described amended electric pressure division array, determine the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
The present invention also provides a kind of portable terminal, comprises that the division of voltage acquisition module and electric pressure realizes module, and wherein, described electric pressure is divided and realized that module comprises:
Electric pressure macro definition module is used to set up electric pressure and divides macrodefinition table, and the described electric pressure of definition is divided macrodefinition table and maximum voltage grade macro definition in offering the header file of upper layer module; Described electric pressure is divided macrodefinition table, is used to define the corresponding relation between described cell voltage and the electric pressure; Described maximum voltage grade macro definition is used to define the greatest level number that described cell voltage desire is divided;
The electric pressure processing module, be used for dividing array in electric pressure processing module file definition electric pressure array element structure and electric pressure, determine the element number of described electric pressure division array according to described maximum voltage grade macro definition, and obtain the value that described electric pressure is divided array in the content from described electric pressure division macrodefinition table;
The electric pressure matching module is used for the value according to described electric pressure division array, determines the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
Preferably, described portable terminal wherein, also comprises:
Electric pressure is divided modified module, is used for revising the described maximum voltage grade macro definition value of described header file and/or the content in the described electric pressure division macrodefinition table;
Electric pressure is divided and is revised identification module, is used for determining the element number of amended described electric pressure division array and the value of array according to the content of amended described maximum voltage grade macro definition value and/or described electric pressure division macrodefinition table;
Electric pressure coupling modified module is used for the value according to described amended electric pressure division array, determines the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
Technique effect of the present invention is:
The present invention is by defining with macrodefined mode the greatest level number of revisable desire division and the corresponding relation between cell voltage and the electric pressure in header file, be about to original electric pressure number of partitions assembling and dismantling and be divided into electric pressure division macrodefinition table and electric pressure division array, be placed on respectively in header file and the program file, when needs are revised the cell voltage grade classification, the macro definition that only needs to revise in the header file gets final product, improved the maintainability of program greatly, reduce the workload of safeguarding, saved human resources.
Description of drawings
Fig. 1 is the schematic flow sheet of the battery of mobile terminal electric pressure of the embodiment of the invention implementation method of dividing;
Fig. 2 is the structural representation of embodiment of the invention portable terminal.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, describe the present invention below in conjunction with the accompanying drawings and the specific embodiments.
Fig. 1 is the schematic flow sheet of the battery of mobile terminal electric pressure of the embodiment of the invention implementation method of dividing.As Fig. 1, the implementation method of this embodiment comprises the steps:
The method of inventive embodiments is described is how to determine the electric pressure that is complementary according to the battery of mobile terminal voltage that collects.Further, the electric pressure that can on the display screen of portable terminal this be complementary shows.Exemplarily but not as restriction, above-mentioned steps can be carried out by the CPU of portable terminal.
Among this embodiment, because the greatest level number of the configurable cell voltage institute desire division that can revise and the corresponding relation between cell voltage and the electric pressure are defined in header file with macrodefined mode, when needs are revised the cell voltage grade classification, the macro definition that only needs to revise in the header file gets final product, like this, electric pressure processing module file this header file by reference can realize that electric pressure divides the automatic respective change of array, and the final electric pressure that generates that need not artificially to make amendment again in electric pressure processing module file is divided array, thereby strengthened the maintainability of program, reduce the workload when electric pressure is divided modification, saved human resources.
Preferably, the method for this embodiment also comprises the steps: when needs are revised the electric pressure division
Revise above-mentioned maximum voltage grade macro definition value in the above-mentioned header file and/or above-mentioned electric pressure and divide content in the macrodefinition table;
Determine the element number of amended above-mentioned electric pressure division array and the value of element according to the content in amended above-mentioned maximum voltage grade macro definition value and/or the above-mentioned electric pressure division macrodefinition table;
According to the value of above-mentioned amended electric pressure division array, determine the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
Be example with the C language below, enforcement of the present invention is described for a specific example.In this example, the greatest level number that the cell voltage desire is divided is 6, cell voltage can be divided into 6 grades, represents the greatest level number that this desire is divided with variable MAX_VOLTAGE_LEVEL; Represent electric pressure division macrodefinition table with VOLTAGE_LEVEL_TABLE.In this macrodefinition table, defined when portable terminal such as battery of mobile phone voltage are positioned at the 0-v1 scope, the electric pressure of coupling is an one-level; When cell voltage was positioned at the v1-v2 scope, the electric pressure of coupling was a secondary; When cell voltage was positioned at the v2-v3 scope, the electric pressure of coupling was three grades; When cell voltage was positioned at the v3-v4 scope, the electric pressure of coupling was a level Four; When cell voltage was positioned at the v4-v5 scope, the electric pressure of coupling was a Pyatyi; When cell voltage was positioned at the v5-v6 scope, the electric pressure of coupling was six grades.
Particularly, this example comprises the steps:
Step 1, it is as follows that definition maximum voltage grade macro definition and electric pressure are divided macrodefinition table in offering the header file of upper layer module:
Maximum voltage grade macro definition:
#define?MAX_VOLTAGE_LEVEL?6
Electric pressure is divided macrodefinition table:
#define?VOLTAGE_LEVEL_TABLE\
{ v1, t1} ,/* 0-v1, a step voltage span */
V2, and t2} ,/* v1-v2, secondary voltage span */
V3, and t3} ,/* v2-v3, tertiary voltage span */
V4, and t4} ,/* v3-v4, level Four voltage span */
V5, and t5} ,/* v4-v5, Pyatyi voltage span */
V6, and t6} ,/* v5-v6, six step voltage span */
Wherein the t value representation is when the corresponding voltage grade, every t duration inquiry cell voltage; For example, when current voltage was one-level, the t1 duration was inquired about cell voltage at interval; When current voltage was secondary, the t2 duration was inquired about cell voltage at interval; By that analogy, other rank is similar, does not repeat them here.
Step 2, definition electric pressure array element structure and electric pressure are divided array in electric pressure processing module file, and be as follows:
Electric pressure array element organization definition:
typedef?struct
{
SINT32?voltage;
SINT32?value;
}T_VOL_CFG;
Electric pressure is divided array define and initialization:
T_VOL_CFG?voltage_table[MAX_VOLTAGE_LEVEL]=
{
VOLTAGE_LEVEL_TABLE
};
Step 3 when needs are revised electric pressure and divided, is directly revised maximum voltage grade macro definition value MAX_VOLTAGE_LEVEL in the header file and electric pressure and is divided content among the macrodefinition table VOLTAGE_LEVEL_TABLE.Electric pressure in program file is divided array voltage_table along with maximum voltage grade macro definition MAX_VOLTAGE_LEVEL and electric pressure are divided the variation of macrodefinition table VOLTAGE_LEVEL_TABLE and variation automatically.
Compare with the implementation method of prior art, in the implementation method of the embodiment of the invention, original electric pressure number of partitions assembling and dismantling are divided into electric pressure divide macrodefinition table and electric pressure division array, be placed on respectively in header file (as * .h file) and the program file (as * .c file).Improved the maintainability of program after electric pressure division array and electric pressure division macrodefinition table are placed apart greatly.When needs are revised the electric pressure division, only need in header file, to revise the content that electric pressure is divided the macrodefinition table part, and electric pressure is divided the array content and can be regenerated automatically along with the variation that electric pressure is divided macrodefinition table, need not the update routine file, reduce workload, saved human resources.
On the other hand, the present invention also provides a kind of portable terminal.Fig. 2 is the structural representation of the portable terminal of the embodiment of the invention.As Fig. 2, this portable terminal 200 comprises: voltage acquisition module 201 and electric pressure are divided and are realized module 202, this electric pressure is divided and is realized that module comprises again: electric pressure macro definition module 203, be used to set up electric pressure and divide macrodefinition table, and the described electric pressure of definition is divided macrodefinition table and maximum voltage grade macro definition in offering the header file of upper layer module; Described electric pressure is divided macrodefinition table, is used to define the corresponding relation between described cell voltage and the electric pressure; Described maximum voltage grade macro definition is used to define the greatest level number that described cell voltage desire is divided; Electric pressure processing module 204, be used for dividing array in electric pressure processing module file definition electric pressure array element structure and electric pressure, determine the element number of described electric pressure division array according to described maximum voltage grade macro definition, and obtain the value that described electric pressure is divided array in the content from described electric pressure division macrodefinition table; Electric pressure matching module 205 is used for the value according to described electric pressure division array, determines the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
Preferably, the portable terminal of this embodiment also comprises: electric pressure is divided modified module, is used for revising the described maximum voltage grade macro definition value of described header file and/or the content in the described electric pressure division macrodefinition table; Electric pressure is divided and is revised identification module, is used for determining the element number of amended described electric pressure division array and the value of array according to the content of amended described maximum voltage grade macro definition value and/or described electric pressure division macrodefinition table; Electric pressure coupling modified module is used for the value according to described amended electric pressure division array, determines the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.
Claims (4)
1. the implementation method that the battery of mobile terminal electric pressure is divided is characterized in that, comprises the steps:
Set up electric pressure and divide macrodefinition table, and the described electric pressure of definition is divided macrodefinition table and maximum voltage grade macro definition in offering the header file of upper layer module; Described electric pressure is divided macrodefinition table, is used to define the corresponding relation between described cell voltage and the electric pressure; Described maximum voltage grade macro definition is used to define the greatest level number that described cell voltage desire is divided;
Definition electric pressure array element structure and electric pressure are divided array in electric pressure processing module file, determine the element number of described electric pressure division array according to described maximum voltage grade macro definition, and obtain the value that described electric pressure is divided array in the content from described electric pressure division macrodefinition table;
According to the value of described electric pressure division array, determine the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
2. implementation method according to claim 1 is characterized in that, revises at needs also to comprise when electric pressure is divided:
Revise described maximum voltage grade macro definition value in the described header file and/or described electric pressure and divide content in the macrodefinition table;
Determine the element number of amended described electric pressure division array and the value of element according to the content in amended described maximum voltage grade macro definition value and/or the described electric pressure division macrodefinition table;
According to the value of described amended electric pressure division array, determine the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
3. a portable terminal comprises that the division of voltage acquisition module and electric pressure realizes module, it is characterized in that described electric pressure is divided and realized that module comprises:
Electric pressure macro definition module is used to set up electric pressure and divides macrodefinition table, and the described electric pressure of definition is divided macrodefinition table and maximum voltage grade macro definition in offering the header file of upper layer module; Described electric pressure is divided macrodefinition table, is used to define the corresponding relation between described cell voltage and the electric pressure; Described maximum voltage grade macro definition is used to define the greatest level number that described cell voltage desire is divided;
The electric pressure processing module, be used for dividing array in electric pressure processing module file definition electric pressure array element structure and electric pressure, determine the element number of described electric pressure division array according to described maximum voltage grade macro definition, and obtain the value that described electric pressure is divided array in the content from described electric pressure division macrodefinition table;
The electric pressure matching module is used for the value according to described electric pressure division array, determines the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
4. portable terminal according to claim 3 is characterized in that, also comprises:
Electric pressure is divided modified module, is used for revising the described maximum voltage grade macro definition value of described header file and/or the content in the described electric pressure division macrodefinition table;
Electric pressure is divided and is revised identification module, is used for determining the element number of amended described electric pressure division array and the value of array according to the content of amended described maximum voltage grade macro definition value and/or described electric pressure division macrodefinition table;
Electric pressure coupling modified module is used for the value according to described amended electric pressure division array, determines the electric pressure that is complementary with the battery of mobile terminal voltage that collects.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200810119906XA CN101359037B (en) | 2008-09-09 | 2008-09-09 | Method for implementing gradation for battery voltage of mobile terminal and the mobile terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200810119906XA CN101359037B (en) | 2008-09-09 | 2008-09-09 | Method for implementing gradation for battery voltage of mobile terminal and the mobile terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101359037A true CN101359037A (en) | 2009-02-04 |
CN101359037B CN101359037B (en) | 2010-12-08 |
Family
ID=40331534
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN200810119906XA Expired - Fee Related CN101359037B (en) | 2008-09-09 | 2008-09-09 | Method for implementing gradation for battery voltage of mobile terminal and the mobile terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101359037B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103051023A (en) * | 2012-12-18 | 2013-04-17 | 深圳市金立通信设备有限公司 | Method and device for managing battery charging circuit |
CN104375092A (en) * | 2014-11-18 | 2015-02-25 | 河北省电力建设调整试验所 | Method for detecting dry battery voltage by using mobile phone |
-
2008
- 2008-09-09 CN CN200810119906XA patent/CN101359037B/en not_active Expired - Fee Related
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103051023A (en) * | 2012-12-18 | 2013-04-17 | 深圳市金立通信设备有限公司 | Method and device for managing battery charging circuit |
CN103051023B (en) * | 2012-12-18 | 2015-09-02 | 深圳市金立通信设备有限公司 | A kind of method and device managing battery charger |
CN104375092A (en) * | 2014-11-18 | 2015-02-25 | 河北省电力建设调整试验所 | Method for detecting dry battery voltage by using mobile phone |
Also Published As
Publication number | Publication date |
---|---|
CN101359037B (en) | 2010-12-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103645954B (en) | A kind of CPU dispatching method based on heterogeneous multi-core system, device and system | |
CN101082865A (en) | Automatically generating method based on data driving interface | |
CN103176774A (en) | Compiling method, compiling device and compiling system of application program | |
CN106852187A (en) | A kind of technical ability bag recommendation apparatus and method based on user's portrait | |
CN103324620A (en) | Method and device for rectifying marking results | |
CN110102058A (en) | The generation method of Virtual Building model, device, processor and terminal in game | |
CN105450684B (en) | Cloud computing resource scheduling method and system | |
CN110516817A (en) | A kind of model training data load method and device | |
CN107944606A (en) | A kind of water integrated Environmental coupling system in service-oriented vacant lot | |
CN106780149A (en) | A kind of equipment real-time monitoring system based on timed task scheduling | |
CN104750780A (en) | Hadoop configuration parameter optimization method based on statistic analysis | |
CN104391879A (en) | Method and device for hierarchical clustering | |
CN112182359A (en) | Feature management method and system of recommendation model | |
CN101359037B (en) | Method for implementing gradation for battery voltage of mobile terminal and the mobile terminal | |
CN104901981A (en) | Method, device and system for analyzing user behavior | |
CN112541584A (en) | Deep neural network model parallel mode selection method | |
CN111242314B (en) | Deep learning accelerator benchmark test method and device | |
CN108920353A (en) | A kind of test method, device and electronic equipment | |
CN114896108A (en) | Test verification system | |
CN106294307A (en) | Language material screening technique and device | |
CN113360631A (en) | Intelligent volume assembling method and device | |
CN109101268A (en) | Intelligent terminal configuration method, electronic device and computer readable storage medium | |
CN117130888A (en) | Automatic server tuning method and system based on historical data and machine learning | |
CN106874129A (en) | A kind of operating system process scheduling order determines method and control method | |
CN101442539A (en) | Method and apparatus for implementing field filtration |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20101208 Termination date: 20150909 |
|
EXPY | Termination of patent right or utility model |