CN101499026A - Miniature data backup method of data acquisition system based on FLASH ROM - Google Patents

Miniature data backup method of data acquisition system based on FLASH ROM Download PDF

Info

Publication number
CN101499026A
CN101499026A CNA2008101309873A CN200810130987A CN101499026A CN 101499026 A CN101499026 A CN 101499026A CN A2008101309873 A CNA2008101309873 A CN A2008101309873A CN 200810130987 A CN200810130987 A CN 200810130987A CN 101499026 A CN101499026 A CN 101499026A
Authority
CN
China
Prior art keywords
data
sector
index
current
page
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
CNA2008101309873A
Other languages
Chinese (zh)
Other versions
CN101499026B (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.)
Kaimai (Luoyang) limited measuring ring
Original Assignee
Cama Luoyang Measurement and Control Equipments 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 Cama Luoyang Measurement and Control Equipments Co Ltd filed Critical Cama Luoyang Measurement and Control Equipments Co Ltd
Priority to CN2008101309873A priority Critical patent/CN101499026B/en
Publication of CN101499026A publication Critical patent/CN101499026A/en
Application granted granted Critical
Publication of CN101499026B publication Critical patent/CN101499026B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Read Only Memory (AREA)

Abstract

A data collecting system small data backup method based on FLASH ROM takes the sector as a unit to identify and index before and after the serial number sequence; when a sector of data kept full, used to find the first sector, clear and as the current sector work; sector by the composition of the index and data areas, including the sector index and the index page index, page index of the space behind the data area, data acquisition system, in accordance with the cycle of setting and type of data storage to the sector, in the storage process in accordance with the format required by the establishment of sector index and the index page; query data, search data blocks first index, when the time to match the corresponding page after the search index. Integrated on system resources, this method is rarely occupied by only a few thousand bytes of code can be realized, small memory occupation of variables, data backup for small applications; the methods used to achieve uniform wear of the sector, In addition, index levels Quick hits can be achieved.

Description

Miniature data backup method of data acquisition system based on FLASH ROM
Technical field
The present invention relates to the data acquisition system (DAS) technical field, relate in particular to a kind of Miniature data backup method of data acquisition system based on FLASH ROM.
Background technology
In data acquisition system (DAS), the normal FLASH ROM that uses carries out data backup, and use ripe file system (as the USB flash disk file system) to realize backup operation at FLASH ROM, the benefit of this method is that feature richness is flexible, easy to use, and that shortcoming is an occupying system resources is many, and it is many particularly to take code space.In small-sized data acquisition is used, owing to reasons such as code space restrictions, generally can't use at the ripe file system of FLASH ROM, therefore be necessary to propose a kind of Miniature data backup method of data acquisition system based on FLASH ROM.
Summary of the invention
The purpose of this invention is to provide a kind of Miniature data backup method of data acquisition system based on FLASH ROM, use this method Backup Data occupying system resources few, it is little to take code space.
A kind of Miniature data backup method of data acquisition system based on FLASH ROM, wherein: comprise the steps:
A), enter and regularly interrupt the initialization flow process, simultaneously, enter serial ports and interrupt initialization flow process, serial ports buffering initialization flow process;
B), enter data backup initialization of variable flow process;
C), judge whether to receive the data acquisition message signale, if the current data that collect of reception data acquisition unit enter step d) afterwards; If not, directly enter step d);
D), judge whether to receive the data backup message signale, if the current data that backup receives after backup actions is finished, enters step e); If not, directly enter step e);
E), judge whether to receive and set up the data directory message signale, if, set up Backup Data piece index, enter step f) afterwards; If not, directly return step f);
F), enter the system command treatment scheme;
G), return step c).
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: comprise the steps: in its data backup initialization of variable step a)
B1), set up that effective sector number is 0, interim flowing water variable is 0, interim sector pointers is 0, interim page pointer is 0;
B2), in the internal memory of data acquisition system (DAS) processor, set up first data buffering;
B3), read FLASH ROM sector index that interim sector pointers points to step b2) in first data buffering of foundation;
B4), from this first data buffering, read current sector data sign and judge whether this sector is effective;
B5), if current sector effective, with effective sector number+1, and from above-mentioned first data buffering, read current sector serial number; If current sector is invalid, enter step b8);
B6), judge that current sector serial number is whether greater than interim flowing water variable, if enter step b7), if not, enter step b8);
B7), described current sector serial number is written to interim flowing water variable, current sector pointers is pointed to interim sector pointers;
B8), with interim sector pointers+1;
B9), judge that interim sector pointers is whether greater than the sector number of FLASH ROM device, if enter step b10), if not, return step b3);
B10), judge whether effective sector number is 0, if enter step b18), if not, enter step b11);
B11), read the sector bitmap of current sector pointers sensing to first data buffering;
B12), from first data buffering, read the data bitmap that interim page pointer is pointed to;
B13), judge according to data bitmap whether this data bitmap corresponding page is empty, if step b12 will be returned behind interim page pointer+1); If not, enter step b14);
B14), with the interim page pointer of current page pointed;
B15), judge that interim page pointer is whether greater than the sector number of FLASH ROM device, if enter step b16), if not, enter step b21);
B16), with current sector pointers+1;
B17), carrying out FLASH ROM device boundaries handles;
B18), wipe current sector;
B19), rebulid sector index;
B20), the current page pointer is made as 1;
B21), set up the data block index;
B22), set up page index;
B23), current offset pointer moves, and skips the current page index;
B24), finish initialization.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: it enters in the step a) of regularly interrupting flow process and comprises the steps:
A1), the timer of data acquisition system (DAS) picks up counting;
A2), whether judgment data gather timing cycle and expire, if send the data acquisition message signale, enter step a3 afterwards), if not, directly enter step a3);
A3), whether judgment data backup timing cycle expire, if send the data backup message signale, enter step a4 afterwards), if not, directly enter step a4);
A4), whether judgment data index timing cycle expire, if send the data directory message signale, enter step a5 afterwards), if not, directly enter step a5);
A5), regularly interrupting flow process finishes.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: " current data that backup receives " in its step d) comprises the following steps:
D1), set up FLASH ROM operation buffering;
D2), current data is write in this operation buffering;
D3), the data that will operate in the buffering write FLASH ROM;
D4), current offset pointer moves the length of the FLASH ROM data that write;
D5), enter current page bounds checking flow process;
D6), the Backup Data flow process finishes.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: the flow process that enters the current page bounds checking its steps d 5) comprises the steps:
D5I), judge whether to arrive the border of current page, if enter steps d 5II), if not, enter steps d 5IV);
D5II), enter the flow process of upgrading the work at present page;
D5III), after the renewal of the page, set up the index of current page;
D5IV), the page boundary inspection finishes.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: enter the flow process of upgrading the work at present page its steps d 5II) and comprise the steps:
D5II is 1.), judge whether to arrive the border of current sector, if enter steps d 5II 2.), if not, the current page pointer added 1 after, enter steps d 5II 6.);
D5II is 2.), current sector serial number is added 1;
D5II is 3.), the search minimum serial number the sector as current sector;
D5II is 4.), wipe the data in the current sector;
D5II is 5.), set up the index of current sector;
D5II is 6.), in the bitmap of sector the mark current page;
D5II is 7.), set up page index;
D5II is 8.), upgrade current page and finish.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: its steps d 5II is 5.) in set up the index of current sector flow process comprise the steps:
D5II is i 5.), in the internal memory of data acquisition system (DAS) processor, set up second data buffering;
D5II 5. ii), will have serial number, the current time of the sign of no datat, current sector to write in this second data buffering;
D5II 5. iii), the data in second data buffering are written to the homepage of the current sector of FLASH ROM;
D5II 5. iv), set up the index of the data block write;
D5II 5. v), set up sector index and finish.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: its steps d 5II 5. flow process of setting up institute's writing data blocks index described in iv) comprises the steps:
D5II is iv1. 5.) in the data acquisition system (DAS) processor memory, set up the 3rd data buffering;
D5II is iv2. 5.) current time, the work at present page etc. is write the 3rd data buffering;
D5II is iv3. 5.) search lowest address index space in the homepage of the current sector of FLASH ROM;
D5II is iv4. 5.) data in the 3rd data buffering are written in this index space;
D5II is iv5. 5.) set up the data block index and finish.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: the flow process of setting up the current page index described steps d 5III) comprises the steps:
D5III is 1.), in the data acquisition system (DAS) processor memory, set up the 4th data buffering;
D5III is 2.), current time, current Backup Data kind are write the 4th data buffering;
D5III is 3.), with the data in the 4th data buffering be written to current page begin the place;
D5III is 4.), set up page index and finish.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: the flow process of serial ports Interrupt Process described in its step a) comprises the steps:
A1 '), whether judgment data acquisition system serial ports interrupt processed command arrive, if this processing command byte is write in the order buffering of processor, enter step a2 ' afterwards); If not, directly enter step a2 ');
A2 '), rs 232 serial interface signal sends and handles;
A3 '), serial ports Interrupt Process flow process finishes.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: enter the system command treatment scheme in its step f) and comprise the steps:
F1), judge whether command format effective, if enter step f2), if not, enter step f4);
F2), the judgment data reading order mates that (this coupling refers to what and what coupling? how to mate? if), enter step f3); If not, enter step f5);
F3), carry out historical data and read treatment scheme;
F4), send the wrong cue of order, and data in the clear command buffering;
F5), the system command processing finishes.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: historical data its step f3) reads treatment scheme and comprises the steps:
F3I), in the data acquisition system (DAS) processor memory, set up the 5th data buffering;
F3II), the storage time of from the order buffering of processor, reading historical data;
F3III), according to the storage time of the historical data that reads, enter the data query flow process;
F3IV), judge whether inquiry hits, if enter step f3V), if not, enter step f3VII);
F3V), from FLASH ROM, read historical data to the five data bufferings;
F3VI), the data in the 5th data buffering are sent to host computer by serial ports;
F3VII), send the query missed information;
F3VIII), historical data reads the treatment scheme end.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein: the data query flow process step f3III) comprises the steps:
F3III1.), search sector count;
F3III2.), judge whether the sector of search effective, if enter step f3III3.), if not, enter step f3III10.);
F3III3.), the search data blocks index count, after searching, enter step f3III4.);
F3III4.), judge the data block index date search whether with the time coupling of the historical data that requires, if enter step f3III5.), if not, enter step f3III9.);
F3III5.), searched page counting;
F3III6.), page index time of judging search whether with the time coupling of the historical data that requires, if return hiting signal, finish the data query flow process, if not, enter step f3III7.);
F3III7.), judge whether this sector page has been searched for, if enter step f3III8.), if not, return step f3III3.);
F3III8.), judge whether this sector data piece index has been searched for, if enter step f3III9.), if not, return step f3III1.),
F3III9.), judge whether whole sectors to have been searched for, if enter step f3III10.), if not, return step f3III1.);
F3III10.), return miss signal, end data query flow process.
The present invention adopts technique scheme will reach following technique effect:
A kind of Miniature data backup method of data acquisition system provided by the invention based on FLASH ROM, be the characteristics that data traffic is little when having utilized miniature data backup, data have the strict time order, be operating unit with the sector during data storage, all there is similar storage organization each sector, order before and after differentiating by serial number and index; When a sector is filled with data, search used the earliest sector, remove this sector, it as the work at present sector, so can be realized uniform wear.
Each sector all is made up of index and data field, and index comprises sector index and page or leaf index.Sector index is positioned at the sector homepage, comprise sector valid data sign, serial number, page operating position bitmap, data block index, its data block index comprises data block Start Date, time and sector, and its cycle of setting up is set up according to balances such as data traffic, sector-size and data query times by the user; The page or leaf index comprises date that page data begins, time, data backup type, data backup cycle etc.; The space of page or leaf index back is exactly the data field, and the data layout in the data field is defined according to application demand by the user.
Data acquisition system (DAS) when work, according to cycle and the kind set data backup is stored among the FLASHROM, as requested form is set up sector index and page index in the process of storage.
When data query, first search data blocks index, the corresponding page or leaf index of search after the date hits, this two-stage index can define the driftlessness data very soon.
To sum up, this method occupying system resources seldom only need the code of several kilobyte to realize, and it is also very little to take the variable internal memory, is well suited for miniature data backup and uses; From the sector use as can be seen, this method has realized uniform wear; In addition, two-stage index can realize quick search.
Description of drawings
Fig. 1 is the data acquisition system (DAS) workflow diagram;
Fig. 2 is a data backup initialization of variable process flow diagram;
Fig. 3 regularly interrupts process flow diagram for system;
Fig. 4 is the Backup Data process flow diagram;
Fig. 5 is a current page bounds checking process flow diagram;
Fig. 6 is for upgrading work at present page process flow diagram;
Fig. 7 is for setting up the sector index process flow diagram;
Fig. 8 is for setting up data block index process flow diagram;
Fig. 9 is for setting up the page index process flow diagram;
Figure 10 is a serial ports Interrupt Process process flow diagram;
Figure 11 is the system command processing flow chart;
Figure 12 reads processing flow chart for historical data;
Figure 13 is the data query process flow diagram;
Figure 14 is the structural representation of visiometer data collector.
Embodiment
Embodiment:
A kind of Miniature data backup method of data acquisition system based on FLASH ROM, the data collector structural drawing that is applied to visiometer as shown in figure 14, this data collector comprises acquired signal and conversion of signals is become the sensor of data-signal, processor CPU, FLASH ROM and host computer, processor CPU adopts chip AT89C51ED2, sensor is connected with processor CPU by sensor interface, it is M24P16 that FLASH ROM adopts model, it is the 16Mbits device of a SPI interface, it is connected with processor CPU by the SPI interface, processor CPU also is connected with host computer (PC) by the RS232 interface, processor CPU pick-up transducers signal, after the processing signal is sent to PC by the RS232 mouth, and cycle as requested and form with signal storage in FLASH ROM, realize data backup.When PC sends the Backup Data reading requirement by order to processor CPU, after the inquiry of processor CPU process,, just from FLASH ROM, read this data, and form in accordance with regulations sends to PC if there are the data that require.
Before method is implemented, at first need definition sector index, page index form, the sector index that defines in the present embodiment, page index form are as follows:
The sector index form
The offset byte number is defined as usefulness
01 data have or not sign, and: 0x59 has data 0xFF no datat other (as 0x00 0x01 0xF0 are illegal, promptly do not meet the mistake of this method) to be used for flag data to have or not
11 keep ...
44 serial numbers are used to judge data storage order between the sector from small to large
84 keep ...
12 3 keep ...
15 1 keep ...
16 32 bitmap for every page are used to judge whether the page has data
Fast 1 index of 48 4 date date datas begins
52 3 time times
The page or leaf that 55 1 page data begin
Fast 2 index of 56 4 date date datas begin
60 3 time times
The page or leaf that 63 1 page data begin
...... ...... ....... ......
The page index form
The offset byte number is defined as usefulness
The date that 04 these page datas of date dat recorder begin
The time that 43 these page datas of time time keeping begin
The kind of 71 these page datas of backup type records
The workflow of data acquisition system (DAS) as shown in Figure 1, it comprises the steps:
A), enter and regularly interrupt flow process, enter serial ports Interrupt Process flow process simultaneously;
B), enter data backup initialization of variable flow process;
C), judge whether to receive the data acquisition message signale, if the current data that collect of reception data acquisition unit enter step d) afterwards; If not, directly enter step d);
D), judge whether to receive the data backup message signale, if the current data that backup receives after backup actions is finished, enters step e); If not, directly enter step e);
E), judge whether to receive and set up the data directory message signale, if, set up Backup Data piece index, enter step f) afterwards; If not, directly return step f);
F), enter the system command treatment scheme;
G), return step c).
Wherein, as shown in Figure 2, the data backup initialization of variable flow process in the described step a) comprises the steps:
B1), set up that effective sector number is 0, interim flowing water variable is 0, interim sector pointers is 0, interim page pointer is 0; (effectively the sector refers to and stores the signal data that collects, and indexed format meets the above-mentioned definition of present embodiment to it in this sector, and effectively sector number is based upon in the CPU internal memory, is global variable; Described several temporary variable all is a local variable, is based upon in the CPU internal memory, and temporary variable only works in initialize routine, is the intermediate variable that calculates initializing variable.)
B2), in the internal memory of data acquisition system (DAS) processor, set up first data buffering (this first data buffering is the ephemeral data buffering, and this buffering promptly was released after initialize routine executed, and is clear for describing, and it is labeled as first data buffering here);
B3), read FLASH ROM sector index that interim sector pointers points to step b2) in first data buffering of foundation;
B4), reading current sector data sign from this first data buffering (is that data have or not sign, see the sector index form for details), and judge this sector whether effectively (whether effectively refer to and whether meet the identification data 0x59 that defines in the present embodiment sector index form);
B5), if current sector is effective, with effective sector number+1, and (described sector serial number is 4 byte integer of stipulating in the sector index form from small to large to read current sector serial number from above-mentioned first data buffering, be used for judging the front and back order of different sectors data storage, it can guarantee still can judge the order of Backup Data when system clock is disorderly); If current sector is invalid, enter step b8);
B6), judge that current sector serial number is whether greater than interim flowing water variable, if enter step b7), if not, enter step b8);
B7), described current sector serial number is written to interim flowing water variable, current sector pointers is pointed to interim sector pointers;
B8), with interim sector pointers+1;
B9), judge that interim sector pointers is whether greater than the sector number of FLASH ROM device, if enter step b10), if not, return step b3);
B10), judge whether effective sector number is 0, if enter step b18), if not, enter step b11);
B11), read the sector bitmap of current sector pointers sensing to first data buffering; (the sector bitmap is used for whether the page is empty in the mark sector, represents a page with a position, is defined as in the present embodiment: 0 this page data with existing of expression, and 1 this page of expression is empty; Can determine the page vacant in the current page rapidly by bitmap, also provide foundation) for search data
B12), from first data buffering, read the data bitmap that interim page pointer is pointed to;
B13), judge whether data bitmap is 1, if step b12 will be returned behind interim page pointer+1); If not, enter step b14);
B14), with the interim page pointer of current page pointed; (initialized purpose that Here it is is given suitable value with several key variables such as sector pointers, page pointer, offset pointer);
B15), judge that interim page pointer is whether greater than the sector number (interim page pointer is a temporary variable, and initialization finishes and promptly is released, and is used for judging the page situation of respective sectors) of FLASH ROM device, if, enter step b16), if not, enter step b21);
B16), with current sector pointers+1;
B17), carrying out FLASH ROM device boundaries handles;
B18), wipe current sector; Add in (the current sector here is step b16) 1 the operation after the sector)
B19), rebulid sector index;
B20), the current page pointer is made as 1;
B21), set up the data block index; (because of it is the index of setting up in initialization procedure, so also be initial index, the process of specifically setting up is seen Fig. 8)
B22), set up page index; (process such as Fig. 9 are set up in page index, and the page index after the foundation is one the 8 byte data piece that meets the page index form of present embodiment definition)
B23), make current offset pointer=8, even current offset pointer is skipped page index; (offset pointer is indicated the position of current Backup Data in FLASH ROM with sector pointers, page pointer, makes offset pointer=8th, in order to skip the page index of 8 bytes.)
B24), finish initialization.
Described step a) enters regularly interrupts flow process, sees shown in Figure 3ly, comprises the steps:
A1), the timer of data acquisition system (DAS) picks up counting; (timer of data acquisition system (DAS) is the impulse meter that has utilized among the CPU AT89C51 in the present embodiment)
A2), whether judgment data gather timing cycle and expire, if send the data acquisition message signale, enter step a3 afterwards), if not, directly enter step a3);
A3), whether judgment data backup timing cycle expire, if send the data backup message signale, enter step a4 afterwards), if not, directly enter step a4);
A4), whether judgment data index timing cycle expire, if send the data directory message signale, enter step a5 afterwards), if not, directly enter step a5);
A5), regularly interrupting flow process finishes.
Described Miniature data backup method of data acquisition system based on FLASH ROM, the flow process of the current data that the backup in its step d) receives comprises the following steps: as shown in Figure 4
D1), set up FLASH ROM operation buffering;
D2), current data is write in this operation buffering;
D3), the data that will operate in the buffering write FLASH ROM;
D4), current offset pointer moves the length of the FLASH ROM data that write; (moving the current offset pointer in back and be the end of the total length that points to the page index of having set up in the FLASH ROM current page and already present data)
D5), enter current page bounds checking flow process;
D6), the Backup Data flow process finishes.
Above-mentioned steps d5) enters the flow process of current page bounds checking in, as shown in Figure 5, comprise the steps:
D5I), judge whether to arrive the border of current page, if enter steps d 5II), if not, enter steps d 5IV);
D5II), enter the flow process of upgrading the work at present page;
D5III), after the renewal of the page, set up the index of current page;
D5IV), the page boundary inspection finishes.
Above-mentioned steps d5II) enters the flow process of upgrading the work at present page in,, comprise the steps: as Fig. 6
D5II is 1.), judge whether to arrive the border of current sector, if enter steps d 5II 2.), if not, the current page pointer added 1 after, enter steps d 5II 6.);
D5II is 2.), current sector serial number is added 1;
D5II is 3.), the search minimum serial number the sector as current sector;
D5II is 4.), wipe the data in the current sector;
D5II is 5.), set up the index of current sector;
D5II is 6.), in the bitmap of sector the mark current page;
D5II is 7.), set up page index; The flow process of page index (set up also as shown in Figure 9)
D5II is 8.), upgrade current page and finish.
Above-mentioned steps d5II is 5.) in set up current sector index flow process as shown in Figure 7, comprise the steps:
D5II is i 5.), in the internal memory of data acquisition system (DAS) processor, set up second data buffering; (this second data buffering also is the ephemeral data buffering, and sector index promptly is released after setting up and finishing, and describes for clear, it is expressed as second data buffering here.)
D5II 5. ii), will have serial number, the current time of the sign of no datat, current sector to write in this second data buffering;
D5II 5. iii), the data in second data buffering are written to the homepage of the current sector of FLASH ROM;
D5II 5. iv), set up the index of the data block write; (the data block here is meant the data of specified period period stored.)
D5II 5. v), set up sector index and finish.
Above-mentioned steps d5II is the flow process of setting up institute's writing data blocks index described in iv) 5., as shown in Figure 8, comprises the steps:
D5II is iv 1. 5.) in the data acquisition system (DAS) processor memory, set up the 3rd data buffering;
D5II is iv 2. 5.) current time, the work at present page etc. is write the 3rd data buffering;
D5II is iv 3. 5.) search lowest address index space in the homepage of the current sector of FLASH ROM;
D5II is iv 4. 5.) data in the 3rd data buffering are written in this index space;
D5II is iv 5. 5.) set up the data block index and finish.
Above-mentioned steps d5III) sets up the flow process of current page index in, as shown in Figure 9, comprise the steps:
D5III is 1.), in the data acquisition system (DAS) processor memory, set up the 4th data buffering;
D5III is 2.), current time, current Backup Data kind are write the 4th data buffering;
D5III is 3.), with the data in the 4th data buffering be written to current page begin the place;
D5III is 4.), set up page index and finish.
Above-mentioned steps d5II is 7.) in set up page index flow process also as shown in Figure 9, repeat no more here.
Described Miniature data backup method of data acquisition system based on FLASH ROM, wherein, the serial ports Interrupt Process flow process described in the step a) as shown in figure 10, comprises the steps:
A1 '), whether judgment data acquisition system serial ports interrupt processed command arrive, if this processing command byte is write in the order buffering of processor, enter step a2 ' afterwards); If not, directly enter step a2 ');
A2 '), rs 232 serial interface signal sends and handles;
A3 '), serial ports Interrupt Process flow process finishes.
Enter the system command treatment scheme in its step f), as shown in figure 11, comprise the steps:
F1), judge whether command format effective, if enter step f2), if not, enter step f4);
F2), judgment data reading order character string whether with the string matching of predetermined data reading order, (the command string definition repeats no more here) coupling is if enter step f3); If not, enter step f5);
F3), carry out historical data and read treatment scheme;
F4), send the wrong cue of order, and data in the clear command buffering;
F5), the system command processing finishes.
Above-mentioned steps f3) historical data reads treatment scheme described in, as shown in figure 12, comprises the steps:
F3I), in the data acquisition system (DAS) processor memory, set up the 5th data buffering;
Time when f3II), from the order of processor buffering, reading historical data and be stored; (this method be with the time as the index foundation.)
F3III), the time when being stored according to the historical data that reads, enter the data query flow process;
F3IV), judge whether inquiry hits, if enter step f3V), if not, enter step f3VII);
F3V), from FLASH ROM, read historical data to the five data bufferings;
F3VI), the data in the 5th data buffering are sent to host computer by serial ports;
F3VII), send the query missed information;
F3VIII), historical data reads the treatment scheme end.
Above-mentioned steps f3III) the data query flow process described in comprises the steps: as shown in figure 13
F3III1.), search sector count; (this sector count is a temporary variable, is used to calculate the sector number of searching for, and judges whether that with it all sectors have all searched for)
F3III2.), judge whether the sector of search effective, if enter step f3III3.), if not, enter step f3III10.);
F3III3.), search data blocks index count (the data block index count also is a temporary variable, is used to calculate the quantity of the data block index of searching for, and judges whether that with it all data block index have all searched for), after searching, enter step f3III4.);
F3III4.), judge the data block index date search whether with the time coupling of the historical data that requires, if enter step f3III5.), if not, enter step f3III9.);
F3III5.), searched page counting;
F3III6.), page index time of judging search whether with the time coupling of the historical data that requires, if return hiting signal, finish the data query flow process, if not, enter step f3III7.);
F3III7.), judge whether this sector page has been searched for, if enter step f3III8.), if not, return step f3III3.);
F3III8.), judge whether this sector data piece index has been searched for, if enter step f3III9.), if not, return step f3III1.),
F3III9.), judge whether whole sectors to have been searched for, if enter step f3III10.), if not, return step f3III1.);
F3III10.), return miss signal, end data query flow process.

Claims (13)

1, a kind of Miniature data backup method of data acquisition system based on FLASH ROM is characterized in that: comprise the steps:
A), enter and regularly interrupt the initialization flow process, simultaneously, enter serial ports and interrupt initialization flow process, serial ports buffering initialization flow process;
B), enter data backup initialization of variable flow process;
C), judge whether to receive the data acquisition message signale, if the current data that collect of reception data acquisition unit enter step d) afterwards; If not, directly enter step d);
D), judge whether to receive the data backup message signale, if the current data that backup receives after backup actions is finished, enters step e); If not, directly enter step e);
E), judge whether to receive and set up the data directory message signale, if, set up Backup Data piece index, enter step f) afterwards; If not, directly return step f);
F), enter the system command treatment scheme;
G), return step c).
2, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 1 is characterized in that: comprise the steps: in its data backup initialization of variable step a)
B1), set up that effective sector number is 0, interim flowing water variable is 0, interim sector pointers is 0, interim page pointer is 0;
B2), in the internal memory of data acquisition system (DAS) processor, set up first data buffering;
B3), read FLASH ROM sector index that interim sector pointers points to step b2) in first data buffering of foundation;
B4), from this first data buffering, read current sector data sign and judge whether this sector is effective;
B5), if current sector effective, with effective sector number+1, and from above-mentioned first data buffering, read current sector serial number; If current sector is invalid, enter step b8);
B6), judge that current sector serial number is whether greater than interim flowing water variable, if enter step b7), if not, enter step b8);
B7), described current sector serial number is written to interim flowing water variable, current sector pointers is pointed to interim sector pointers;
B8), with interim sector pointers+1;
B9), judge that interim sector pointers is whether greater than the sector number of FLASH ROM device, if enter step b10), if not, return step b3);
B10), judge whether effective sector number is 0, if enter step b18), if not, enter step b11);
B11), read the sector bitmap of current sector pointers sensing to first data buffering;
B12), from first data buffering, read the data bitmap that interim page pointer is pointed to;
B13), judge according to data bitmap whether this data bitmap corresponding page is empty, if step b12 will be returned behind interim page pointer+1); If not, enter step b14);
B14), with the interim page pointer of current page pointed;
B15), judge that interim page pointer is whether greater than the sector number of FLASH ROM device, if enter step b16), if not, enter step b21);
B16), with current sector pointers+1;
B17), carrying out FLASH ROM device boundaries handles;
B18), wipe current sector;
B19), rebulid sector index;
B20), the current page pointer is made as 1;
B21), set up the data block index;
B22), set up page index;
B23), current offset pointer moves, and skips the current page index;
B24), finish initialization.
3, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 1 is characterized in that: it enters in the step a) of regularly interrupting flow process and comprises the steps:
A1), the timer of data acquisition system (DAS) picks up counting;
A2), whether judgment data gather timing cycle and expire, if send the data acquisition message signale, enter step a3 afterwards), if not, directly enter step a3);
A3), whether judgment data backup timing cycle expire, if send the data backup message signale, enter step a4 afterwards), if not, directly enter step a4);
A4), whether judgment data index timing cycle expire, if send the data directory message signale, enter step a5 afterwards), if not, directly enter step a5);
A5), regularly interrupting flow process finishes.
4, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 1 is characterized in that: " current data that backup receives " in its step d) comprises the following steps:
D1), set up FLASH ROM operation buffering;
D2), current data is write in this operation buffering;
D3), the data that will operate in the buffering write FLASH ROM;
D4), current offset pointer moves the length of the FLASH ROM data that write;
D5), enter current page bounds checking flow process;
D6), the Backup Data flow process finishes.
5, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 4 is characterized in that: the flow process that enters the current page bounds checking its steps d 5) comprises the steps:
D5 I), judge whether to arrive the border of current page, if enter steps d 5 II), if not, enter steps d 5 IV);
D5 II), enter the flow process of upgrading the work at present page;
D5 III), after the renewal of the page, set up the index of current page;
D5 IV), the page boundary inspection finishes.
6, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 5 is characterized in that: enter the flow process of upgrading the work at present page its steps d 5 II) and comprise the steps:
D5 II is 1.), judge whether to arrive the border of current sector, if enter steps d 5 II 2.), if not, the current page pointer added 1 after, enter steps d 5 II 6.);
D5 II is 2.), current sector serial number is added 1;
D5 II is 3.), the search minimum serial number the sector as current sector;
D5 II is 4.), wipe the data in the current sector;
D5 II is 5.), set up the index of current sector;
D5 II is 6.), in the bitmap of sector the mark current page;
D5 II is 7.), set up page index;
D5 II is 8.), upgrade current page and finish.
7, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 6 is characterized in that: its steps d 5 II are 5.) in set up the index of current sector flow process comprise the steps:
D5 II is i 5.), in the internal memory of data acquisition system (DAS) processor, set up second data buffering;
D5 II 5. ii), will have serial number, the current time of the sign of no datat, current sector to write in this second data buffering;
D5 II 5. iii), the data in second data buffering are written to the homepage of the current sector of FLASH ROM;
D5 II 5. iv), set up the index of the data block write;
D5 II 5. v), set up sector index and finish.
8, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 7 is characterized in that: its steps d 5 II 5. flow process of setting up institute's writing data blocks index described in iv) comprise the steps:
D5 II is iv1. 5.) in the data acquisition system (DAS) processor memory, set up the 3rd data buffering;
D5 II is iv2. 5.) current time, the work at present page etc. is write the 3rd data buffering;
D5 II is iv3. 5.) search lowest address index space in the homepage of the current sector of FLASH ROM;
D5 II is iv4. 5.) data in the 3rd data buffering are written in this index space;
D5 II is iv5. 5.) set up the data block index and finish.
9, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 5 is characterized in that: the flow process of setting up the current page index described steps d 5 III) comprises the steps:
D5 III is 1.), in the data acquisition system (DAS) processor memory, set up the 4th data buffering;
D5 III is 2.), current time, current Backup Data kind are write the 4th data buffering;
D5 III is 3.), with the data in the 4th data buffering be written to current page begin the place;
D5 III is 4.), set up page index and finish.
10, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 1 is characterized in that: the flow process of serial ports Interrupt Process described in its step a) comprises the steps:
A1 '), whether judgment data acquisition system serial ports interrupt processed command arrive, if this processing command byte is write in the order buffering of processor, enter step a2 ' afterwards); If not, directly enter step a2 ');
A2 '), rs 232 serial interface signal sends and handles;
A3 '), serial ports Interrupt Process flow process finishes.
11, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 1 is characterized in that: enter the system command treatment scheme in its step f) and comprise the steps:
F1), judge whether command format effective, if enter step f2), if not, enter step f4);
F2), the judgment data reading order mates that (this coupling refers to what and what coupling? how to mate? if), enter step f3); If not, enter step f5);
F3), carry out historical data and read treatment scheme;
F4), send the wrong cue of order, and data in the clear command buffering;
F5), the system command processing finishes.
12, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 11 is characterized in that: historical data its step f3) reads treatment scheme and comprises the steps:
F3 I), in the data acquisition system (DAS) processor memory, set up the 5th data buffering;
F3 II), the storage time of from the order buffering of processor, reading historical data;
F3 III), according to the storage time of the historical data that reads, enter the data query flow process;
F3IV), judge whether inquiry hits, if enter step f3V), if not, enter step f3 VII);
F3 V), from FLASH ROM, read historical data to the five data bufferings;
F3 VI), the data in the 5th data buffering are sent to host computer by serial ports;
F3 VII), send the query missed information;
F3 VIII), historical data reads the treatment scheme end.
13, the Miniature data backup method of data acquisition system based on FLASH ROM as claimed in claim 12 is characterized in that: the data query flow process step f3 III) comprises the steps:
F3 III 1.), search sector count;
F3 III 2.), judge whether the sector of search effective, if enter step f3 III 3.), if not, enter step f3 III 10.);
F3 III 3.), the search data blocks index count, after searching, enter step f3 III 4.);
F3 III 4.), judge the data block index date search whether with the time coupling of the historical data that requires, if enter step f3 III 5.), if not, enter step f3 III 9.);
F3 III 5.), searched page counting;
F3 III 6.), page index time of judging search whether with the time coupling of the historical data that requires, if return hiting signal, finish the data query flow process, if not, enter step f3 III 7.);
F3 III 7.), judge whether this sector page has been searched for, if enter step f3 III 8.), if not, return step f3 III 3.);
F3 III 8.), judge whether this sector data piece index has been searched for, if enter step f3 III 9.), if not, return step f3 III 1.),
F3 III 9.), judge whether whole sectors to have been searched for, if enter step f3 III 10.), if not, return step f3 III 1.);
F3 III 10.), return miss signal, end data query flow process.
CN2008101309873A 2008-02-01 2008-08-22 Miniature data backup method of data acquisition system based on FLASH ROM Expired - Fee Related CN101499026B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101309873A CN101499026B (en) 2008-02-01 2008-08-22 Miniature data backup method of data acquisition system based on FLASH ROM

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN200810049202.X 2008-02-01
CN200810049202 2008-02-01
CN2008101309873A CN101499026B (en) 2008-02-01 2008-08-22 Miniature data backup method of data acquisition system based on FLASH ROM

Publications (2)

Publication Number Publication Date
CN101499026A true CN101499026A (en) 2009-08-05
CN101499026B CN101499026B (en) 2012-07-04

Family

ID=40946108

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101309873A Expired - Fee Related CN101499026B (en) 2008-02-01 2008-08-22 Miniature data backup method of data acquisition system based on FLASH ROM

Country Status (1)

Country Link
CN (1) CN101499026B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102169497A (en) * 2011-04-13 2011-08-31 浪潮(北京)电子信息产业有限公司 Method and device for managing metadata through bitmaps
CN102819468A (en) * 2011-11-30 2012-12-12 凯迈(洛阳)环测有限公司 Backup and query method of FLASH-based small data
CN102819493A (en) * 2011-11-30 2012-12-12 凯迈(洛阳)环测有限公司 Storage and query method based on non-volatile memory chip
CN103020323A (en) * 2013-01-15 2013-04-03 山东大学 Method for retrieving and storing flash memory data on basis of unknown length binary search
CN103176859A (en) * 2011-12-21 2013-06-26 北京普源精电科技有限公司 Flash data backup/recovery method, equipment and signal source
CN108460044A (en) * 2017-02-20 2018-08-28 阿里巴巴集团控股有限公司 The treating method and apparatus of data
WO2020113438A1 (en) * 2018-12-04 2020-06-11 深圳迈瑞生物医疗电子股份有限公司 Automatic backup method, device and computer storage medium
CN115292266A (en) * 2022-05-30 2022-11-04 中国电子科技集团公司第五十二研究所 High-reliability log storage method based on memory

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102169497A (en) * 2011-04-13 2011-08-31 浪潮(北京)电子信息产业有限公司 Method and device for managing metadata through bitmaps
CN102819493B (en) * 2011-11-30 2015-11-18 凯迈(洛阳)环测有限公司 A kind of storage based on non-volatile memory chip and querying method
CN102819468A (en) * 2011-11-30 2012-12-12 凯迈(洛阳)环测有限公司 Backup and query method of FLASH-based small data
CN102819493A (en) * 2011-11-30 2012-12-12 凯迈(洛阳)环测有限公司 Storage and query method based on non-volatile memory chip
CN102819468B (en) * 2011-11-30 2014-09-24 凯迈(洛阳)环测有限公司 Backup and query method of FLASH-based small data
CN103176859A (en) * 2011-12-21 2013-06-26 北京普源精电科技有限公司 Flash data backup/recovery method, equipment and signal source
CN103020323A (en) * 2013-01-15 2013-04-03 山东大学 Method for retrieving and storing flash memory data on basis of unknown length binary search
CN103020323B (en) * 2013-01-15 2016-01-20 山东大学 A kind of method of the flash data retrieve stored based on unknown lengths binary chop
CN108460044A (en) * 2017-02-20 2018-08-28 阿里巴巴集团控股有限公司 The treating method and apparatus of data
CN108460044B (en) * 2017-02-20 2022-06-14 阿里巴巴集团控股有限公司 Data processing method and device
WO2020113438A1 (en) * 2018-12-04 2020-06-11 深圳迈瑞生物医疗电子股份有限公司 Automatic backup method, device and computer storage medium
CN115292266A (en) * 2022-05-30 2022-11-04 中国电子科技集团公司第五十二研究所 High-reliability log storage method based on memory
CN115292266B (en) * 2022-05-30 2024-05-14 中国电子科技集团公司第五十二研究所 High-reliability log storage method based on memory

Also Published As

Publication number Publication date
CN101499026B (en) 2012-07-04

Similar Documents

Publication Publication Date Title
CN101499026B (en) Miniature data backup method of data acquisition system based on FLASH ROM
CN101667205B (en) Method for memorizing real time measure point data for quick review
CN101238383B (en) GPS processing arrangement
TWI596486B (en) Memory storage apparatus, memory controller, and method for transmitting and identifying data stream
US7496703B2 (en) Virtual IDE card reader with PCI express interface
CN103034562A (en) Meta data handling within a flash media controller
TWI406130B (en) Data processing system, controller, and method thereof for searching specific memory area
CN103678638A (en) Object caching method based on disk
US20060206653A1 (en) [virtual ide storage device with pci express]
CN102169429A (en) Prefetch unit, data prefetch method and microprocessor
US8266371B2 (en) Non-volatile storage device, host device, non-volatile storage system, data recording method, and program
US20090037646A1 (en) Method of using a flash memory for a circular buffer
CN101432686A (en) Efficient storage and search of word lists and other text
CN111399750B (en) Flash memory data writing method and computer readable storage medium
CN100472526C (en) Method for storing, fetching and indexing data
CN201054183Y (en) Video direct automatic meter reading device
CN104657127B (en) System and method for automatically embedding operation collection element
US11630595B2 (en) Methods and systems of efficiently storing data
CN102365644A (en) Method for protecting sensitive data on a storage device having wear leveling
CN102262600B (en) Method and system for recognizing USB (Universal Serial Bus) equipment
CN103577119A (en) System and method for transferring data out of order in next generation solid state drive controller
CN103198002A (en) Measurement method and simulator for program running time
CN102520612B (en) Adaptive data acquisition device for ocean platform
CN101295312A (en) Method for presenting data by table
CN101853216B (en) Data processing system, controller, and method for searching specific memory area thereof

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
ASS Succession or assignment of patent right

Owner name: CAMA (LUOYANG) ENVIRONMENTAL MEASUREMENT CO., LTD.

Free format text: FORMER OWNER: CAMA (LUOYANG) MEASUREMENT + CONTROLS CO., LTD.

Effective date: 20120612

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 471009 LUOYANG, HENAN PROVINCE TO: 471000 LUOYANG, HENAN PROVINCE

TR01 Transfer of patent right

Effective date of registration: 20120612

Address after: 471000 No. 80, South South Road, Luoyang hi tech Development Zone, Henan

Patentee after: Kaimai (Luoyang) limited measuring ring

Address before: 471009 No. 89 Jiefang South Road, Henan, Luoyang

Patentee before: CAMA (Luoyang) Measurements & Controls Co., Ltd.

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20120704

Termination date: 20140822

EXPY Termination of patent right or utility model