CN102945210A - Achieving method for variable storage based on central processing unit (CPU) power failure interruption - Google Patents

Achieving method for variable storage based on central processing unit (CPU) power failure interruption Download PDF

Info

Publication number
CN102945210A
CN102945210A CN2012104747931A CN201210474793A CN102945210A CN 102945210 A CN102945210 A CN 102945210A CN 2012104747931 A CN2012104747931 A CN 2012104747931A CN 201210474793 A CN201210474793 A CN 201210474793A CN 102945210 A CN102945210 A CN 102945210A
Authority
CN
China
Prior art keywords
cpu
space
variable storage
power
interruption
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
Application number
CN2012104747931A
Other languages
Chinese (zh)
Other versions
CN102945210B (en
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.)
FUZHOU CHANGHUI AUTOMATION SYSTEM Co Ltd
Original Assignee
FUZHOU CHANGHUI AUTOMATION SYSTEM 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 FUZHOU CHANGHUI AUTOMATION SYSTEM Co Ltd filed Critical FUZHOU CHANGHUI AUTOMATION SYSTEM Co Ltd
Priority to CN201210474793.1A priority Critical patent/CN102945210B/en
Publication of CN102945210A publication Critical patent/CN102945210A/en
Application granted granted Critical
Publication of CN102945210B publication Critical patent/CN102945210B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Charge And Discharge Circuits For Batteries Or The Like (AREA)

Abstract

The invention relates to an achieving method for variable storage based on central processing unit (CPU) power failure interruption. The method is characterized in that a space is divided from a FLASH program space of a CPU which is utilized to conduct power failure detection, the interruption is triggered after power failure is detected, and parameter to be stored is stored in the space. The achieving method can achieve power failure storage of parameter of an industrial control instrument without an external storage chip, saves equipment cost and improves market competitiveness.

Description

A kind of implementation method of the variable storage based on the CPU power-fail interrupt
Technical field
The present invention relates to industrial control instrument variable storage technical field, particularly a kind of implementation method of the variable storage based on the CPU power-fail interrupt.
Background technology
In the design of industrial control instrument, some variable (such as integrated flux, duty etc.) needs real-time update, and band power down hold function, the general special RAM chip of preserving with power down that adopts is realized in the design, such as FRAM, NVRAM etc., or realize that with the mode of RAM external connection battery power down preserves.This kind mode is not only wanted an exterior storage chip, has improved the cost of product, and the increase of part has also limited the serviceable life of product and the cost of later maintenance.In addition, owing to wanting real-time storage, also increased the burden that system program is carried out.
Summary of the invention
The implementation method that the purpose of this invention is to provide a kind of variable storage based on the CPU power-fail interrupt can realize just accomplishing without the exterior storage chip power down storage of industrial control instrument parameter.
The present invention adopts following scheme to realize: a kind of implementation method of the variable storage based on the CPU power-fail interrupt, it is characterized in that: mark off a space in the FLASH of the CPU program space, utilize described CPU detection of power loss, trigger an interruption after detecting power down, the parameter that will preserve deposits described space in.
In an embodiment of the present invention, described space is in the terminal division of the FLASH program space.
In an embodiment of the present invention, limit priority is arranged in described interruption in program.
In an embodiment of the present invention, also comprise the storage capacitor capacity that increases described CPU feeder ear.
In an embodiment of the present invention, described capacitance is 1000uf.
In an embodiment of the present invention, also be included in and first the parameter in the described space wiped by working procedure before the described interruption.
In an embodiment of the present invention, described detection of power loss is the supply voltage that detects described CPU when being lower than 2.9V, triggers described interruption.
Method of the present invention has not only been saved the power down memory device, has reduced hardware cost, the production maintenance cost of product, and has improved the reliability of complete machine, has further promoted the cost performance of product, remarkable in economical benefits.
Description of drawings
Fig. 1 is the inventive method implementing procedure principle schematic.
Embodiment
The present invention will be further described below in conjunction with drawings and Examples.
The present embodiment provides a kind of implementation method of the variable storage based on the CPU power-fail interrupt, it is characterized in that: mark off a space in the FLASH of the CPU program space, utilize described CPU detection of power loss, trigger an interruption after detecting power down, the parameter that will preserve deposits described space in.
Above-mentioned space is in the terminal division of the FLASH program space.
Limit priority is arranged in above-mentioned interruption in program.
In addition, method of the present invention also comprises the storage capacitor capacity that increases described CPU feeder ear.Described capacitance is 1000uf.
In an embodiment of the present invention, also be included in and first the parameter in the described space wiped by working procedure before the described interruption.Described detection of power loss is the supply voltage that detects described CPU when being lower than 2.9V, triggers described interruption.
Concrete, seeing also Fig. 1, the method for the present embodiment marks off the sub-fraction space at the FLASH of CPU program space end, is used for the power down storage of parameter, has omitted outside power down storage RAM chip.Utilize CPU detection of power loss function, when the supply voltage of CPU (normally being 3.3V) when being lower than 2.9V, produce power-fail interrupt, this moment, voltage continued to descend, quit work fully to CPU and to also have a bit of time, utilize the parameter that in the power-fail interrupt handling procedure, will preserve during this period of time to deposit the flash space in, after powering on next time, from program FLASH space, again read among the RAM, thereby the power down that realizes parameter is preserved.In the present embodiment, in order to guarantee the quick response of this interruption, can in the CPU program design, power-fail interrupt be designed to the preemptive type limit priority.
Consider the characteristic that FLASH could programming after need to wiping, and the execution time of 1 erasing instruction surpasses 10ms, therefore in Software for Design, wipe first parameter F LASH district in the normal working procedure of the present embodiment employing before power-fail interrupt, the mode of direct write parameters guarantees to carry out length effective time of preservation in the power-fail interrupt handling procedure, carries out simultaneously the reliability redundancy design of relevant software kit.
Be noted that, method of the present invention is not in the situation that increase external hardware, can realize the power down preservation of a small amount of parameter (in 64 bytes), when the data of needs preservation are more, can increase the storage capacitor capacity of CPU feeder ear, prolong the time that power-fail interrupt is processed, to preserve more data.Test increases the electric capacity of 1000uf, save data can be expanded to 1KB.The present invention is specially adapted in the industrial control instrument, can significantly reduce the cost of industrial control instrument.
The above only is preferred embodiment of the present invention, and all equalizations of doing according to the present patent application claim change and modify, and all should belong to covering scope of the present invention.

Claims (7)

1. implementation method based on the variable storage of CPU power-fail interrupt, it is characterized in that: mark off a space in the FLASH of the CPU program space, utilize described CPU detection of power loss, trigger an interruption after detecting power down, the parameter that will preserve deposits described space in.
2. the implementation method of the variable storage based on the CPU power-fail interrupt according to claim 1 is characterized in that: described space is to divide the FLASH program space is terminal.
3. the implementation method of the variable storage based on the CPU power-fail interrupt according to claim 1, it is characterized in that: limit priority is arranged in described interruption in program.
4. the implementation method of the variable storage based on the CPU power-fail interrupt according to claim 1 is characterized in that: also comprise the storage capacitor capacity that increases described CPU feeder ear.
5. the implementation method of the variable storage based on the CPU power-fail interrupt according to claim 4, it is characterized in that: described capacitance is 1000uf.
6. the implementation method of the variable storage based on the CPU power-fail interrupt according to claim 1 is characterized in that: first the parameter in the described space is wiped by working procedure before also being included in described interruption.
7. the implementation method of the variable storage based on the CPU power-fail interrupt according to claim 1 is characterized in that: described detection of power loss is the supply voltage that detects described CPU when being lower than 2.9V, triggers described interruption.
CN201210474793.1A 2012-11-21 2012-11-21 A kind of implementation method of the variable storage based on CPU power-fail interrupt Active CN102945210B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210474793.1A CN102945210B (en) 2012-11-21 2012-11-21 A kind of implementation method of the variable storage based on CPU power-fail interrupt

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210474793.1A CN102945210B (en) 2012-11-21 2012-11-21 A kind of implementation method of the variable storage based on CPU power-fail interrupt

Publications (2)

Publication Number Publication Date
CN102945210A true CN102945210A (en) 2013-02-27
CN102945210B CN102945210B (en) 2015-12-02

Family

ID=47728158

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210474793.1A Active CN102945210B (en) 2012-11-21 2012-11-21 A kind of implementation method of the variable storage based on CPU power-fail interrupt

Country Status (1)

Country Link
CN (1) CN102945210B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105301349A (en) * 2015-09-22 2016-02-03 深圳市科陆电子科技股份有限公司 Electric energy meter power outage display processing method
CN107908571A (en) * 2017-10-31 2018-04-13 成都华为技术有限公司 A kind of method for writing data, flash memory device and storage device
CN109032005A (en) * 2018-07-02 2018-12-18 上海稊米汽车科技有限公司 A kind of vehicle electronic control unit with power down abnormality processing

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2577295Y (en) * 2002-10-16 2003-10-01 陈立珉 Intelligent electric-energy metering and controlling integrated electricity meter
US20060059385A1 (en) * 2004-09-02 2006-03-16 Atri Sunil R Volatile storage based power loss recovery mechanism
CN101527067A (en) * 2008-03-07 2009-09-09 鞍山市华业电力设备制造有限公司 Intelligent metering control electricity meter box
CN201477136U (en) * 2009-03-20 2010-05-19 无锡爱森思电气科技有限公司 Color LCD multifunctional power instrument
CN102622257A (en) * 2012-04-25 2012-08-01 钜泉光电科技(上海)股份有限公司 On-line meter self-updating method and device
CN202512170U (en) * 2012-04-19 2012-10-31 上海大亚科技有限公司 Intelligent ammeter communication module circuit structure having power-off protection function

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2577295Y (en) * 2002-10-16 2003-10-01 陈立珉 Intelligent electric-energy metering and controlling integrated electricity meter
US20060059385A1 (en) * 2004-09-02 2006-03-16 Atri Sunil R Volatile storage based power loss recovery mechanism
CN101527067A (en) * 2008-03-07 2009-09-09 鞍山市华业电力设备制造有限公司 Intelligent metering control electricity meter box
CN201477136U (en) * 2009-03-20 2010-05-19 无锡爱森思电气科技有限公司 Color LCD multifunctional power instrument
CN202512170U (en) * 2012-04-19 2012-10-31 上海大亚科技有限公司 Intelligent ammeter communication module circuit structure having power-off protection function
CN102622257A (en) * 2012-04-25 2012-08-01 钜泉光电科技(上海)股份有限公司 On-line meter self-updating method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105301349A (en) * 2015-09-22 2016-02-03 深圳市科陆电子科技股份有限公司 Electric energy meter power outage display processing method
CN107908571A (en) * 2017-10-31 2018-04-13 成都华为技术有限公司 A kind of method for writing data, flash memory device and storage device
CN107908571B (en) * 2017-10-31 2021-04-20 成都华为技术有限公司 Data writing method, flash memory device and storage equipment
CN109032005A (en) * 2018-07-02 2018-12-18 上海稊米汽车科技有限公司 A kind of vehicle electronic control unit with power down abnormality processing

Also Published As

Publication number Publication date
CN102945210B (en) 2015-12-02

Similar Documents

Publication Publication Date Title
EP2400628A3 (en) Battery protecting circuit, controlling method of the same and battery pack
CN104090527B (en) A kind of power-down protection apparatus
WO2006109289A3 (en) Smartcard power management
WO2011013945A3 (en) Mobile terminal and operation method for the same
CN102945210A (en) Achieving method for variable storage based on central processing unit (CPU) power failure interruption
EP2077481A3 (en) Energy storage module
EP2063361A3 (en) Storage apparatus, control method therefor, and storage system
EP2680560A3 (en) Information processing apparatus, method for controlling information processing apparatus, and storage medium
CN105279109A (en) Solid state disk power down protection circuit and power down protection method
CN107394833A (en) Adapter, supply unit and the guard method put excessively
CN101661435A (en) Data processing apparatus
CN108445802B (en) Robot sleep control method and circuit, communication device and robot
CN202771180U (en) Programmable controller capable of saving when power goes off
CN103580098A (en) Electric device
WO2020079268A3 (en) Tool having a working end determining device in the shaft region
WO2017092226A1 (en) Charging current adjustment method and mobile terminal
CN201794790U (en) Control system for screw air compressor
CN104111382A (en) Capacitance detection method and device for capacitor
US20200381933A1 (en) Electric working machine
CN203278240U (en) Reactive compensation controller of power supply resetting detection technology
CN201754230U (en) Power failure data storage circuit
CN203104083U (en) Power failure protection circuit
CN104408015A (en) USB (universal serial bus) mode adaptive method of communication module
CN203386208U (en) Master control board circuit based on DSP chip
CN202444538U (en) Power-down protection system for smart phone

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