CN104049218A - Battery electric quantity detection method based on Loongson 2H platform - Google Patents

Battery electric quantity detection method based on Loongson 2H platform Download PDF

Info

Publication number
CN104049218A
CN104049218A CN201410314036.7A CN201410314036A CN104049218A CN 104049218 A CN104049218 A CN 104049218A CN 201410314036 A CN201410314036 A CN 201410314036A CN 104049218 A CN104049218 A CN 104049218A
Authority
CN
China
Prior art keywords
battery
electric quantity
low charge
charge alert
alert lamp
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
CN201410314036.7A
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.)
Shandong Chaoyue Numerical Control Electronics Co Ltd
Original Assignee
Shandong Chaoyue Numerical Control Electronics Co 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 Shandong Chaoyue Numerical Control Electronics Co Ltd filed Critical Shandong Chaoyue Numerical Control Electronics Co Ltd
Priority to CN201410314036.7A priority Critical patent/CN104049218A/en
Publication of CN104049218A publication Critical patent/CN104049218A/en
Pending legal-status Critical Current

Links

Landscapes

  • Tests Of Electric Status Of Batteries (AREA)
  • Charge And Discharge Circuits For Batteries Or The Like (AREA)
  • Secondary Cells (AREA)

Abstract

The invention discloses a battery electric quantity detection method based on a Loongson 2H platform. A battery electric quantity detection program, a control unit and an LED electric quantity warning lamp are involved in the method, and the control unit converts detected extant battery electric quantity into digital signals, sends the digital signals to the battery electric quantity detection program and controls on-off of the LED electric quantity warning lamp through instruction signals sent by the battery electric quantity detection program. By the adoption of the detection method, the battery electric quantity can be detected based on the field of the Loongson 2H platform.

Description

A kind of battery electricity detection method based on Godson 2H platform
Technical field
The present invention relates to computer battery electric weight technical field, be specifically related to a kind of battery electricity detection method based on Godson 2H platform, for detection of the existing electric weight of notebook or panel computer battery, and compare with low charge alert value, control the light on and off of low charge alert lamp.
Background technology
Current most of notebook or dull and stereotyped battery electric quantity information are to be all presented in the icon in the operating system lower right corner, and user cannot learn battery electric quantity information intuitively, and it is extremely important at some special occasions, to grasp battery electric quantity information.Current battery detection method of quantity of electricity is mainly for Windows operating system, and in autonomous controlled field, especially Godson 2H platform field, does not also have correlation technique.
Godson 2h is researched and developed by cas computer, and it is integrated CPU on a chip, graphic process unit, and north bridge and South Bridge chip.Godson 2H adopts based on MIPS64 instruction set, can move a plurality of operating system.
Summary of the invention
The technical problem to be solved in the present invention is: a kind of battery electricity detection method based on Godson 2H platform is provided.
The technical solution adopted in the present invention is:
A kind of battery electricity detection method based on Godson 2H platform, described method comprises battery electric quantity trace routine, control module and LED charge alert lamp, wherein control module is converted to digital signal by the existing electric weight of the battery of detection and sends to battery electric quantity trace routine, and the command signal sending by battery electric quantity trace routine, control the light on and off of LED charge alert lamp.
The testing process of described method is: operating system by program at set intervals poll read the information about power of battery, first read battery charging and discharging state, if battery being detected charges, read again low charge alert lamp state, if low charge alert lamp is bright, close low charge alert lamp; If battery detected, discharge, then read the existing electric weight of battery, if electric weight is less than warning value at present, turns on low charge alert lamp, otherwise close low charge alert lamp.
The step that described method realizes is as follows:
(1), first read battery charging and discharging status information, under file reading system/sys/class/power_supply/icpc-bq-battery/status battery status value;
(2) if the value that step 1 is returned is Charging, show that battery charges, then from file/dev/loongson1-gpio, read the state of low charge alert lamp, if rreturn value is 1, in/dev/loongson1-gpio, write 0, close low charge alert lamp.
(3), if step 1 rreturn value is not Charging, show that battery discharges, program reads total electric weight of battery from/sys/class/power_supply/icpc-bq-battery/energy_full, from/sys/class/power_supply/icpc-bq-battery/energy_now, read existing electric weight, existing electric weight/total electric weight obtains the existing number percent of battery electric quantity, contrast with low charge alert value, if lower than minimum battery electric quantity percentage, in/dev/loongson1-gpio, write 1, turn on low charge alert lamp, otherwise write 0, close low charge alert lamp,
(4), after program compilation passes through, program is added in start self-starting item.
Beneficial effect of the present invention is: adopt detection method provided by the present invention, the battery electric quantity that can realize based on Godson 2H platform field detects.
Accompanying drawing explanation
Fig. 1 is structured flowchart of the present invention;
Fig. 2 is battery electricity detection method process flow diagram of the present invention.
Embodiment
With reference to the accompanying drawings, by embodiment, the present invention is further described:
A kind of battery electricity detection method based on Godson 2H platform, described method comprises battery electric quantity trace routine, control module and LED charge alert lamp, wherein control module is converted to digital signal by the existing electric weight of the battery of detection and sends to battery electric quantity trace routine, and the command signal sending by battery electric quantity trace routine, control the light on and off of LED charge alert lamp.
The testing process of described method is: operating system by program at set intervals poll read the information about power of battery, first read battery charging and discharging state, if battery being detected charges, read again low charge alert lamp state, if low charge alert lamp is bright, close low charge alert lamp; If battery detected, discharge, then read the existing electric weight of battery, if electric weight is less than warning value at present, turns on low charge alert lamp, otherwise close low charge alert lamp.
The step that described method realizes is as follows:
(1), first read battery charging and discharging status information, under file reading system/sys/class/power_supply/icpc-bq-battery/status battery status value;
(2) if the value that step (1) is returned is Charging, show that battery charges, then from file/dev/loongson1-gpio, read the state of low charge alert lamp, if rreturn value is 1, in/dev/loongson1-gpio, write 0, close low charge alert lamp.
(3), if step (1) rreturn value is not Charging, show that battery discharges, program reads total electric weight of battery from/sys/class/power_supply/icpc-bq-battery/energy_full, from/sys/class/power_supply/icpc-bq-battery/energy_now, read existing electric weight, existing electric weight/total electric weight obtains the existing number percent of battery electric quantity, contrast with low charge alert value, if lower than minimum battery electric quantity percentage, in/dev/loongson1-gpio, write 1, turn on low charge alert lamp, otherwise write 0, close low charge alert lamp,
(4), after program compilation passes through, program is added in start self-starting item.

Claims (3)

1. the battery electricity detection method based on Godson 2H platform, it is characterized in that: described method comprises battery electric quantity trace routine, control module and LED charge alert lamp, wherein control module is converted to digital signal by the existing electric weight of the battery of detection and sends to battery electric quantity trace routine, and the command signal sending by battery electric quantity trace routine, control the light on and off of LED charge alert lamp.
2. a kind of battery electricity detection method based on Godson 2H platform according to claim 1, it is characterized in that, the testing process of described method is: operating system by battery electric quantity trace routine at set intervals poll read the information about power of battery, first read battery charging and discharging state, if battery being detected charges, read again low charge alert lamp state, if low charge alert lamp is bright, close low charge alert lamp; If battery detected, discharge, then read the existing electric weight of battery, if electric weight is less than warning value at present, turns on low charge alert lamp, otherwise close low charge alert lamp.
3. a kind of battery electricity detection method based on Godson 2H platform according to claim 1 and 2, is characterized in that, the step that described method realizes is as follows:
(1), first read battery charging and discharging status information, under file reading system/sys/class/power_supply/icpc-bq-battery/status battery status value;
(2) if the value that step (1) is returned is Charging, show that battery charges, then from file/dev/loongson1-gpio, read the state of low charge alert lamp, if rreturn value is 1, in/dev/loongson1-gpio, write 0, close low charge alert lamp;
(3), if step (1) rreturn value is not Charging, show that battery discharges, program reads total electric weight of battery from/sys/class/power_supply/icpc-bq-battery/energy_full, from/sys/class/power_supply/icpc-bq-battery/energy_now, read existing electric weight, existing electric weight/total electric weight obtains the existing number percent of battery electric quantity, contrast with low charge alert value, if lower than minimum battery electric quantity percentage, in/dev/loongson1-gpio, write 1, turn on low charge alert lamp, otherwise write 0, close low charge alert lamp,
(4), after program compilation passes through, program is added in start self-starting item.
CN201410314036.7A 2014-07-03 2014-07-03 Battery electric quantity detection method based on Loongson 2H platform Pending CN104049218A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410314036.7A CN104049218A (en) 2014-07-03 2014-07-03 Battery electric quantity detection method based on Loongson 2H platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410314036.7A CN104049218A (en) 2014-07-03 2014-07-03 Battery electric quantity detection method based on Loongson 2H platform

Publications (1)

Publication Number Publication Date
CN104049218A true CN104049218A (en) 2014-09-17

Family

ID=51502305

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410314036.7A Pending CN104049218A (en) 2014-07-03 2014-07-03 Battery electric quantity detection method based on Loongson 2H platform

Country Status (1)

Country Link
CN (1) CN104049218A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107728067A (en) * 2017-09-19 2018-02-23 上海斐讯数据通信技术有限公司 A kind of terminal power measuring method and system
CN108738112A (en) * 2017-04-20 2018-11-02 广东顺德中山大学卡内基梅隆大学国际联合研究院 Multiple antennas passive data emission system and its implementation based on timeslice poll

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108738112A (en) * 2017-04-20 2018-11-02 广东顺德中山大学卡内基梅隆大学国际联合研究院 Multiple antennas passive data emission system and its implementation based on timeslice poll
CN108738112B (en) * 2017-04-20 2021-05-11 广东顺德中山大学卡内基梅隆大学国际联合研究院 Multi-antenna passive data transmitting system based on time slice polling and implementation method thereof
CN107728067A (en) * 2017-09-19 2018-02-23 上海斐讯数据通信技术有限公司 A kind of terminal power measuring method and system

Similar Documents

Publication Publication Date Title
CN102156524B (en) adaptive universal serial bus charging method and system
CN104272388A (en) Ultra-deep power-down mode for memory devices
TW200518107A (en) Voltage regulator with bypass for multi-voltage storage system
CN205195387U (en) Stake of charging and fall electric memory circuit thereof
CN101340110A (en) USB OTC device power source and implementing method thereof
CN203589769U (en) Mobile power supply having PM2.5 detection function
CN101651335A (en) Electronic equipment protection device and electronic equipment
CN106155203A (en) A kind of Intelligent bracelet with electronic pointer function
CN104049218A (en) Battery electric quantity detection method based on Loongson 2H platform
CN204087809U (en) A kind of solid state hard disc data security erase equipment
CN104424082A (en) Information processing method and electronic equipment
CN104181380A (en) Light load current detection system
CN105490319B (en) A kind of information processing method and electronic equipment
CN203324427U (en) Wiring harness on-off detector
US20140197804A1 (en) Charging system and charging method thereof
CN103123463B (en) A kind of method and device of control system state
CN101576825B (en) Embedded integrated circuit programmer
CN204537701U (en) EEPROM on-line/off-line burning instrument
CN103970706A (en) External expansion system of mobile device based on FT311D interface chip
CN207924652U (en) A kind of computer hardware test system
TWI433374B (en) Electrical device and battery management method thereof
CN203324974U (en) Interface device identifying externally-connected fitting automatically
CN206412794U (en) A kind of power supply switch circuit and virtual reality device
CN205016214U (en) Touch screen control device that can show luminance according to environment light intensity automatic adjustment
CN104009521A (en) Battery electric quantity detecting and displaying device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20140917

RJ01 Rejection of invention patent application after publication