CN114089916B - Data acquisition system and temperature and humidity sensor system - Google Patents

Data acquisition system and temperature and humidity sensor system Download PDF

Info

Publication number
CN114089916B
CN114089916B CN202111355122.9A CN202111355122A CN114089916B CN 114089916 B CN114089916 B CN 114089916B CN 202111355122 A CN202111355122 A CN 202111355122A CN 114089916 B CN114089916 B CN 114089916B
Authority
CN
China
Prior art keywords
page
data
setting
file
temperature
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
CN202111355122.9A
Other languages
Chinese (zh)
Other versions
CN114089916A (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.)
Zhuhai Geehy Semiconductor Co Ltd
Original Assignee
Zhuhai Geehy Semiconductor 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 Zhuhai Geehy Semiconductor Co Ltd filed Critical Zhuhai Geehy Semiconductor Co Ltd
Priority to CN202111355122.9A priority Critical patent/CN114089916B/en
Publication of CN114089916A publication Critical patent/CN114089916A/en
Application granted granted Critical
Publication of CN114089916B publication Critical patent/CN114089916B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Abstract

The embodiment of the application provides a data acquisition system and a temperature and humidity sensor system, wherein the system comprises a target setting page for determining a file to be stored for each file to be stored when at least one file to be stored is present, and target setting information related to data of the file to be stored is written into the target setting page; the target setting information comprises first page information of a target data page of a corresponding file to be stored; and for each file to be stored, determining a home page of a corresponding target data page according to corresponding home page information, and continuously writing the acquired target data into a Flash memory from the home page. The data page and the setting page of the file are separately arranged, the data writing process is convenient and quick, and the convenience and the quickness of the data writing process can be guaranteed when a plurality of files to be stored need to be obtained.

Description

Data acquisition system and temperature and humidity sensor system
The invention is a divisional application of an invention patent application with the application number of 201810031114.0 and the invention name of 'Flash memory and file management method and device of Flash memory' which are proposed on 12.1.1.2018.
Technical Field
The embodiment of the application relates to a memory technology, in particular to a data acquisition system and a temperature and humidity sensor system.
Background
The Flash memory is a nonvolatile memory based on semiconductor technology, has the advantages of low power consumption, large capacity, small volume, light weight, high access speed and the like, and is widely applied to mobile electronic products by gradually replacing other semiconductor memory devices.
Any Flash memory has a fixed storage capacity, and the write operation can only be performed in an empty or erased unit, so in most cases, the erase operation must be performed before the write operation is performed, but the life of the Flash chip is limited, and the Flash chip is easily damaged beyond the maximum erase time. In order to solve the problem that erasing must be executed before writing operation, the existing Flash file storage management method, for example, patent application with application number 01142240 named "Flash storage file management method", divides a Flash storage area into two areas, namely a file index area and a file data storage area, wherein the file index area is used for recording file directories and distribution information of basic distribution unit "blocks", and the file data storage area is used for storing specific contents of files, and is suitable for random reading, writing and erasing operations on files, and the operation is flexible.
However, in the above method, when the stored file includes two parts, namely, the setting information and the continuous data, the problems of complicated operation, difficulty in implementation, long operation delay and the like occur.
Disclosure of Invention
The embodiment of the application provides a Flash memory and a file management method and device of the Flash memory, so as to realize quick operation of a file containing setting information and continuous data.
In a first aspect, an embodiment of the present application provides a Flash memory, including: a storage area;
the storage area is divided into a plurality of pages, the storage area includes a content area for storing at least one file, each file includes a setup page and a data page, the data page is for storing data, and the setup page is for storing setup information related to collecting the data.
In one possible design, the storage area further includes an allocation area, the allocation area includes a plurality of entries, and when the content area stores N files, the content of each of the N entries in the allocation area is a page number of a setting page of the corresponding file, and the page number of the setting page is used to indicate a storage location of the setting page.
In one possible design, the storage area further includes a boot area and a default configuration area;
the guide area is used for storing attribute information of the corresponding data acquisition device and dividing information of the storage area;
the default configuration area is used for storing default setting information related to the collected data.
In a second aspect, an embodiment of the present application provides a file management method for a Flash memory, where the method is based on the method for a Flash memory in any possible design of the first aspect; the method comprises the following steps:
when at least one file to be stored exists, determining a target setting page of each file to be stored, and writing target setting information related to the acquisition of the data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a file to be stored;
for each file to be stored, determining a home page of a target data page of the file to be stored according to home page information in target setting information, and continuously writing acquired target data into the Flash memory from the home page; and the target data is acquired by the data acquisition device according to corresponding target setting information.
In one possible design, when the content area stores N files, and the content of each of the N items in the allocation area is the page number of the setting page of the corresponding file, the determining the target setting page of the file to be stored includes:
reading information included in a page where the distribution area is located to obtain the contents of all items included in the distribution area;
if the content area stores at least one file, acquiring the maximum page number in the content of the item including the page number in all the items;
obtaining the page number of the target setting page according to the maximum page number, wherein the page number of the target setting page is the sum of the maximum page number and a preset value;
and determining the target setting page according to the page number of the target setting page.
In a possible design, after reading information included in the page where the allocation area is located, and obtaining the content of at least one item, the method further includes:
acquiring the number of page numbers included in the contents of all the items, wherein the number is used for indicating the number of files stored in a content area;
acquiring a target storage position of the page number of the target configuration page in the allocation area according to the number, the offset address of the first item in the allocation area and the number of bytes occupied by each item;
after obtaining the page number of the target setup page according to the maximum page number, the method further includes:
writing a page number of the target setup page at a target storage location of the allocation area.
In one possible design, after the obtaining the maximum page number in the content of the at least one item, the method includes:
reading the content of a first setting page indicated by the maximum page number to obtain first setting information in the first setting page, wherein the first setting information comprises tail page information of a data page of a file;
and determining the first page information of the target data page of the file to be stored according to the tail page information.
In a possible design, when the storage area further includes an allocation area, and the allocation area includes a plurality of entries, and when the content area stores N files, and then the content of each of the N entries in the allocation area is the page number of the setting page of the corresponding file, the method further includes:
after the process of data acquisition is finished, for each file to be stored, writing tail page information of the file to be stored into a target configuration page of the file to be stored; wherein the end page information includes a physical address where the last item of collected data is stored.
In a possible design, the storage area further includes an allocation area, and the allocation area includes a plurality of entries, when the content area stores N files, the content of each of the N entries in the allocation area is the page number of the setting page of the corresponding file; the method further comprises the following steps:
reading information included in a page where the distribution area is located to obtain a page number of at least one setting page;
reading the setting information of the setting page indicated by each page number according to the page number of the at least one setting page to obtain the setting information of each file stored in the Flash memory;
reading data included in a data page of a file to be read according to an identifier of the file to be read input by a user; and the identification of the file to be read is acquired by the user according to the setting information of each file stored in the Flash memory.
In a third aspect, an apparatus for managing files of a Flash memory according to an embodiment of the present application is based on the Flash memory described in any one of the possible designs of the first aspect, and includes:
the information setting module is used for determining a target setting page of each file to be stored when at least one file to be stored is available, and writing target setting information related to the acquisition of the data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a file to be stored;
the data writing module is used for determining a home page of a target data page of each file to be stored according to home page information in the target setting information, and continuously writing the acquired target data into the Flash memory from the home page; and the target data is acquired by the data acquisition device according to corresponding target setting information.
In one possible design, the apparatus further includes: a data reading module;
the data reading module is used for further comprising a distribution area in the storage area, the distribution area comprises a plurality of items, and when N files are stored in the content area, the content of each of the N items in the distribution area is the page number of the setting page of the corresponding file; reading information included in a page where the distribution area is located to obtain a page number of at least one setting page;
reading the setting information of the setting page indicated by each page number according to the page number of the at least one setting page to obtain the setting information of each file stored in the Flash memory;
reading data included in a data page of a file to be read according to an identifier of the file to be read input by a user; the identification of the file to be read is obtained by the user according to the setting information of each file stored in the Flash memory.
In a fourth aspect, an embodiment of the present application provides a file management system for a Flash memory, including: the Flash memory, the data acquisition device, the control equipment of the data acquisition device and the terminal equipment in any possible design of the first aspect;
the Flash memory, the data acquisition device and the terminal equipment are all connected with the control equipment of the data acquisition device;
wherein the control device of the data acquisition device comprises the file management device of the Flash memory in any possible design of the third aspect.
In a fifth aspect, embodiments of the present application provide a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the method as set forth in any one of the possible designs of the second aspect.
In a sixth aspect, an embodiment of the present application provides an electronic device, including: the device comprises a processor, a memory and a communication bus, wherein the communication bus is used for realizing the connection between each component, the memory is used for storing program instructions, and the processor is used for reading the program instructions in the memory and executing the method in any one of the possible designs of the second aspect according to the program instructions in the memory.
In the application, the setting page and the data page of the file are separately set, and the setting page contains the home page information of the corresponding data page, so that the setting information can be conveniently and quickly written into the setting page, and the data can be written into the data page. Meanwhile, the setting information of the files to be stored can be written into respective setting pages, data are acquired according to the setting information related to the acquired data in the respective setting information and are written into the respective data pages, and the convenience and the rapidness of the data writing process are ensured when the files to be stored need to be obtained.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
FIG. 1 is a diagram of one possible system architecture provided by an embodiment of the present application;
fig. 2 is a schematic diagram illustrating division of a storage area of a Flash memory according to an embodiment of the present application;
FIG. 3 is a diagram illustrating a file attribute definition provided in an embodiment of the present application;
fig. 4 is a diagram illustrating a definition of a start-up mode according to an embodiment of the present application;
FIG. 5 is a diagram illustrating a stop mode definition provided in an embodiment of the present application;
FIG. 6 is a first flowchart of a file management method for a Flash memory according to the present application;
fig. 7 is a schematic diagram illustrating distribution of storage areas of a Flash memory according to an embodiment of the present application;
FIG. 8 is a flowchart of a second file management method for a Flash memory according to the present application;
fig. 9 is a schematic structural diagram of a first implementation of a file management apparatus of a Flash memory according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a second implementation of the file management apparatus for a Flash memory according to the embodiment of the present application;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a diagram of a possible system architecture provided in an embodiment of the present application, and referring to fig. 1, the system architecture may include a Flash memory 11, a data acquisition apparatus 12, a control device 13 of the data acquisition apparatus, and a terminal 14. The storage area of the Flash memory 11 is divided into a plurality of pages, the storage area includes a content area, the content area is used for storing at least one file, each file includes a setting page and a data page, the data page is used for storing data collected by the data collecting device, the setting page is used for storing setting information related to the collected data, the setting information includes first page information of the data page corresponding to the setting page, and the data page of each file is at least one page.
Specifically, after the Flash memory 11 is connected to the control device 13, the control device 13 may perform a write operation on the Flash memory and an operation of reading information stored in the Flash memory. The control device 13 can receive the setting information related to the acquired data sent by the terminal 14, and write the setting information related to the acquired data into the setting page in the Flash memory 11, and the control device 13 controls the data acquisition device 12 to acquire data according to the setting information in the setting page in the Flash memory 11, and writes the data acquired by the data acquisition device 12 into the data page; wherein the setup page and the data page constitute the contents of one file.
Because each file stored in the Flash memory comprises a setting page and a data page, when the corresponding file is written in, the setting page is firstly determined, and partial setting information is written in the setting page, so that the control equipment can control the data acquisition device to acquire data according to the setting information, the writing process of the setting information is quick and convenient, and because the setting information comprises the first page information of the data page of the corresponding file, the area for continuously writing the acquired data is also determined, so that the continuous data writing process is also quick and convenient.
The Flash memory of the present application will be described in detail below with reference to specific embodiments.
Fig. 2 is a schematic diagram illustrating a memory area division of a Flash memory according to an embodiment of the present application, and referring to fig. 2, the memory area of the Flash memory is divided into a plurality of pages, and the memory area includes a content area 21, an allocation area 22, a boot area 23, and a default configuration area 24.
The content area 21 is used for storing at least one file, each file including a setting page and a data page, the data page being used for storing data, and the setting page being used for storing setting information related to acquired data.
The allocation area 22 includes a plurality of items, and when the content area stores N files, the respective contents of the N items in the allocation area include the page numbers of the setting pages of the corresponding files.
The guide area 23 is used to store attribute information of the corresponding data acquisition device and division information of the storage area.
The default configuration area 24 is used to store default setting information related to the acquired data.
Specifically, the storage area of the Flash memory in this embodiment is divided into a plurality of pages starting with number 0 according to the minimum unit of Flash erasure, and if the storage capacity of the Flash memory is 2m and the minimum unit of Flash erasure is 1KB, the storage area is divided into 2048 pages, where the number of pages for storage may be less than or equal to 2048 pages.
First, the guide area 23 will be explained.
The guiding area 23 is configured to store attribute information of the corresponding data acquisition device and partition information of the storage area, such as a storage version, a name, creation time, a type of the data acquisition device, a start page number and a number of occupied pages of each area of the storage area, and may further include: the data acquisition device delivery time, calibration data, and the like. Page 0 of the storage area may be used as a lead-in area.
If the data acquisition device is a temperature and humidity sensor, the specific data and attributes stored in the boot area of the Flash memory can be referred to table 1.
TABLE 1 specific data and attributes stored in the boot sector
Figure GDA0003910624410000071
Figure GDA0003910624410000081
Referring to table 1, the guide region includes: the storage name, the temperature resolution, the actual minimum temperature represented by 0, the maximum temperature, the humidity resolution, the actual minimum humidity represented by 0, the maximum humidity and the like of the temperature and humidity sensor; further comprising: the initial page number of the guide area, the initial page number of the default configuration area, the initial page number of the distribution area, the initial page number of the content area and the page number of the content area.
Therefore, by reading the contents of the lead-in area, the positions of the allocation area, the default allocation area, and the contents area can be known.
Wherein, for temperature resolution; two bytes are used for representation: [ Byte High ,Byte Low ],Byte High Representing the number of bits after the decimal point, byte Low Representing a number, hence a temperature resolution T 1 The conversion formula of (c) is:
Figure GDA0003910624410000082
that is, if the temperature resolution stored in the boot sector is 0x201, the actual temperature is divided intoThe resolution is
Figure GDA0003910624410000083
Wherein, the low Byte corresponding to 0x201 Low Is 0X01,0X201 corresponding to the upper Byte Byte High Is 0X02, [0X02,0X01]=0X201。
In the actual use process, the control device of the temperature and humidity sensor reads the temperature resolution stored in the guide area, and according to the method, the actual temperature resolution can be obtained and used for controlling the temperature measurement of the temperature and humidity sensor.
For the actual minimum temperature T which can be detected in the detection range of the temperature and humidity sensor Min Shi : if the temperature value T stored in the Flash memory Flash1 When it is 0, it is-46.85 ℃ and T is Min If = 46.85 ℃, then T Min Shi =T Flash1 *T 1 +T Min =0*0.01-46.85=-46.85。
For the humidity resolution: represented in two bytes: [ Byte High ,Byte Low ],Byte High Representing the number of bits after the decimal point, byte Low Number of tables, therefore humidity resolution H 1 The conversion formula of (c) is:
Figure GDA0003910624410000091
that is, if the humidity resolution stored in the guiding area is 0x201, the actual temperature resolution is
Figure GDA0003910624410000092
Wherein, the low Byte corresponding to 0x201 Low Is 0X01,0X201 corresponding to the upper Byte Byte High Is 0X02, [0X02,0X01]=0X201。
In the actual using process, the control device of the temperature and humidity sensor reads the humidity resolution stored in the guide area, and according to the method, the actual humidity resolution can be obtained and used for controlling the temperature and humidity sensor to measure the humidity.
For the conversion between the actual temperature and the temperature value stored in the Flash memory: if the temperature value stored in the Flash memory is known to be T Flash2 Then the actual temperature T Fruit of Chinese wolfberry =T Flash2 ×T 1 +T Min fruit If the actual temperature T is known Fruit of Chinese wolfberry Then, then
Figure GDA0003910624410000093
In the actual using process, if the control device of the temperature and humidity sensor reads the temperature value stored in the Flash memory, the temperature value can be obtained through the formula: t is Fruit of Chinese wolfberry =T Flash2 ×T 1 +T Min Shi Obtaining the actual temperature; if the control equipment of the temperature and humidity sensor writes the temperature value acquired by the temperature and humidity sensor into the Flash memory, the formula is passed
Figure GDA0003910624410000094
And obtaining the value stored in the Flash memory.
For the conversion between the actual humidity and the humidity value stored in the Flash memory: if the humidity value stored in the Flash memory is known to be H Flash Then the actual humidity H Fruit of Chinese wolfberry =H Flash ×H 1 +H Min If the actual humidity H is known Fruit of Chinese wolfberry Then, then
Figure GDA0003910624410000095
As can be seen from Table 1, H Min Equal to 0.
In the actual using process, if the control device of the temperature and humidity sensor reads the humidity value stored in the Flash memory, the humidity value can be obtained through the formula: h Fruit of Chinese wolfberry =H Flash ×H 1 +H Min Obtaining the actual humidity; if the control equipment of the temperature and humidity sensor writes the humidity value acquired by the temperature and humidity sensor into the Flash memory, the formula is passed
Figure GDA0003910624410000096
And obtaining the value stored in the Flash memory.
Next, the default configuration area 24 will be described.
A default setting area 24 for storing default setting information related to the collected data, such as a sampling interval in the setting information.
Next, the allocation area 22 will be explained.
The allocation region 22 includes a plurality of entries, each entry occupies 2 bytes, each byte is 8 bits, i.e., 16bytes, and the content of each entry sets the page number of a page for a corresponding file; if the content area 21 stores N files, there are N entries in the allocation area, and the respective content is the page number of the setting page of the corresponding file; the contents of the remaining items other than the N items may be ffffH.
In this way, the physical address of the first entry in the allocation area is the start address of the page where the allocation area is located, so that the offset address of the first entry in the allocation area can be known, the offset address corresponding to the storage location of the target setting page of the current file to be stored can be obtained according to the number of files in the content area and the number of bytes occupied by each entry, and the physical address for storing the target setting page can be obtained according to the offset address corresponding to the storage location of the target setting page.
Next, the content area 21 will be explained.
The content area 21 is used to store at least one file, each file including a setup page and a data page.
The data pages are used for continuously storing the data collected by the data collection device, the data pages of each file at least comprise one page, and the number of pages included in the data pages of each file is not limited and is related to the data which needs to be stored specifically.
The setting page is used for storing setting information related to the acquired data, and the setting information comprises home page information of a data page corresponding to the setting page.
If the data acquisition device is a temperature and humidity sensor, the specific data stored in the setting page of the Flash memory can be referred to table 2.
TABLE 2 specific data of the setup page store
Figure GDA0003910624410000101
Figure GDA0003910624410000111
As can be seen from table 2, the setting items of the setting page include: the method comprises the following steps of file attribute, starting mode of a temperature and humidity sensor, stopping mode of the temperature and humidity sensor, sampling interval of the temperature and humidity sensor, sampling starting time, sampling stopping time, address of the first page 0 for storing sampling data, effective data ending address and the like.
After the setting items are set, setting information related to the acquired data can be obtained.
Fig. 3 is a file attribute definition diagram provided in the embodiment of the present application, fig. 4 is a start mode definition diagram provided in the embodiment of the present application, and fig. 5 is a stop mode definition diagram provided in the embodiment of the present application.
For file attributes, see FIG. 3, two bytes are occupied, 16 bits, with unused bits defaulting to "1"; for the 0 bit: if the 0 bit is 0, the temperature sampling is carried out, and if the 0 bit is 1, the temperature sampling is not carried out; for 1 bit: a value of 0 indicates that the humidity sampling is performed, and a value of 1 indicates that the humidity sampling is not performed.
When the user needs to detect the temperature, the user inputs a temperature acquisition instruction through the terminal, the terminal sends the temperature acquisition instruction to the control equipment of the temperature and humidity sensor, the control equipment of the temperature and humidity sensor sets the file attribute to be the acquisition temperature according to the received temperature acquisition instruction, namely, the value of 0 bit of the byte corresponding to the file attribute is replaced by 0 from 1. When the user needs to detect temperature and humidity, the user inputs a temperature and humidity acquisition instruction through the terminal, the terminal sends the temperature and humidity acquisition instruction to the control equipment of the temperature and humidity sensor, the control equipment of the temperature and humidity sensor sets file attributes to acquire temperature and humidity according to the received temperature and humidity acquisition instruction, namely, the value of 0 bit of a byte corresponding to the file attributes is replaced by '0' from '1', and the value of 1 bit is replaced by '0' from '1'.
Through the process, the setting of the file attribute is completed, and the setting information corresponding to the file attribute is obtained.
For the starting mode of the temperature and humidity sensor, referring to fig. 4, two bytes and 16 bits are occupied, and the unused bits are defaulted to "1"; for the 0 bit: if the 0 bit is 1, the temperature and humidity sensor is started by the key, otherwise, the key does not influence the starting of the temperature and humidity sensor; for 1 bit: and if 0 represents that the setting information is set, starting the temperature and humidity sensor after a period of time (the delay time is set by the user through the terminal), and if 2 bits: and 1 denotes the timing of the start of the temperature and humidity sensor.
For the setting of the starting mode, the process of obtaining the setting information corresponding to the starting mode refers to the process of obtaining the setting information corresponding to the file attribute, which is not described herein again.
For the stop mode, see fig. 5, two bytes, 16 bits are occupied, and unused bits default to "1"; for the 0 bit: if the value is 0, the button stops the temperature and humidity sensor, otherwise, the button does not influence the stop of the temperature and humidity sensor; for 1 bit: the value of 0 indicates that the sampling is stopped when the data is read from the Flash memory, otherwise, the sampling is not influenced; for 2 bits: a value of 0 indicates that the number of samples is fixed, otherwise the sample length is not limited.
For the setting of the stop mode, the process of obtaining the setting information corresponding to the stop mode refers to the process of obtaining the setting information corresponding to the file attribute, which is not described herein again.
For the sampling interval: the user passes through the terminal input sampling interval, and the terminal sends the sampling interval to temperature and humidity sensor's controlgear, and temperature and humidity sensor's controlgear will receive the sampling interval and write in to the byte department that the sampling interval corresponds, has obtained the setting information: a sampling interval.
If the user does not set the sampling interval through the terminal, when the control equipment of the temperature and humidity sensor controls the temperature and humidity sensor to sample, the temperature and humidity sensor can be controlled to sample through reading the default sampling interval in the default setting page.
For the sample start time: when the temperature and humidity sensor starts to collect corresponding data, the control equipment of the temperature and humidity sensor writes corresponding time into the byte position corresponding to the sampling start time, and the setting information is obtained: the start time of the sampling.
For the sampling stop time: when the temperature and humidity sensor stops collecting corresponding data, the control equipment of the temperature and humidity sensor writes corresponding time into the byte position corresponding to the sampling stop time, and setting information is obtained: the stop time is sampled.
For the address at home page 0 address where sampled data is stored: the utility model provides a mode is that the address of the first page 0 address department of user's accessible terminal input storage sampling data, and the terminal sends the address of the first page 0 address department of storage sampling data to temperature and humidity sensor's controlgear, and temperature and humidity sensor's controlgear writes in the address of the first page 0 address department of receiving storage sampling data to setting page, has obtained the setting information: the address at the first page 0 address of the sampled data is stored. Another way is: the control device of the temperature and humidity sensor writes the address at the first page 0 address for storing the sampling data into the setting page.
The "address at the address of the first page 0 storing the sampled data" determines the first page information of the data page of the corresponding file, that is, the page corresponding to the "address at the address of the first page 0 storing the sampled data" is the first page of the data page of the corresponding file.
For valid data termination address: after the data acquisition is finished, the control equipment of the temperature and humidity sensor writes the actual effective data termination address (namely the address for storing the last acquired data of the corresponding file).
The setting process of the setting information of other setting items is not described in this embodiment again. The setup page of a file includes setup information that is descriptive of attributes of data stored in the data pages of the file. The control equipment of the data acquisition device controls the temperature and humidity sensor to acquire data at present according to the set information: such as the collection temperature or humidity, the sampling interval, the page from which the collected data is written (i.e. the first page of the data page), the collection of data and the writing of the collected data are performed, and in the whole process of collecting data, the information of the setting page related to the collected data is perfected, such as: sample start time, sample stop time, valid data end address. After the data collection is finished, the file corresponding to the data collection process is stored, the setting information (i.e., the attribute) of the file, i.e., how to collect, what to collect, the storage address of the collected data, etc., is stored in the file setting page, and the collected data is continuously stored in the data page.
The following describes the file management method of the Flash memory according to the present application in detail by using a specific embodiment.
Fig. 6 is a first flowchart of a file management method of a Flash memory provided in the present application, as shown in fig. 6, the method of this embodiment may include:
step S101, when at least one file to be stored exists, determining a target setting page of the file to be stored for each file to be stored, and writing target setting information related to data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a corresponding file to be stored;
step S102, for each file to be stored, determining a home page of a target data page of the file to be stored according to home page information in target setting information, and continuously writing acquired target data into a Flash memory from the home page; wherein, the target data is acquired by the data acquisition device according to the corresponding target setting information.
Specifically, the execution subject in this embodiment may be the control device 13 in fig. 1, and relates to a method for writing a file to the Flash memory in the embodiment shown in fig. 2.
The following describes a process of writing a file into the Flash memory in the embodiment shown in fig. 2, taking a data acquisition device as a temperature and humidity sensor as an example.
For step S101: when a user needs to start one or more data acquisition processes, namely at least one file to be stored exists, determining a respective target configuration page of each file to be stored so as to write target setting information related to acquisition of data of the corresponding file to be stored into the corresponding target configuration page; the setting information related to collecting data of the corresponding file to be stored includes the first page information of the target data page of the corresponding file to be stored, so that when a user needs to start one or more data collecting processes, that is, when at least one file to be stored exists, the first page information of the target data page of the file to be stored needs to be determined.
The above target setting information further includes: file attributes, a starting mode of the temperature and humidity sensor, a stopping mode of the temperature and humidity sensor, sampling intervals of the temperature and humidity sensor and the like. The target setting information is determined by a user according to the requirement of the user, so that the target setting information can be set by a terminal and then sent to the control equipment of the temperature and humidity sensor, and the control equipment of the temperature and humidity sensor writes the target setting information into a target configuration page.
It can be understood by those skilled in the art that the target setting information is not all setting information of the file to be stored, and after the data acquisition process is started, the control device of the temperature and humidity sensor may also write setting information related to the acquired data, such as start sampling time, end sampling time, and the like.
The following describes a procedure for determining the first page information of the target data page of the file to be stored and a procedure for determining the target configuration page of the file to be stored, respectively.
Before describing the process of determining the first page information of the target data page of the file to be stored and the process of determining the target configuration page of the file to be stored, the distribution of the storage area of the Flash memory is described first.
Fig. 7 is a schematic diagram of distribution of storage areas of a Flash memory according to an embodiment of the present application.
Referring to fig. 7, it can be seen that the leading area is on the front page, the default configuration area is on the back page of the leading area, the allocation area is on the back page of the default configuration area, and the content area is on the back page of the allocation area. The first P pages of the content area are setting pages of each file, the setting page of each file is 1 page, and the following S pages are data pages of each file.
For the allocation area and the content area: referring to fig. 7, the content of an item having item number 0005H in the allocation area is 000BH indicating the set page of the 000BH page in the content area, and the content of an item having item number 0006H in the allocation area is 0010H indicating the set page of the 0010H page in the content area. The item numbers are only used for clarity of description of the allocation region, and no item numbers are stored in the allocation region.
First, a process of determining the top page information of the target data page of the file to be stored will be described.
The process of determining the first page information of the target data page of the file to be stored may be as follows:
a1, reading information included in a page where a distribution area is located to obtain contents of all items included in the distribution area;
a2, if the content area stores at least one file, acquiring the maximum page number in the content of all items including the items of the page number;
a3, reading the content of a first setting page indicated by the maximum page number to obtain first setting information in the first setting page, wherein the first setting information comprises tail page information of a data page of a file;
and A4, determining the first page information of the file to be stored according to the tail page information of the data page of the file included in the first setting information.
For A1, the control device of the temperature and humidity sensor reads the guide area to know the starting page of the distribution area and the number of pages occupied by the distribution area, namely, the page where the distribution area is located.
After the page of the distribution area is obtained, the control equipment of the temperature and humidity sensor reads the information included in the page of the distribution area to obtain the contents of all items included in the distribution area; wherein the allocation area includes a plurality of items, and the content of each item does not necessarily set the page number of the page for the file.
For A2-A3, if the content area stores at least one file, extracting the maximum page number from the content of all items including the page number in the distribution area; according to the maximum page number, the setting information of the first setting page indicated by the maximum page number is read, that is, if the maximum page number is M, the content of the mth page is read. The maximum page number is the page number of the configuration page of the last file stored in the content area, and the first setting page is the setting page of the last file stored in the content area. From the foregoing description of the setup page, it can be known that the setup page includes the end page information of the file: valid data end address, and therefore, the last page information of the last file stored in the content area is available according to the setting information of the read first setting page.
And for A4, determining the first page information of the file to be stored according to the last page information of the last file stored in the content area under the condition that at least one file is stored in the content area. For example, the last page number of the last file stored in the content area is determined to be K according to the last page information of the last file stored in the content area, then the first page number of the data of the file to be stored may be K +1, and certainly may also be K +2, and so on, and then the first page information of the target data page of the file to be stored may be obtained, such as: the address at the first page 0 address of the target page of data.
If the content area does not store files, and the first page of the first file to be stored is determined, the page number of the first page of the file to be stored can be P +3 (corresponding to the fact that the content area comprises a P page setting page, a distribution area occupies a page, a default configuration area occupies a page, and a guide area occupies a page, the first page of the content area capable of storing data is the P +4 th page of the storage area, and the page number is P + 3).
The execution main body of the process of acquiring the home page information of the target data page is the control equipment of the temperature and humidity sensor, the starting mode of the temperature and humidity sensor is the key starting, at the moment, the control equipment of the temperature and humidity sensor can determine the home page information of the target data page of the file to be stored according to the methods in A1-A4 after receiving the starting instruction of the temperature and humidity sensor input by a user through the key, then write the home page information of the target data page of the file to be stored into the target setting page, and then control the temperature and humidity sensor to start to collect data.
In addition, the control device of the temperature and humidity sensor can send the setting information of the read first setting page to the terminal for displaying according to the method in the steps A1 to A3, after the user determines the first page information of the target data page of the file to be stored according to the method in the step A4, the first page information of the target data page of the file to be stored is input into the terminal, the terminal sends the first page information to the control device of the temperature and humidity sensor, and the first page information of the target data page of the file to be stored is written into the target configuration page by the control device of the temperature and humidity sensor. At this time, if the content area does not store a file, the page number transmitted to the terminal may be P +3 when determining the top page of the first file to be stored.
At this time, the tail page information in the first setting page can be displayed as a tail page number at the terminal, that is, the control device of the temperature and humidity sensor converts the 'valid data end address' into the tail page number and then sends the tail page number to the terminal for displaying. The home page information input by the user can also be a home page number, and the control equipment of the temperature and humidity sensor can convert the received home page number into an address of a home page 0 address for storing sampling data and then write the address into a target setting page.
It should be understood by those skilled in the art that when there are a plurality of files to be stored and the setting information of each file to be stored is written into the corresponding target setting page, since the data is not collected and written yet, the last page information of each file to be stored cannot be known, the first page information of the target data page of the first file to be stored (the file to be stored whose setting page number is the smallest) may be determined according to the above method, and after the first page information of the target data page of the second file to be stored is stored completely, the control device of the temperature and humidity sensor may determine the first page information according to the method in A1 to A4 and then write the first page information into the corresponding setting page (that is, the first page information of the setting information is not set through the terminal first), at this time, there is no case that the content area does not include a file, and the maximum page number of the allocation area that is read at this time is the page number of the configuration page of the first file to be stored, and the last file stored in the content area is the first file to be stored. For the first page of the target data page of the other file to be stored, the obtaining principle is the same as that of the second file to be stored, and details are not repeated here.
Next, a process of acquiring a target configuration page of a file to be stored is explained.
The process of obtaining the target configuration page of the file to be stored may be as follows:
b1, reading information included in a page where the distribution area is located to obtain the content of all items included in the distribution area;
b2, if the content area stores at least one file, acquiring the maximum page number in the content of all items including the items of the page number;
b3, obtaining the page number of the target setting page according to the maximum page number, wherein the page number of the target setting page is the sum of the maximum page number and a preset value;
and B4, determining the target setting page according to the page number of the target setting page.
For B1: see the foregoing description of A1, which is not repeated here.
For B2-B3, if the content area stores at least one file, extracting the maximum page number from all the contents including the page number in all the items included in the distribution area; if the number of pages occupied by the setting page of each file is 1 page, the page number of the target setting page can be obtained by adding 1 to the maximum page number, namely the preset value at this time is 1. After the page number of the target setting page is obtained, the target setting page, that is, the physical address of the Flash memory corresponding to the target setting page is determined.
If the content area does not store the file, the maximum page number does not exist, and when the page number of the target setting page of the first file to be stored is determined, if the distribution area occupies one page, the default configuration area occupies one page, and the guide area occupies one page, the page number of the target setting page of the first file to be stored is 3.
In addition, the page number of the target setup page of the file to be stored needs to be written into the allocation area. The specific method comprises the following steps:
c1, reading information included in a page where the distribution area is located to obtain the content of all items included in the distribution area;
c2, acquiring the number of page numbers included in the contents of all the items, wherein the number is used for indicating the number of files stored in the content area;
c3, acquiring the target storage position of the page number of the target configuration page in the distribution area according to the number of files stored in the content area, the item number of the first item in the distribution area and the number of bytes occupied by each item;
c4, writing the page number of the target page at the target storage position.
Specifically, for C1, refer to the foregoing explanation of A1, which is not described herein again.
For C2, how many page numbers are read out from the allocation area indicates how many set pages the content area has, because each file has one set page, and therefore, the number of page numbers included in the contents of all items of the allocation area is the same as the number of files included in the content area.
For C3, as described above, each entry in the allocation area occupies two bytes, and therefore, the target storage location of the page number of the target configuration page in the allocation area can be obtained according to the number of files included in the content area (or the number of page numbers included in the content of the read at least one entry), the offset address of the first entry in the allocation area, and the number of bytes occupied by each entry. The target storage position is a physical address for storing the page number of the target configuration page. The physical address of the first entry in the allocation area is the start address of the page where the allocation area is located, so that the offset address of the first entry in the allocation area can be known.
Specifically, the target storage location of the page number of the target configuration page in the allocation area can be obtained by the following implementation modes: acquiring a target offset address of an item storing a page number of a target configuration page according to the number of files included in a content area, the offset address of a first item in an allocation area and the number of bytes occupied by each item; the physical address of the page number storing the target configuration page, that is, the target storage location, is obtained according to the sum of the target offset address and the base address of the allocation area.
For step S102, after the target setting information is written into the target setting page, the control device of the temperature and humidity sensor may, according to the first page information in the target setting information: "storing the address of the first page 0 address of the sampled data" to obtain the first page of the target data page, that is, to obtain the physical address of the first page of the target data page; the target data page is used for storing data of a file to be stored, the data of the file to be stored is data acquired by the temperature and humidity sensor according to set target setting information in the target setting page after the current acquisition process starts, and the set target setting information in the target setting page can include: temperature sampling, sampling interval 0.01S, etc. are performed.
After the home page of the target data page is determined, the control equipment of the temperature and humidity sensor controls the temperature and humidity sensor to start collecting data according to the starting mode of the temperature and humidity sensor set in the target setting page, controls the temperature and humidity sensor to collect data according to the setting information related to the data collecting process in the target setting information, and continuously writes the data collected by the temperature and humidity sensor into the Flash memory from the home page.
Specifically, the temperature and humidity sensor converts data acquired according to setting information related to the data acquisition process in the target setting information into values stored in the Flash memory, and then continuously writes the values into the Flash memory from the home page. The method for converting the collected temperature and/or humidity into the value stored in the Flash memory by the temperature and humidity sensor is described in the section of the "guide area" above.
Each item in each of the target data pages is data of one sample point, and the length of each sample point is determined by the file attribute. When the file attribute is temperature sampling, the length of data of each sampling point is two bytes, and when the file attribute is temperature sampling and humidity sampling, the length of data of each sampling point is four bytes, the first two bytes are temperature representation, and the last two bytes are humidity representation. That is, the target data page is composed of a series of sample point data, and each byte not used in the corresponding page may be 0xff.
After the data acquisition is finished, for each file to be stored, writing the tail page information of the file to be stored into the target configuration page of the file to be stored, and perfecting the target configuration information of the target configuration page, namely perfecting the attribute information of the data of the file to be stored. The end page information may include a physical address where the last item of sampled data is stored.
As can be understood by those skilled in the art, if there are a plurality of files to be stored, step S101 and step S102 may be performed sequentially, that is, after setting information of the plurality of files to be stored is written into respective setting pages, data is acquired according to setting information related to acquired data in the respective setting information, and the acquired setting information is written into respective data pages, that is, setting information of the plurality of files to be stored is set, and then data of each file to be stored is acquired; step S101 and step S102 may also have no precedence, that is, the setting information of one file to be stored is written into the corresponding setting page, then the data of the file to be stored is collected, then the setting information of the next file to be stored is written into the corresponding setting page and the data of the file to be stored is collected, that is, after the setting information of one file to be stored is set, the data of one file to be stored is collected.
In the embodiment, the setting page and the data page of the file are separately set, and the setting page contains the first page information of the corresponding data page, so that the setting information can be conveniently and quickly written into the setting page, and the data can be written into the data page. Meanwhile, the setting information of the files to be stored can be written into respective setting pages, data are acquired according to the setting information related to the acquired data in the respective setting information and are written into the respective data pages, and the convenience and the rapidness of the data writing process are ensured when the files to be stored need to be obtained.
The file management method of the Flash memory comprises the steps of determining a target setting page of a file to be stored for each file to be stored when at least one file to be stored is stored, and writing target setting information related to data of the file to be stored into the target setting page; the target setting information comprises first page information of a data page of a corresponding file to be stored; for each file to be stored, determining a home page of a target data page of the file to be stored according to home page information included in the target setting information, and continuously writing the acquired target data into a Flash memory from the home page; the target data is acquired by the data acquisition device according to the information related to the acquired data in the corresponding target setting information. The file management method of the Flash memory of the embodiment has the advantages that the data writing process is convenient and quick, and the data writing process can be ensured to be convenient and quick when a plurality of files to be stored need to be obtained.
The following describes a process of reading a file from a Flash memory by using a specific embodiment.
Fig. 8 is a flowchart of a second file management method for a Flash memory according to the present application, and as shown in fig. 8, the method of this embodiment may include:
step S201, reading information included in a page where the distribution area is located to obtain a page number of at least one setting page;
step S202, reading the setting information of the setting page indicated by each page number according to the page number of at least one setting page to obtain the setting information of each file stored in a Flash memory;
step S203, reading specific data included in a data page of the file to be read according to the file to be read identifier input by a user; the file identification to be read is determined by the user according to the setting information of each file stored in the Flash memory.
Specifically, for step S201, the control device of the humidity sensor knows the start page of the dispensing area and the number of pages occupied by the dispensing area, that is, the page where the dispensing area is located, by reading the lead area.
After knowing the page of the distribution area, the control device of the temperature and humidity sensor reads the information included in the page of the distribution area to obtain the contents of all items, extracts the page numbers in the contents of the items including the page numbers in all items, and obtains the page number of at least one set page.
In step S202, the setting information of the setting page indicated by each page number is read according to the page number of at least one setting page, and the setting information of each file stored in the Flash memory is obtained, that is, a setting information list is obtained, where the setting information list includes the setting information of all files stored in the Flash memory.
In step S203, after the control device of the temperature and humidity sensor obtains the setting information of all files stored in the Flash memory, the setting information is sent to the terminal for displaying, and the user obtains the setting information of all files stored in the Flash memory through the display interface of the terminal.
As described above, the setting information of each file includes file attributes, sampling intervals, sampling start times, sampling end times, leading page information and trailing page information of data pages, and the like. For example, if a user wants to view temperature data sampled within a time range from a1 to a2, and the file attribute in the setting information of a certain file is temperature sampling, the sampling start time is b1, the sampling end time is b2, b1 is earlier than or equal to a1, b2 is later than or equal to a2, the file can be determined as a file to be read, and the first page information and the last page information of the data page in the setting information are the identifiers of the determined file to be read; and the user inputs the identifier of the file to be read through the terminal, wherein the first page information seen by the user on the display interface can be the first page number, and the tail page information seen on the display interface can be the tail page number.
The terminal sends the identification of the file to be read to the control equipment of the temperature and humidity sensor, and the control equipment of the temperature and humidity sensor reads out the data of the data page of the file to be read and then sends the data to the terminal, so that the process of reading the file in the Flash memory is realized.
Specifically, the control device of the temperature and humidity sensor starts to read data from the first page of a data page of a file to be read, if the page number of the currently read page is less than or equal to the ending page number, whether an FFFF page appears is judged, if not, the data of the currently read page is read, and if yes, the data reading is stopped; and if the page number of the currently read page is larger than the ending page number, stopping reading the data. Here, the FFFF page refers to a page in which an error occurs.
As can be understood by those skilled in the art, if the first page information stored in the setting page of the Flash memory is "the address at the first page 0 address for storing the sampling data", and the terminal displays the first page number to the user, the control device of the temperature and humidity sensor converts the "address at the first page 0 address for storing the sampling data" into the first page number and then sends the first page number to the terminal for display. If the tail page information stored in the setting page of the Flash memory is the effective data termination address and the terminal displays the tail page number to the user, the control equipment of the temperature and humidity sensor converts the effective data termination address into the tail page number and then sends the tail page number to the terminal for displaying.
In the embodiment, the setting page and the data page of the file are separately set, and the setting page contains the attribute information of the corresponding data page, so that a user can determine the file to be read according to the setting information in the setting page, and the reading process is convenient and quick.
Fig. 9 is a schematic structural diagram of a first implementation of a file management device of a Flash memory according to an embodiment of the present application, and as shown in fig. 9, the device of this embodiment may include: an information setting module 11 and a data writing module 12.
The storage area of the Flash memory is divided into a plurality of pages, the storage area comprises a content area, the content area is used for storing at least one file, each file comprises a setting page and a data page, the data page is used for storing data, and the setting page is used for storing setting information related to acquired data; the information setting module 11 is configured to, when at least one file to be stored is present, determine, for each file to be stored, a target setting page of the file to be stored, and write target setting information related to collecting data of the file to be stored into the target setting page; the target setting information comprises first page information of a target data page of a file to be stored; the data writing module 12 is configured to determine, for each file to be stored, a home page of a target data page of the file to be stored according to home page information in the target setting information, and continuously write the acquired target data into the Flash memory from the home page; wherein, the target data is acquired by the data acquisition device according to the corresponding target setting information.
An information setting module 11, configured to specifically read information included in a page where the allocation area is located, to obtain content of at least one item; if the content area stores at least one file, acquiring the maximum page number in the content of at least one item; obtaining the page number of a target setting page according to the maximum page number, wherein the page number of the target setting page is the sum of the maximum page number and a preset value; and determining the target setting page according to the page number of the target setting page.
The information setting module 11 is further specifically configured to enable the content of the item to further include an item number, enable the offset address corresponding to the item to be a preset multiple of the item number, and obtain, after reading information included in a page where the allocation area is located to obtain the content of at least one item, the number of page numbers included in the content of the at least one item, where the number is used to indicate the number of files stored in the content area; acquiring a target storage position of a page number of a target configuration page in the allocation area according to the number, the item number of the first item in the allocation area and the number of bytes occupied by each item; the number of bytes occupied by each item is the same as the preset multiple; after the page number of the target set page is obtained from the maximum page number, the page number of the target set page is written at the target storage location.
The information setting module 11 is further specifically configured to, after obtaining a maximum page number in respective page numbers of the multiple setting pages, read content of a first setting page indicated by the maximum page number to obtain first setting information in the first setting page, where the first setting information includes end page information of a data page of the file; and determining the information of the first page of the file to be stored according to the information of the last page.
The information setting module 11 is further configured to, after the process of acquiring the data is finished, write the tail page information of the file to be stored into the target configuration page of the file to be stored for each file to be stored; wherein the end page information includes a physical address where the last item of acquired data is stored.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 10 is a schematic structural diagram of a second implementation of the file management apparatus for a Flash memory provided in an embodiment of the present application, as shown in fig. 10, the apparatus in this embodiment may further include, on the basis of the apparatus structure shown in fig. 9: and a data reading module 13.
The data reading module 13 is configured to read information included in a page where the allocation area is located, and obtain a page number of at least one setting page; reading the setting information of the setting page indicated by each page number according to the page number of at least one setting page to obtain the setting information of each file stored in a Flash memory; reading data included in a data page of the file to be read according to the identification of the file to be read input by a user; the identification of the file to be read is obtained by the user according to the setting information of each file stored in the Flash memory.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
An embodiment of the present application further provides a file management system for a Flash memory, including: the Flash memory, the data acquisition device, the control device of the data acquisition device and the terminal device shown in fig. 2; the Flash memory, the data acquisition device and the terminal equipment are all connected with the control equipment of the data acquisition device; the control device of the data acquisition device comprises a file management device of the Flash memory shown in fig. 9 or fig. 10.
Embodiments of the present application also provide a computer-readable storage medium, which includes instructions that, when executed on a computer, cause the computer to perform the method in the embodiment shown in fig. 6 or fig. 8.
Fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application, and referring to fig. 11, an electronic device 300 according to the embodiment includes: a processor 31, a memory 32 and a communication bus 33, wherein the communication bus 33 is used for realizing the connection between the components, the memory 32 is used for storing program instructions, and the processor 31 is used for reading the program instructions in the memory 32 and executing the method in the embodiment shown in fig. 6 or fig. 8 according to the program instructions in the memory 32.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (15)

1. A data acquisition system, comprising: the Flash memory is connected with the control equipment;
the data acquisition device is used for acquiring data;
the control equipment is used for controlling the data acquisition device to acquire target data;
the control equipment is also used for performing write-in operation on the Flash memory or reading information stored in the Flash memory;
the Flash memory is divided into a plurality of pages, each page has a page number, the page number is used for representing a storage position, and the Flash memory comprises a content area and a distribution area;
the content area is used for storing at least one file, each file comprises a setting page and a data page, the data page is used for storing the target data, the setting page is used for storing setting information related to the target data, and the setting information comprises first page information of the data page;
the distribution area comprises a plurality of items, the files stored in the content area correspond to the items of the distribution area, and the content of each item is the page number of the setting page of the corresponding file;
the control equipment is used for writing setting information related to the target data into a target setting page, controlling a data acquisition device to acquire the target data according to the setting information of the target setting page, and writing the target data into target data pages corresponding to the target setting page, wherein each target setting page and the corresponding target data page form a file.
2. The data acquisition system according to claim 1, wherein each file in said content area includes a page of said setup page.
3. The data acquisition system according to claim 1, wherein the setting information of the setting page includes a sampling interval, a sampling start mode, and a stop mode for controlling the data acquisition device to acquire data.
4. The data acquisition system according to claim 1, wherein the setup information of the setup page further includes end page information of the data page;
the control device is further configured to determine a page number of a last setup page according to a largest page number in contents of the items of the allocation area, and determine a start address of a leading page of a data page of the newly stored collected data according to trailing page information of the data page stored in the last setup page.
5. The data acquisition system according to claim 4, wherein the Flash memory further comprises a boot area, the boot area is configured to store attribute information of the data acquisition device and partition information of the Flash memory, and the boot area includes a start page number and a page number of the boot area, a start page number and a page number of the allocation area, and a start page number and a page number of the content area.
6. The data acquisition system of claim 1, further comprising a terminal device, wherein the terminal device is configured to receive a control instruction or setting information input by a user, and send the control instruction or the setting information to the control device;
the control equipment receives the control instruction or the setting information to control the data acquisition device to acquire data;
the setting information is used for being written into a setting page of the Flash memory by the control equipment.
7. A temperature and humidity sensor system, comprising: the temperature and humidity sensor, the control equipment and the Flash memory are connected with the control equipment;
the control equipment is used for controlling the temperature and humidity sensor to collect sampling data;
the control equipment is also used for performing writing operation on the Flash memory or reading information stored in the Flash memory;
the Flash memory is divided into a plurality of pages, each page has a page number, the page number is used for representing a storage position, and the Flash memory comprises a guide area, a default configuration area, an allocation area and a content area;
the guide area is used for storing attribute information of the temperature and humidity sensor and division information of the Flash memory;
the default configuration area is used for storing default setting information related to the sampling data;
the distribution area comprises a plurality of items, the files stored in the content area correspond to the items of the distribution area, and the content of each item is the page number of the setting page of the corresponding file;
the content area is used for storing at least one file, each file comprises a setting page and a data page, the data page is used for storing the sampling data, the setting page is used for storing setting information related to the sampling data, and the setting information comprises first page information of the data page;
the control equipment is also used for writing the setting information related to the sampling data into a setting page of the Flash memory, controlling the temperature and humidity sensor to collect the sampling data according to the setting information of the setting page of the Flash memory, and writing the sampling data into a data page corresponding to the setting page of the setting information related to the sampling data in the Flash memory; the setting page of each Flash memory and the corresponding data page form a file for collecting sampling data.
8. The temperature/humidity sensor system according to claim 7, wherein the attribute information of the temperature/humidity sensor stored in the guide area includes: the temperature resolution, humidity resolution, actual minimum temperature represented by data 0, and actual minimum humidity represented by data 0 of the temperature and humidity sensor.
9. The temperature and humidity sensor system according to claim 7, wherein the setting information related to the sampling data stored in the setting page includes at least one of a file attribute for controlling the temperature and humidity sensor, a sampling interval of the temperature and humidity sensor, a starting mode of the temperature and humidity sensor, and a stopping mode of the temperature and humidity sensor.
10. The temperature and humidity sensor system of claim 9, wherein the file attributes are sampling modes associated with the sampled data, and the sampling modes include temperature sampling only, humidity sampling only, and temperature and humidity sampling.
11. The temperature and humidity sensor system according to claim 7, wherein the default configuration area stores default setting information related to the sampling data, including: a default sampling interval of the temperature and humidity sensor;
the control equipment is further used for reading a default sampling interval in the default configuration area when the setting information of the setting page does not set a sampling interval, and controlling the temperature and humidity sensor to sample according to the default sampling interval.
12. The temperature and humidity sensor system of claim 9, wherein the temperature and humidity sensor is activated in at least one of: starting by delaying for a certain time and starting at fixed time after the key starting and the setting information setting are finished;
the stop mode of the temperature and humidity sensor comprises at least one of the following modes: the method comprises the steps of key stop, automatic stop when data in a Flash memory is read, and automatic stop when a fixed sampling number is reached.
13. The temperature and humidity sensor system according to claim 7, wherein the setting page stores setting information related to sampling data collection, including a sampling start time and a sampling stop time;
the control equipment is also used for controlling the temperature and humidity sensor to collect sampling data according to the setting information stored in the setting page, writing the sampling start time into the setting page, writing the sampling data into the data page, and writing the sampling stop time into the setting page when the temperature and humidity sensor is controlled to stop collecting the sampling data.
14. The temperature and humidity sensor system according to claim 13, wherein the setting information stored in the setting page and related to the collected sampling data further includes end page information of the data page; the first page information of the data page comprises a first page 0 address, and the tail page information of the data page comprises a valid data termination address;
the control equipment is also used for writing the address of the first page 0 address for storing the sampling data into the first page information of the data page in the setting page when the sampling data is written into the data page, and writing the effective data termination address for storing the sampling data into the tail page information of the data page in the setting page after the sampling data is written into the setting page.
15. The temperature and humidity sensor system according to claim 14, wherein the sampling data stored in the data page is at least one corresponding sampling point data;
the control equipment is further used for continuously writing the sampling point data corresponding to each item collected by the temperature and humidity sensor into the data page from the first page 0 address of the data page after the first page 0 address for storing the sampling data is written into the setting page, and writing the effective data termination address of the sampling point data corresponding to the last item into the setting page after the sampling point data corresponding to the last item is written into.
CN202111355122.9A 2018-01-12 2018-01-12 Data acquisition system and temperature and humidity sensor system Active CN114089916B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111355122.9A CN114089916B (en) 2018-01-12 2018-01-12 Data acquisition system and temperature and humidity sensor system

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810031114.0A CN108255433B (en) 2018-01-12 2018-01-12 Flash memory, file management method and device of Flash memory
CN202111355122.9A CN114089916B (en) 2018-01-12 2018-01-12 Data acquisition system and temperature and humidity sensor system

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201810031114.0A Division CN108255433B (en) 2018-01-12 2018-01-12 Flash memory, file management method and device of Flash memory

Publications (2)

Publication Number Publication Date
CN114089916A CN114089916A (en) 2022-02-25
CN114089916B true CN114089916B (en) 2022-12-20

Family

ID=62726963

Family Applications (3)

Application Number Title Priority Date Filing Date
CN202111353834.7A Active CN114035749B (en) 2018-01-12 2018-01-12 Electronic equipment and Flash memory
CN202111355122.9A Active CN114089916B (en) 2018-01-12 2018-01-12 Data acquisition system and temperature and humidity sensor system
CN201810031114.0A Active CN108255433B (en) 2018-01-12 2018-01-12 Flash memory, file management method and device of Flash memory

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202111353834.7A Active CN114035749B (en) 2018-01-12 2018-01-12 Electronic equipment and Flash memory

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN201810031114.0A Active CN108255433B (en) 2018-01-12 2018-01-12 Flash memory, file management method and device of Flash memory

Country Status (1)

Country Link
CN (3) CN114035749B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109683829B (en) * 2019-01-04 2020-10-30 中国科学院声学研究所东海研究站 Intelligent storage control system based on FPGA and application thereof
CN112084147A (en) * 2020-09-10 2020-12-15 珠海美佳音科技有限公司 Data storage method, data acquisition recorder and electronic equipment
CN112698984B (en) * 2020-12-17 2023-07-04 宁波三星医疗电气股份有限公司 Database recovery method of embedded device, electronic device and medium
CN113031880B (en) * 2021-05-27 2021-08-17 湖南博匠信息科技有限公司 Upper computer communication method and system suitable for multi-model storage equipment
CN114265562B (en) * 2021-12-27 2022-09-20 北京国腾创新科技有限公司 File storage method and system based on flash memory

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005190289A (en) * 2003-12-26 2005-07-14 Tdk Corp Memory controller, flash memory system therewith, and method for controlling flash memory
CN102981965A (en) * 2012-11-07 2013-03-20 江苏乐买到网络科技有限公司 NAND FLASH file system
CN103198166A (en) * 2013-04-16 2013-07-10 电子科技大学 Real-time storage device for downhole large-capacity acoustic logging data while drilling
CN103645993A (en) * 2013-12-24 2014-03-19 飞天诚信科技股份有限公司 Data updating method and data reading method based on large page Flash
CN103646063A (en) * 2013-11-27 2014-03-19 中国航天科技集团公司第五研究院第五一三研究所 Satellite-borne high-speed file management system
CN206658289U (en) * 2016-10-12 2017-11-21 纳思达股份有限公司 A kind of NFC audio-frequence player devices
CN107408017A (en) * 2015-04-09 2017-11-28 株式会社日立制作所 Storage system and data control method

Family Cites Families (34)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7984303B1 (en) * 2000-01-06 2011-07-19 Super Talent Electronics, Inc. Flash memory devices with security features
US7690030B1 (en) * 2000-01-06 2010-03-30 Super Talent Electronics, Inc. Electronic data flash card with fingerprint verification capability
US7356641B2 (en) * 2001-08-28 2008-04-08 International Business Machines Corporation Data management in flash memory
CN1204501C (en) * 2001-09-18 2005-06-01 华为技术有限公司 FLASH storage file management method
CN1277213C (en) * 2004-12-31 2006-09-27 大唐微电子技术有限公司 A flash memory file system management method
US7984084B2 (en) * 2005-08-03 2011-07-19 SanDisk Technologies, Inc. Non-volatile memory with scheduled reclaim operations
CN100370445C (en) * 2005-08-10 2008-02-20 北京中星微电子有限公司 A data transmission apparatus and method based on file allocation table (FAT)
JP4895262B2 (en) * 2005-12-09 2012-03-14 株式会社メガチップス Information processing apparatus, controller, and file reading method
CN100468412C (en) * 2007-05-24 2009-03-11 北京交通大学 Portable serial number recorder and implementation method
CN101520787B (en) * 2008-03-19 2011-04-06 中国科学院自动化研究所 Method for storing real-time data
TW201025002A (en) * 2008-12-26 2010-07-01 Asmedia Technology Inc Method of writing data into flash memory based on file system
CN101582089B (en) * 2009-07-02 2011-06-29 北京讯风光通信技术开发有限责任公司 File management method of embedded equipment and system
CN102375781B (en) * 2010-08-04 2014-06-11 群联电子股份有限公司 Data protecting method, memory controller and portable memory storage device
EP2498259B1 (en) * 2011-03-08 2018-11-07 Linear Technology Corporation Methods and system for erasing data stored in nonvolatile memory in low power applications
KR20130010343A (en) * 2011-07-18 2013-01-28 삼성전자주식회사 Flash memory apparatus
CN102279805A (en) * 2011-09-06 2011-12-14 四川九洲电器集团有限责任公司 Memory data storing and reading method
CN103456360B (en) * 2013-09-13 2016-08-17 昆腾微电子股份有限公司 The management method of nonvolatile memory and device
US9734118B2 (en) * 2013-10-16 2017-08-15 The Regents Of The University Of California Serial bus interface to enable high-performance and energy-efficient data logging
JP6274857B2 (en) * 2013-12-26 2018-02-07 キヤノン株式会社 MEMORY CONTROL DEVICE, MEMORY CONTROL METHOD, AND PROGRAM
ITRM20130728A1 (en) * 2013-12-31 2015-07-01 Prb S R L COMMAND EXCHANGE METHOD VIA USB DISK AND RELATED DEVICES THAT ALLOW IMPLEMENTATION.
KR102252419B1 (en) * 2014-01-09 2021-05-14 한국전자통신연구원 System and method for efficient address translation on Flash memory device
EP3115903B1 (en) * 2014-03-07 2020-04-15 Huawei Technologies Co., Ltd. File accessing method and related device
TWI516922B (en) * 2014-03-12 2016-01-11 慧榮科技股份有限公司 Data storage device and flash memory garbage collection method
KR20150113572A (en) * 2014-03-31 2015-10-08 삼성전자주식회사 Electronic Apparatus and Method for Acquiring of Image Data
CN104090732A (en) * 2014-07-21 2014-10-08 昆腾微电子股份有限公司 Nonvolatile memory management method and device
CN104317732A (en) * 2014-10-27 2015-01-28 上海动联信息技术股份有限公司 Large-capacity Flash chip space management method
JP6542076B2 (en) * 2015-08-28 2019-07-10 東芝メモリ株式会社 Memory system
US9875156B2 (en) * 2015-10-01 2018-01-23 Sandisk Technologies Llc Data storage device with a memory die that includes an interleaver
CN105204788B (en) * 2015-10-28 2018-03-30 内蒙古青电云电力服务有限公司 A kind of data processing method based on Internet of Things
CN105550345B (en) * 2015-12-25 2019-03-26 百度在线网络技术(北京)有限公司 File operation method and device
CN106406756B (en) * 2016-09-05 2019-07-09 华为技术有限公司 A kind of space allocation method and device of file system
CN106569748B (en) * 2016-10-27 2019-04-09 南方电网科学研究院有限责任公司 The data processing method and device of Flash File System
CN106776752B (en) * 2016-11-22 2020-10-23 南京拓攻自动驾驶技术研究院有限公司 Embedded file storage system and method applied to flight data of unmanned aerial vehicle
CN107247563A (en) * 2017-07-06 2017-10-13 济南浪潮高新科技投资发展有限公司 A kind of block message mark implementation method of NAND FLASH chips

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005190289A (en) * 2003-12-26 2005-07-14 Tdk Corp Memory controller, flash memory system therewith, and method for controlling flash memory
CN102981965A (en) * 2012-11-07 2013-03-20 江苏乐买到网络科技有限公司 NAND FLASH file system
CN103198166A (en) * 2013-04-16 2013-07-10 电子科技大学 Real-time storage device for downhole large-capacity acoustic logging data while drilling
CN103646063A (en) * 2013-11-27 2014-03-19 中国航天科技集团公司第五研究院第五一三研究所 Satellite-borne high-speed file management system
CN103645993A (en) * 2013-12-24 2014-03-19 飞天诚信科技股份有限公司 Data updating method and data reading method based on large page Flash
CN107408017A (en) * 2015-04-09 2017-11-28 株式会社日立制作所 Storage system and data control method
CN206658289U (en) * 2016-10-12 2017-11-21 纳思达股份有限公司 A kind of NFC audio-frequence player devices

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Fast mounting method for NAND flash memory file system using offset information;Chan-Sul Park;《2010 The 12th International Conference on Advanced Communication Technology (ICACT)》;20100401;675-679 *
Flash存储中间层技术的研究;吕雪飞等;《计算机工程与应用》;20090211(第05期);75-77+94 *
基于NAND Flash阵列的高速大容量图像存储器设计;江旭东;《中北大学硕士电子期刊信息科技专辑》;20160815;1-74 *

Also Published As

Publication number Publication date
CN114035749B (en) 2023-02-28
CN114035749A (en) 2022-02-11
CN114089916A (en) 2022-02-25
CN108255433B (en) 2021-12-07
CN108255433A (en) 2018-07-06

Similar Documents

Publication Publication Date Title
CN114089916B (en) Data acquisition system and temperature and humidity sensor system
US20060074945A1 (en) File management program, data structure, and file management device
CN110442308B (en) Data block storage method, device, equipment and storage medium
CN115129572A (en) Performance test method, device, equipment and medium
CN113722271B (en) File management method, system and medium for data acquisition and playback
CN107562766B (en) Data file writing method, device and system
CN107148612A (en) A kind of method and apparatus of extending user subregion
CN108008908B (en) Method and device for controlling data on SD card
CN117012266A (en) Performance test method and device based on EMMC (EMMC management computer) and storage medium thereof
CN112000589A (en) Data writing method, data reading device and electronic equipment
CN110990207A (en) BPS memory test method, system, terminal and storage medium based on Whitley platform
CN108664505A (en) A kind of deriving method and device of database table structure
US10705738B2 (en) Method, apparatus, storage medium, and terminal for optimizing memory card performance
CN112764673B (en) Hyperspectral linear array data storage rate optimization method, device and storage medium
CN109117091A (en) A kind of SSD equipment mount point acquisition methods and relevant apparatus
JP2012168660A (en) Information extraction program, information extraction method, and information extraction device
CN109215721A (en) A kind of method, device and equipment of test NVME SSD hard disk delay
US20080266132A1 (en) Data collection management system and method
CN109299018B (en) Method and device for reading historical data in Flash memory
US10353589B2 (en) Data storage device and data management method for data storage device
CN106815106B (en) Host interface test method, device, test terminal and system
CN112035380A (en) Data processing method, device and equipment and readable storage medium
CN110096235A (en) A kind of date storage method and storage system towards self-tolerant application
CN113705821B (en) PCIE-based method, equipment and medium for realizing waveform drawing by ADC board card
CN104794180B (en) A kind of point reader scanning obtains the method and device of learning materials

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