EEPROM erasing and writing balancing method applied to electronic remote water meter

文档序号:1845424 发布日期:2021-11-16 浏览:5次 中文

阅读说明:本技术 一种应用于电子远传水表的eeprom擦写平衡方法 (EEPROM erasing and writing balancing method applied to electronic remote water meter ) 是由 范建华 徐军然 陈维广 刘永广 石潇龙 刘金亮 窦克森 朱文亚 于津 张公森 韩 于 2021-01-12 设计创作,主要内容包括:本发明公开了一种应用于电子远传水表的EEPROM擦写平衡方法,根据EEPROM特性、数据结构、数据读写频率和使用场景,划分数据存储单元和状态标识单元;然后通过状态标识单元利用位记录擦写信息;其次根据状态标识单元记录的信息判断下一次写入的位置,修改对应的标识并存储数据;最后,状态标识单元和数据存储单元空间资源耗尽后进行一次擦除,如此循环,实现了EEPROM擦写平衡。本发明大幅度提高EEPROM使用寿命,相比传统方法降低了记录信息所用的空间,提高了EEPROM的空间利用率。(The invention discloses an EEPROM erasing balance method applied to an electronic remote water meter, which is characterized in that a data storage unit and a state identification unit are divided according to EEPROM characteristics, a data structure, data reading and writing frequency and a use scene; then, recording erasing information by using the bit through the state identification unit; secondly, judging the position of the next writing according to the information recorded by the state identification unit, modifying the corresponding identification and storing data; and finally, erasing once after the space resources of the state identification unit and the data storage unit are exhausted, and repeating the steps to realize the erasing balance of the EEPROM. The invention greatly prolongs the service life of the EEPROM, reduces the space used for recording information compared with the traditional method and improves the space utilization rate of the EEPROM.)

1. An EEPROM erasing and writing balancing method applied to an electronic remote water meter is characterized by comprising the following steps:

step 1: dividing a storage space of a data storage unit and a storage space of a state identification unit according to the EEPROM characteristics, the data structure, the data read-write frequency and the use scene, wherein the state identification unit records erasing information by using bits;

step 2: reading the state identification unit content from the EEPROM;

and step 3: judging whether the state identification units are all 0; if all 0 s are 0 s, the step 4 is entered, and if not all 0 s are 0 s, the step 5 is entered;

and 4, step 4: erasing the state identification unit and the data storage unit;

and 5: and (3) judging the writing position, namely the first bit of the state identification unit, which is not 0, changing the state identification, writing the data and the state identification, completing erasing balance, and returning to the step (2) for repeated operation when the data needs to be written again.

2. The method as claimed in claim 1, wherein the step 1 is to divide the storage area into a data storage unit and a status identification unit.

3. The method as claimed in claim 1, wherein the first bit of the status flag unit in step 5, which is not 0, is the next position to be written.

Technical Field

The invention relates to the technical field of prolonging the service life of a storage, in particular to an EEPROM erasing and writing balance method applied to an electronic remote water meter.

Background

In the erasing process of the EEPROM, electrons are captured by the oxide to form a barrier, so that higher voltage is required for erasing. After the oxide channel condition is deteriorated, leakage is generated, so that the floating gate is no longer 100% insulated, the data retention time becomes unstable, the erasing life (cycle period) is generally 10 ten thousand times, and for some products which need to access data frequently and require a long service life, the erasing times can become the bottleneck of the product life.

The erasing balance refers to the balanced erasing of the EEPROM, so that the service life of the EEPROM is prolonged. At present, the erasing and writing information is recorded by using a storage space which is several times as long as the stored data and a space with the same number of bytes so as to realize the purpose of erasing and writing balance, and half of the space is used for storing state information which is irrelevant to the data, so that the space utilization rate of the EEPROM is lower.

Disclosure of Invention

Aiming at the defects and shortcomings of the prior art, the invention provides the EEPROM erasing and writing balancing method applied to the electronic remote water meter, the proper storage space is selected according to the data structure, the access frequency and the EEPROM characteristics, the erasing and writing information is recorded in bits, the service life of the EEPROM is prolonged, and the space utilization rate of the EEPROM is improved.

In order to achieve the above object, the present invention provides an erase/write balancing method for an EEPROM, comprising the steps of:

step 1: dividing a storage space of a data storage unit and a storage space of a state identification unit according to the EEPROM characteristics, the data structure, the data read-write frequency and the use scene, wherein the state identification unit records erasing information by using bits;

step 2: reading the state identification unit content from the EEPROM;

and step 3: judging whether the state identification units are all 0; if all 0 s are 0 s, the step 4 is entered, and if not all 0 s are 0 s, the step 5 is entered;

and 4, step 4: erasing the state identification unit and the data storage unit;

and 5: and (3) judging the writing position, namely the first bit of the state identification unit, which is not 0, changing the state identification, writing the data and the state identification, completing erasing balance, and returning to the step (2) for repeated operation when the data needs to be written again.

Generally, a single page is used as a storage space, the first byte/the first two bytes are used as a status identification unit, and the written position and the position to be written next time are recorded by bit. The number of bits of the state identification unit is the same as the number of bytes of the storage unit, and the erasing is performed once in each cycle, so that the balanced erasing can be realized in the cycle, and the service life of the EEPROM is prolonged.

Further, in step 1, the storage area is divided into a data storage unit and a state identification unit.

Further, in step 5, the first bit of the state identification unit not being 0 is the next position to be written.

The invention has the beneficial technical effects that: the storage unit with the length of L is designed by the method according to the data block, so that the service life of the EEPROM can be prolonged by L-2 times.

Drawings

Fig. 1 is a flow chart of the operation of the EEPROM erasure balancing method applied to the electronic remote water meter according to the present invention.

Fig. 2, fig. 3, fig. 4 and fig. 5 are schematic diagrams of EEPROM usage states of the EEPROM erasure balancing method applied to the electronic remote water meter according to the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.

As shown in fig. 1, a method for balancing erase/write of EEPROM applied to an electronic remote water meter includes the following steps.

Step 1: reading the content of the status identification unit from the EEPROM, wherein fig. 2 shows that the memory cell is empty, the next write location is the first byte, fig. 3 shows that the next write location is the second byte, fig. 4 shows that the next write location is the third byte, fig. 5 shows that the memory cell is full and should be erased, and the next write location is the first byte.

Step 2: judging whether the stateBuffers are all 0, if not, indicating that the storage unit has space and is in a writable state, entering step 3, if all, indicating that the storage unit is full, and at the moment, erasing the stateBuffers and the storage unit, and entering step 1 or step 3.

And step 3: and finding the position of the first 1 according to the stateBuffer, namely the position of the next data write-in.

And 4, step 4: and modifying the identifier to modify the corresponding 1 to 0.

And 5: and writing data and identification.

The above-mentioned embodiments are illustrative of the specific embodiments of the present invention, and are not restrictive, and those skilled in the relevant art can make various changes and modifications to obtain corresponding equivalent technical solutions without departing from the spirit and scope of the present invention, so that all equivalent technical solutions should be included in the scope of the present invention.

6页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:数据存储布局

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类