Data storage and management of single chip microcomputer system

Publisher:AmpouleLatest update time:2013-03-15 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  introduction

  In the field of automated testing, single-chip microcomputer test systems have been increasingly widely used with their mature application system, simple system structure and excellent cost performance. In recent years, with the continuous emergence of new test objects and the continuous development of test methods, the functions of test systems have become more and more perfect, and the requirements for test systems in various application scenarios have also increased. Most of the current test systems not only have to complete the real-time measurement and control tasks of industrial sites, but also have to further realize the real-time processing and storage of test data. In the past, in general single-chip microcomputer test systems, the storage capacity of information was not large, and the system only needed to use fewer resources to store data. However, with the continuous development of memory chip technology, memory chips suitable for single-chip microcomputer systems can already save hundreds of KB or even several MB of data under power-off protection; similarly, current single-chip microcomputer test systems also face the problem of processing and saving thousands or even nearly ten thousand test data. This is a rather complicated task for general single-chip microcomputer test systems that lack operating system support. Therefore, current test systems can often only process specific numerical objects and adopt a simple sequential storage method for a large amount of collected data. Obviously, this method lacks flexibility, is not conducive to the microcontroller test system to process a large amount of test data, and limits the development of the test system in this regard.

  This article mainly discusses the storage and management of test data for a type of test system that processes a large amount of test data. This type of test system is often composed of a single-chip microcomputer with strong anti-interference ability and a large-capacity, power-off protection storage chip, and is equipped with a high-precision digital sensor; it is cheap and has stable performance, suitable for working in industrial sites, saving and processing a large amount of test data, and some can even form a measurement and control network with the host computer to complete more complex test tasks. This article will introduce a chain storage method applied to single-chip microcomputer test systems, which can realize the storage and management of a large amount of test data while performing real-time measurement and control in industrial sites, and has achieved good results in practical applications.

  Storage Structure in Large Capacity Single Chip Microcomputer Test System

  In most automatic test systems, the logical structure of test data generally follows a linear logical relationship, that is, data elements are only divided into a sequence of time or space without upper and lower levels. Therefore, a sequential storage structure is often used when designing a storage structure. Its advantages are fast speed in processing linear data structures and simple structure.

  However, the above situation is not universally applicable to the large-capacity test system mentioned above. Although the large-capacity test system also has a linear logic structure, its test data varies, the internal structure of the data elements is also very complex, and the system has to execute multiple instruction operations such as data storage and data query. If the sequential storage structure is applied, many problems will be faced.

  First, the test system often faces some special test objects. The test information is relatively complex and the data length is not fixed, which is obviously not conducive to the use of sequential storage structure. Assuming that the system performs sequential storage according to the logical order of time or space, the allocation of storage space will become a problem. If the allocated space is too large, the storage efficiency will be affected; conversely, data overflow will occur. Similarly, assuming that the system can arrange the storage space for data, the system will appear to be unable to cope with operations such as data query and data deletion.

  Secondly, the sequential storage structure cannot handle abstract data types well. The system must consider the length and content of data elements when performing operations such as data storage, data query, and data deletion, which cannot be flexible and effective. When the system needs to be modified or upgraded, the modification of the internal structure of the data element will affect the overall operation of the system, thereby reducing the reliability and efficiency of the system, and making it much more difficult to maintain and upgrade the system.

  In summary, the sequential storage structure cannot solve all the problems faced by large-capacity test systems when storing and managing data, so the application of non-sequential storage structures must be considered in actual operations. For a long time, non-sequential storage structures such as chain storage structures have been rarely used in single-chip microcomputer systems. The reason is that chain storage structures must be supported by a special storage management system. In general-purpose computers, this function is implemented by operating systems or high-level language compilation systems, but there are no mature application cases in ordinary single-chip microcomputer systems, which makes program design more difficult. The following introduces a storage management system for large-capacity single-chip microcomputer systems that can support the application of chain storage methods in large-capacity single-chip microcomputer test systems.

  Storage Management System for Large Capacity Test System

  For large-capacity test systems that use a chain storage structure, the physical addresses of the nodes in the chain list are not fixed. In order to avoid storage space conflicts that may occur when saving data, a special storage management system needs to be established to manage the creation and release of storage space. Among them, the data boot table is the basis of the storage management system and is responsible for recording the storage information of each data element in the storage space. By using the data boot table and cooperating with functions that implement operations such as creating space and releasing space, the test system can effectively manage a large amount of storage space.

  Data Boot Table

  To establish a data boot table is to establish a connection between each node in a linked list and its corresponding physical address, and to regulate the use of storage space by each node. In the test system, the boot table only occupies a fixed area in the storage space. Its record object is the first address and the last address of a continuous address space that has been allocated and occupied, marking the size of the space allocated and occupied by a node stored in the storage space, which is called a "record". The physical addresses of each record in the boot table are continuous and are arranged in sequence according to the size of the first address of each record. The working principle of the data boot table is shown in Figure 1.

  Figure 1 Schematic diagram of the working principle of the data guide table

  In the initial state, the memory boot table has only two records, indicating the first address and the last address of the entire storage space. At this time, the entire page space does not store any test data. Once a new node needs to be saved in this space, the CPU will open up a continuous storage interval for the node to use, and write the first address and the last address of this space as a record into the memory boot table. Similarly, when the system needs to delete a node in a linked list on a certain page, the CPU deletes its corresponding record in the memory boot table to release this address space. It is worth noting that for the storage space released in the boot table, the content stored in it is not actually deleted; before the new data overwrites the address, the CPU can still read the stored data by directly accessing the address.

  Functions for managing storage space

  Generally speaking, in general-purpose computers, the standard library functions malloc(), realloc(), and free() in C language are often used to allocate and manage storage space, but this method is not suitable for general large-capacity test systems. [page]

  Assume that in the large-capacity test system described above, the system uses a 16-bit address microcontroller and uses the paging storage mode to access the 512KB power-off protection memory. The memory is divided into 16 pages (00H~0FH), each page address is 0000H~7FFFFH, totaling 32KB. At this time, the system can use malloc() to open up a storage space in the unused space, but the address pointer returned by the function is random, and it is possible to allocate the space in an interval that the system cannot recognize (such as 7FFFFH~FFFFH), so it cannot meet the needs. In addition, since the memory in the system has a power-off protection function, the CPU will not be able to recognize the storage space where the test data has been saved after powering on again, making the malloc() function meaningless. Therefore, the storage space management function is still established based on the data boot table. The implementation of its specific functions depends on the function's operation on each record in the data boot table. The program is as follows:

  void *m_alloc(uintsize, uccharpage) // Function to allocate storage space

  void *m_free(voidxdata*p_free, ucharpage) // Function to release the allocated storage space

  void *re_alloc(void*data*p_re, uintsize, uccharpage) //Function to reopen storage space

  Taking the m_alloc() function as an example, its program flow chart is shown in Figure 2.

  Figure 2 Program flow of the storage space allocation function m_alloc()

  When the system needs to allocate storage space for a node, it first gives the specified storage space page and the length of the space to be allocated, and then uses the m_alloc() function to query whether there is suitable storage space in the bootstrap table of the corresponding page. Since each record in the bootstrap table represents a continuous address range that has been allocated, the m_alloc() function will start from the first record to determine whether the length of the unallocated space between each two adjacent records meets the needs of the system. When a pair of records meets the conditions, the m_alloc() function will return the pointer to the first address of the unallocated storage space (that is, the last address of the previous record), and insert a new record of the allocated space segment between the two records. If all records in the bootstrap table of the page do not meet the conditions, the m_alloc() function returns a null pointer. The re_alloc() function and the m_free() function respectively complete the operations of reallocating a storage space with a specified first address and deleting a storage space with a specified first address. Its function and usage are similar to m_alloc() and will not be repeated here.

  Application of chain storage structure and storage management system in practical operation

  The storage management system described above can be used to implement the chain storage structure in a large-capacity test system. The advantage of this is that it can effectively simplify the system data storage process, facilitate the execution of multiple instruction operations, and improve the utilization of system storage space.

  SF6 Density Relay Calibration System

  As shown in Figure 3, the SF6 density relay calibration system consists of a 51 series single-chip microcomputer, a 512KB power-off protection memory, a printer, a clock system and an LCD, and is equipped with a high-precision digital pressure sensor and a temperature sensor, which can communicate with the host computer through the 485 bus. The system can calibrate different types of density relays to meet the needs of various rated parameters and the number of contacts, and realize multiple functions such as real-time display and data printing during the calibration process; it can save multiple sets of calibration data for the same relay, and can save up to more than 4,000 calibration data; all calibration records can be queried at any time; in addition, when communicating with the host computer, there is a corresponding host computer software to perform data transmission, memory space query and data deletion operations on the lower computer system.

  Figure 3 SF6 density relay calibration system structure diagram

  Specifically, the SF6 density relay calibration system uses the SF6 density relay as the calibration object, and the calibration result includes the pressure value and temperature value of the SF6 gas. Therefore, the calibration result of each calibration object is abstracted into a data element, which includes the test information of the calibration object (such as the test date, the test serial number of the relay, the number of contacts and the rated parameter information) and one or more groups of measurement value information (such as the number of calibrations, alarms, lockout 1, lockout 2, and the pressure and temperature values ​​when the overpressure contacts are respectively actuated and returned). The system establishes a chain storage structure with each data element as a node, and manages the allocation of storage space through the above-mentioned management storage system, which can not only ensure the effective and reasonable storage of the calibration data, but also well realize the operations such as data query, data deletion and communication with the host computer, making the operation of the system more efficient and reliable.

  Automatic Test System for Nonlinear Logic Structure

  When the automatic test system faces data elements with nonlinear logical structures, it must adopt a non-sequential storage structure to save the data. At this time, you can consider a chain storage structure, or an index storage structure, a binary tree and other non-sequential storage structures, but the prerequisite is that there must be a dedicated storage management system to support it.

  With the above storage management system as the basis, the application of various non-sequential storage structures becomes possible. When designing the system, by fully weighing the utilization of storage space and the time consumed by the algorithm, it is possible to apply a variety of storage structures and design corresponding algorithms in a targeted manner to meet the requirements of various test objects and test environments.

  Conclusion

  Saving data in the form of a chain structure and managing storage space through a data boot table is a new data saving and management method applied to large-capacity single-chip microcomputer test systems.

  This storage method is applicable to both linear logic structure test systems and nonlinear logic structure test systems. Overall, it makes the microcontroller system faster and easier to process multiple complex data and perform repeated save, query and delete operations, thereby improving the utilization rate of limited storage space. At the same time, structured data storage makes system maintenance and upgrades easier, realizing structured management of the system.

Reference address:Data storage and management of single chip microcomputer system

Previous article:Wireless sensor network node production and networking design based on single chip microcomputer
Next article:What is MCU decryption? MCU decryption principle

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号