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.
Previous article:Wireless sensor network node production and networking design based on single chip microcomputer
Next article:What is MCU decryption? MCU decryption principle
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Learn about TI 15.4-Stack's support for 470M frequency band
- 【Me and Yatli】+My impression of Yatli
- Advanced Algebra Concise Course
- AP6212 driver all firmware & nvram
- Bosch air pressure sensor gives sweeping robots more monitoring functions
- 8 output modes of MSP430 microcontroller
- FPGA learning notes-----Fixing the program through JTAG
- More than just GaN! Qorvo's three key advantages in leading 5G era technologies
- PCB 3D component library
- Award-winning live broadcast | Beneng International launches millimeter-wave radar module based on Infineon technology, perfectly solving the pain points of the PIR market. Registration is open