[go: up one dir, main page]

CN114416429B - Multiple safety verification method for key data of ultrasonic water meter - Google Patents

Multiple safety verification method for key data of ultrasonic water meter

Info

Publication number
CN114416429B
CN114416429B CN202210067544.4A CN202210067544A CN114416429B CN 114416429 B CN114416429 B CN 114416429B CN 202210067544 A CN202210067544 A CN 202210067544A CN 114416429 B CN114416429 B CN 114416429B
Authority
CN
China
Prior art keywords
data
memory
checksum
reading
correct
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.)
Active
Application number
CN202210067544.4A
Other languages
Chinese (zh)
Other versions
CN114416429A (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.)
WEIHAI PLOUMETER CO Ltd
Original Assignee
WEIHAI PLOUMETER 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 WEIHAI PLOUMETER CO Ltd filed Critical WEIHAI PLOUMETER CO Ltd
Priority to CN202210067544.4A priority Critical patent/CN114416429B/en
Publication of CN114416429A publication Critical patent/CN114416429A/en
Application granted granted Critical
Publication of CN114416429B publication Critical patent/CN114416429B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

本发明涉及一种超声波水表关键数据多重安全校验方法,其解决了现有超声波水表关键数据保存在单一介质,数据易丢失、损坏的技术问题,其包括如下步骤:将保证超声波水表正常计量功能的关键数据,保存在不同介质中片内Flash Memory、片内Information Memory以及外部EEPROM;所述关键数据包括系统参数以及计量数据;上电加载系统参数,读取正确的所述系统参数;上电加载计量数据,读取所述计量数据;仪表运行中定时保存所述计量数据;程序在受到异常干扰的情况时,程序异常复位,保存当前计量数据,重新加载系统参数。本发明可广泛应用于超声波水表数据保存。The present invention relates to a multiple security verification method for key data of an ultrasonic water meter, which solves the technical problem that the key data of an existing ultrasonic water meter is stored in a single medium and the data is easily lost or damaged. The method comprises the following steps: storing the key data that ensures the normal metering function of the ultrasonic water meter in different media, i.e., an on-chip Flash Memory, an on-chip Information Memory, and an external EEPROM; the key data includes system parameters and metering data; loading the system parameters upon power-on and reading the correct system parameters; loading the metering data upon power-on and reading the metering data; regularly saving the metering data during meter operation; and resetting the program abnormally when the program is subjected to abnormal interference, saving the current metering data, and reloading the system parameters. The present invention can be widely applied to data storage of ultrasonic water meters.

Description

Multiple safety verification method for key data of ultrasonic water meter
Technical Field
The invention relates to the technical field of instrument control, in particular to a multiple safety verification method for key data of an ultrasonic water meter.
Background
The key data of the ultrasonic water meter are divided into two types, namely system parameters including data of a meter number, a caliber, a flow correction parameter and the like, and metering data including data of forward accumulated flow, reverse accumulated flow, PCB power-on time, working time and the like. At present, key data for an ultrasonic water meter are stored in a single medium, the data are interfered and damaged, and the data cannot be recovered for use.
Disclosure of Invention
The invention provides a multiple safety verification method for key data of an ultrasonic water meter, which aims to solve the technical problems that key data of the existing ultrasonic water meter are stored in a single medium, and the data are easy to lose and damage.
The invention provides a multiple safety verification method for key data of an ultrasonic water meter, which comprises the following steps:
Step 1, key data for ensuring normal metering function of an ultrasonic water meter are stored in different media of an on-chip Flash Memory, an on-chip Information Memory and an external EEPROM, wherein the key data comprise system parameters and metering data;
step 2, powering on and loading system parameters, and reading correct system parameters;
Step 3, electrifying to load metering data and reading the metering data;
step 4, regularly storing metering data in the running process of the instrument;
And 5, when the program is abnormally interfered, if the program is abnormally reset, reading the metering data in the memory, judging whether the metering data are correct according to the checksum of the metering data, and if the metering data are not correct, reading the metering data from the on-chip Information Memory or the external EEPROM, and reloading the system parameters.
Preferably, in step 1, an on-chip Flash Memory stores system parameters, an on-chip Information Memory stores metering data, an external EEPROM stores metering data and system parameters, the system parameters comprise a table number, a caliber, a flow correction parameter, a program version, a flow data version, a temperature correction, a zero point correction and a starting flow, and the metering data comprise a forward accumulated flow, a reverse accumulated flow, a PCB power-on time, a working time, a fault time, a power-on time, a reset time and a current time.
Preferably, the step of reading the correct system parameters in step 2 is:
reading a system parameter calculation checksum stored in a Flash Memory in a chip, checking whether the checksum is correct or not, and reading data to a system parameter data structure in a Memory if the checksum is correct, and if the checksum is incorrect, performing the step (2);
Reading system parameters stored in an external EEPROM, calculating a checksum, checking whether the checksum is correct, if so, reading data to a system parameter data structure in a memory, and if not, performing the step (3);
And (3) reading an initial value of a system parameter from the Flash Memory in the chip to a system parameter data structure in the Memory.
Preferably, the step of reading the metering data in step 3 is:
Step 1), reading metering data stored in the chip Information Memory, calculating a checksum, judging whether the data are correct and valid, if so, reading a metering data structure stored in the chip InformationMemory into a memory, and if not, performing step 2);
step 2), reading the metering data stored in the external EEPROM, calculating a checksum, judging whether the data are correct and valid, and if so, reading the metering data stored in the external EEPROM into a metering data structure in the memory;
and 3) emptying the metering data structure in the memory.
Preferably, in step 4, the specific step of regularly storing the metering data is:
Step A, calculating the checksum of the metering data in the memory, writing the metering data and the checksum into a chip Information Memory, reading the data written in the chip Information Memory, calculating the checksum, judging whether the checksum is correct, and writing the metering data and the checksum into an external EEPROM if the checksum is correct;
Step B, erasing Information Memory in the chip, recalculating the checksum of the metering data in the memory, and writing InformationMemory in the chip and judging;
and C, repeating the operation steps A and B three times.
Preferably, in step 4, before the meter stores the metering data, the battery voltage is detected, the chip is powered to perform read-write operation normally, and otherwise, the data is not stored.
Preferably, the specific steps of detecting the battery voltage include using a power supply voltage monitor to detect the battery voltage greater than 2.8V before storing data, ensuring that the Flash Memory and the external EEPROM in the chip have enough power supply during read-write operation, setting SVSCTL =0x80, reading and writing the data in the unused external EEPROM space and confirming whether the data is correct, judging whether the data is correct or not and reading the SVSFG bit of SVSCTL or not, and manually clearing SVSCTL registers if SVSFG is set or the data is incorrect and not stored.
Preferably, the specific steps of step 5 include:
Step a, calculating the checksum of the metering data in the memory, judging whether the checksum is correct or not, and if the checksum is correct, the data is valid, performing the step b, otherwise, performing the step c;
The step b is to copy the metering data into the unused memory, empty the memory used by the program data, copy the metering data stored into the unused memory back to the metering data structure in the memory;
And c, reading the metering data stored in the chip Information Memory, calculating a checksum, judging whether the data is correct and valid, if so, reading the metering data stored in the chip InformationMemory to the metering data structure in the memory, if not, reading the metering data stored in the external EEPROM, calculating the checksum, judging whether the data is correct and valid, if so, reading the metering data stored in the external EEPROM to the metering data structure in the memory, and if not, clearing the metering data structure in the memory.
Preferably, the specific step of reloading the system parameters in step5 comprises:
Step (A), reading a system parameter calculation checksum stored in a Flash Memory in a chip, checking whether the checksum is correct or not, and reading data to a system parameter data structure in a Memory if the checksum is correct;
Reading system parameters stored in an external EEPROM, calculating a checksum, checking whether the checksum is correct, and reading data to a system parameter data structure in a memory if the checksum is correct;
And (C) reading default data into a system parameter data structure in the memory.
The beneficial effects of the invention are as follows:
And storing the key data in the Flash Memory, the Information Memory and the external EEPROM in different media so as to improve the security of key data storage. Meanwhile, the measurement data is ensured not to be reduced or the maximum measurement data is ensured to be reduced, and the measurement data is ensured to be real and reliable.
Detailed Description
The present invention is further described below with reference to the drawings and examples so that those skilled in the art to which the present invention pertains can easily practice the present invention.
The method comprises the following steps:
step 1, key data for ensuring normal metering function of the ultrasonic water meter are stored in Flash Memory, information Memory and external EEPROM in different media so as to improve the safety of key data storage, wherein the key data comprise system parameters and metering data. Flash memory is flash memory, information Memory is information memory, both have the property of not losing data when power is off, EEPROM is electrically erasable programmable read-only memory, 2-WIRESERIAL EEPROM. The system parameters comprise data such as a table number, a caliber, a flow correction parameter, a program version, a flow data version, temperature correction, zero point correction, starting flow and the like, and the metering data comprise data such as forward accumulated flow, reverse accumulated flow, PCB power-on time, working time, fault duration, power-on times, reset times, current time (time of year, month, day, time of second) and the like.
And 2, powering on and loading system parameters, and reading correct system parameters.
Reading the system parameter calculation checksum stored in the Flash Memory in the chip, checking whether the checksum is correct, if so, reading the system parameter data structure in the Memory (RAM), if not, reading the system parameter calculation checksum stored in the external EEPROM, checking whether the checksum is correct, if so, reading the data to the system parameter data structure in the Memory (RAM), and if not, reading the initial value of the system parameter in the Flash Memory in the chip to the system parameter data structure in the Memory (RAM).
And step 3, powering up and loading metering data, and reading proper metering data.
Reading the metering data stored in the chip Information Memory, calculating a checksum, judging whether the data is correct and valid, if so, reading the metering data stored in the chip Information Memory to a memory (RAM) to count the data structure, if not, reading the metering data stored in the external EEPROM, calculating the checksum, judging whether the data is correct and valid, if so, reading the metering data stored in the external EEPROM to count the data structure in the memory (RAM), and if not, emptying the data structure in the memory (RAM).
And 4, in operation, the meter stores metering data at regular time.
And detecting the voltage of the battery before data are stored, ensuring that the power supply of the chip is ensured, judging that the voltage is more than 2.8V, and otherwise, not storing the data.
Before data is stored, a power supply voltage monitor (Supply Voltage Supervisor) is used for detecting the voltage of the battery, and enough power supply of the Flash Memory and the external EEPROM in the chip is ensured again during read-write operation. SVSCTL =0x80 is set, whether the data is correct or not is judged by reading and writing in an unused external EEPROM space and confirming whether the data is correct or not, SVSFG bit of the read SVSCTL is set or not, and if SVSFG is set or the data is incorrect, the data is not stored, the SVSCTL register is manually cleared.
The method comprises the steps of storing metering data, calculating the checksum of the metering data in a memory (RAM), writing the metering data and the checksum into a chip Information Memory, reading the data written in the chip Information Memory, calculating the checksum, judging whether the checksum is correct or not, writing the metering data and the checksum into an external EEPROM (electrically erasable programmable read-Only memory) if the checksum is correct, erasing the chip Information Memory if the checksum is incorrect, recalculating the checksum of the metering data in the memory (RAM), writing the checksum into the chip Information Memory, judging, and repeating the operation for three times.
The method comprises the steps of storing system parameters, writing in the system parameters only when the system parameters are changed, calculating the checksum of the system parameters in a Memory (RAM), writing the system parameters and the checksum into an on-chip Flash Memory, reading data written in the on-chip Flash Memory, calculating the checksum, judging whether the checksum is correct, writing the system parameters and the checksum into an external EEPROM if the checksum is correct, erasing the on-chip Flash Memory if the checksum is incorrect, recalculating the checksum of the system parameters in the Memory (RAM), writing the checksum into the on-chip Flash Memory, and repeating the operation for three times.
And 5, when the program is abnormally interfered, resetting the program abnormally, storing the current metering data and reloading system parameters.
The method comprises the steps of metering data protection, calculating the checksum of metering data in a memory (RAM), if the checksum is the same as the checksum in a metering data structure, indicating that the metering data is not affected by interference data effectively, copying the metering data into an unused memory, clearing the memory used by the program data, and then saving the memory used by the program data into the unused memory, and copying the metering data back to the memory (RAM) to obtain the metering data structure.
When the metering data in the internal memory (RAM) is invalid, the metering data stored in the internal memory Information Memory are read and the checksum is calculated to judge whether the data are correct and valid, if yes, the metering data stored in the internal memory InformationMemory are read to the metering data structure in the internal memory (RAM), if not, the metering data stored in the external EEPROM are read and the checksum is calculated to judge whether the data are correct and valid, if yes, the metering data stored in the external EEPROM are read to the metering data structure in the internal memory (RAM), and if not, the metering data structure in the internal memory (RAM) is cleared.
The method comprises the steps of reloading system parameters, reading a system parameter calculation checksum stored in a Flash Memory in a chip, checking whether the checksum is correct or not, reading data to a system parameter data structure in a Memory (RAM) if the checksum is correct, reading a system parameter calculation checksum stored in an external EEPROM, checking whether the checksum is correct or not, reading data to the system parameter data structure in the Memory (RAM) if the checksum is incorrect, and reading default data to the system parameter data structure in the Memory (RAM) if the checksum is incorrect.
The above description is only for the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the scope of the claims of the present invention should fall within the protection scope of the present invention.

Claims (6)

1. The multiple safety verification method for the key data of the ultrasonic water meter is characterized by comprising the following steps of:
Step 1, key data for ensuring normal metering function of an ultrasonic water meter are stored in different media of an on-chip Flash Memory, an on-chip Information Memory and an external EEPROM, wherein the key data comprise system parameters and metering data;
step 2, powering on and loading system parameters, and reading correct system parameters;
Step 3, electrifying and loading metering data, and reading the metering data;
and 4, regularly storing the metering data in the running process of the instrument, wherein the method comprises the following specific steps of:
Step A, calculating the checksum of the metering data in the memory, writing the metering data and the checksum into a chip Information Memory, reading the data written in the chip Information Memory, calculating the checksum, judging whether the checksum is correct, and writing the metering data and the checksum into an external EEPROM if the checksum is correct;
step B, erasing Information Memory in the chip, recalculating the checksum of the metering data in the memory, and writing Information Memory in the chip and judging;
Step C, repeating the step A and the step B for three times;
The specific steps of the battery voltage detection include that a power supply voltage monitor is used for detecting that the battery voltage is larger than 2.8V before data are stored, enough power supply is ensured to be supplied to Flash Memory and an external EEPROM (electrically erasable programmable read-Only Memory) in a chip during the read-write operation, SVSCTL =0x80 is set, whether the data are correct or not is judged by reading and writing the data in an unused external EEPROM space and confirming whether the data are correct or not, whether SVSFG bits of the data are set or not is judged by reading SVSCTL or not is judged by judging whether the data are correct or not, and if SVSFG is set or the data are incorrect, the data are not stored, and a SVSCTL register is manually emptied;
and 5, when the program is abnormally interfered, reading the metering data in the memory, judging whether the metering data are correct according to the checksum of the metering data, and if the metering data are not correct, reading the metering data from the on-chip Information Memory or the external EEPROM, and reloading the system parameters.
2. The multiple safety verification method for key data of an ultrasonic water meter according to claim 1 is characterized in that in the step 1, system parameters are saved in an on-chip Flash Memory, metering data are saved in an on-chip Information Memory, metering data and system parameters are saved in an external EEPROM, the system parameters comprise a table number, a caliber, a flow correction parameter, a program version, a flow data version, temperature correction, zero point correction and starting flow, and the metering data comprise forward accumulated flow, reverse accumulated flow, PCB power-on time, working time, fault time, power-on times, reset times and current time.
3. The method for multiple security verification of critical data of ultrasonic water meter according to claim 1, wherein the step of reading correct system parameters in step 2 comprises the steps of:
reading a system parameter calculation checksum stored in a Flash Memory in a chip, checking whether the checksum is correct or not, and reading data to a system parameter data structure in a Memory if the checksum is correct, and if the checksum is incorrect, performing the step (2);
Reading system parameters stored in an external EEPROM, calculating a checksum, checking whether the checksum is correct, if so, reading data to a system parameter data structure in a memory, and if not, performing the step (3);
And (3) reading an initial value of a system parameter from the Flash Memory in the chip to a system parameter data structure in the Memory.
4. The method for multiple security verification of critical data of ultrasonic water meter according to claim 1, wherein the step of reading the metering data in the step 3 is:
Step 1), reading metering data stored in the chip Information Memory, calculating a checksum, judging whether the data are correct and valid, if so, reading a metering data structure stored in the chip Information Memory into a memory, and if not, performing step 2);
step 2), reading the metering data stored in the external EEPROM, calculating a checksum, judging whether the data are correct and valid, and if so, reading the metering data stored in the external EEPROM into a metering data structure in the memory;
and 3) emptying the metering data structure in the memory.
5. The method for multiple security verification of critical data of an ultrasonic water meter according to claim 1, wherein the specific steps of step 5 include:
Step a, calculating the checksum of the metering data in the memory, judging whether the checksum is correct or not, and if the checksum is correct, the data is valid, performing the step b, otherwise, performing the step c;
The step b is to copy the metering data into the unused memory, empty the memory used by the program data, copy the metering data stored into the unused memory back to the metering data structure in the memory;
And c, reading the metering data stored in the chip Information Memory, calculating a checksum, judging whether the data is correct and valid, if so, reading the metering data stored in the chip Information Memory to the metering data structure in the memory, if not, reading the metering data stored in the external EEPROM, calculating the checksum, judging whether the data is correct and valid, if so, reading the metering data stored in the external EEPROM to the metering data structure in the memory, and if not, clearing the metering data structure in the memory.
6. The method for multiple security verification of critical data of ultrasonic water meter according to claim 1, wherein the specific step of reloading the system parameters in step 5 comprises:
Step (A), reading a system parameter calculation checksum stored in a Flash Memory in a chip, checking whether the checksum is correct or not, and reading data to a system parameter data structure in a Memory if the checksum is correct;
Reading system parameters stored in an external EEPROM, calculating a checksum, checking whether the checksum is correct, and reading data to a system parameter data structure in a memory if the checksum is correct;
And (C) reading default data into a system parameter data structure in the memory.
CN202210067544.4A 2022-01-20 2022-01-20 Multiple safety verification method for key data of ultrasonic water meter Active CN114416429B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210067544.4A CN114416429B (en) 2022-01-20 2022-01-20 Multiple safety verification method for key data of ultrasonic water meter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210067544.4A CN114416429B (en) 2022-01-20 2022-01-20 Multiple safety verification method for key data of ultrasonic water meter

Publications (2)

Publication Number Publication Date
CN114416429A CN114416429A (en) 2022-04-29
CN114416429B true CN114416429B (en) 2025-07-22

Family

ID=81275639

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210067544.4A Active CN114416429B (en) 2022-01-20 2022-01-20 Multiple safety verification method for key data of ultrasonic water meter

Country Status (1)

Country Link
CN (1) CN114416429B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109520576A (en) * 2017-09-19 2019-03-26 辽宁思凯科技股份有限公司 A kind of NB mould group that ultrasonic water table function is embedded in NB-IOT modem chip
CN111124763A (en) * 2019-12-30 2020-05-08 安徽皖兴通信息技术有限公司 Communication equipment starting configuration data backup synchronization method
CN212112445U (en) * 2020-01-16 2020-12-08 深圳市中电电力技术股份有限公司 Storage system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107451015A (en) * 2017-08-08 2017-12-08 四川长虹电器股份有限公司 A kind of intelligent television critical data backup and data reconstruction method
CN108122594A (en) * 2017-12-19 2018-06-05 宁波三星医疗电气股份有限公司 A kind of efficient intelligent electric energy meter date storage method and its intelligent electric energy meter

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109520576A (en) * 2017-09-19 2019-03-26 辽宁思凯科技股份有限公司 A kind of NB mould group that ultrasonic water table function is embedded in NB-IOT modem chip
CN111124763A (en) * 2019-12-30 2020-05-08 安徽皖兴通信息技术有限公司 Communication equipment starting configuration data backup synchronization method
CN212112445U (en) * 2020-01-16 2020-12-08 深圳市中电电力技术股份有限公司 Storage system

Also Published As

Publication number Publication date
CN114416429A (en) 2022-04-29

Similar Documents

Publication Publication Date Title
US6851015B2 (en) Method of overwriting data in nonvolatile memory and a control apparatus used for the method
US8214720B2 (en) Bit error prevention method and information processing apparatus
CN102890657B (en) The method that the reading and writing data of a kind of EEPROM of minimizing is made mistakes
JP6562602B2 (en) Mitigating missing writes
US9146821B2 (en) Methods and systems for monitoring write operations of non-volatile memory
TWI431476B (en) Methods of operating a memory system, a system including a host and a memory system, and one or more memory devices and a host
US20090313444A1 (en) Semiconductor storage apparatus managing system, semiconductor storage apparatus, host apparatus, program and method of managing semiconductor storage apparatus
CA2350242C (en) Improved memory integrity for meters
CN101419841B (en) A kind of FLASH memory erasing and writing method
US20050149663A1 (en) Computerized methods for data loggers
TWI436369B (en) Methods for measuring usable lifespan and replacing an in-system programming code of a memory device, and data storage system using the same
CN102301427A (en) Analyzing monitor data information from memory devices having finite endurance and/or retention
US8782478B2 (en) Non-volatile memory (NVM) with imminent error prediction
CN105097050B (en) A kind of storage life test method
CN109933340B (en) On-orbit writing and self-checking method of spacecraft EEPROM (electrically erasable programmable read-Only memory) based on page mode
JP2008511832A (en) Firmware power cycle routine
CN108564981B (en) Dynamic monitoring method for data security of storage device
CN111459708B (en) Bad block processing method and device
CN114416429B (en) Multiple safety verification method for key data of ultrasonic water meter
JP5604313B2 (en) Memory access control device
CN103009817B (en) Consumable chip and data means to save the situation, consumable container, imaging device
JP6040895B2 (en) Microcomputer and non-volatile memory block management method
CN111444038A (en) Real-time detection method, detection device and storage system of flash memory reliability
CN119668523B (en) Memory and distribution method of flash memory blocks thereof
JP3314719B2 (en) Flash EEPROM and its test method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant