The Method of Data Access for Nuclear Instrument Based on Linked List

A new method of data access which can effectively resolve the problem of high speed and real time reading data of nuclear instrument in small storage space is introduced. This method applies the data storage mode of “linked list” to the system of Micro Control Unit (MCU), and realizes the pointer access of nuclear data on the small storage space of MCU. Experimental results show that this method can solve some problems of traditional data storage method, which has the advantages of simple program design, stable performance, accurate data, strong repeatability, saving storage space and so on.


Introduction
People have a large demand for real time processing data rapidly and the rapidity with nuclear instrument in recent years.Most of the traditional methods use Micro Control Unit (MCU) as a processor for real-time processing of data.It is very difficult to deal with the high-speed output of the data stream in a timely manner, which will lead to the loss of data, and affect the speed of nuclear instrument data processing.Therefore, external data storage is commonly used in the traditional method in order to prevent data loss, reduce the occupation time, and improve the working efficiency of nuclear instrument [1].However, this method will not only increase the design cost of nuclear instrument, but also increase the complexity of the hardware circuit, which is not conducive to the maintenance of the instrument.In this paper, a new method of data storage based on linked list is introduced to solve the problems existing in the traditional data storage method, which realizes the target of recycling the storage space resource, saves the resource of storage space, deduces the waste of data storage space resource, and it uses the smaller storage space of MCU reasonably rather than any additional outside enlarge storage.

Linked List Storage Mode
The list is a data storage method, a list consisted of head pointer, node and the end of the chain [2].The node consists of two parts: the actual data that the user needs and the address pointer of the next node.The simplest of a list (singly linked list) of the structure as shown in Figure 1.
As shown in Figure 1, head is the "head pointer" variable, 1248, 1488, 1366, 1022 and 1520 is the address of the memory cell in the memory; A, B, C, D and E is the actual data."Head" points to the first node, the first node points to the next node and so on until the last node.The node is no longer point to other nodes, which is called "chain tail" and put a "NULL" in the address portion of it (the "empty address").

The Storage Mode of Array
As shown in Figure 2, opening an array storage space of 2000H -3001H and storing data in the address sequence.When the nuclear data comes, it is assumed that the data is stored from 2000H, and then restart from 2000H after 3001H is full; the order of data fetch is the same as that of the stored data.If a large amount of data or data access speed is slower than the speed of saving data, it is necessary to define a large storage space in order to make the new data do not cover the old data, so that the storage space should be arranged in advance.After the data is saved to 3001H, the new data is stored from the 2000H.It is easy to cause the phenomenon of new data to cover the old data, at the same time when the data is removed, it is not going to start from scratch since data is stored in 3001H, and it will cause a waste of storage space resources.
Compared to the two storage modes of linked lists and arrays, the list has the following advantages: 1) data in the storage space can be non-continuous.Array of data stored in the address is continuous, just set the address pointer to the node, the list can open up different sizes of data storage space in the non contiguous space; 2) the data storage space can be dynamically opened up.Array in advance shall define the data storage space size, but it is very difficult to define a suitable space size of the storage, while modifying the pointer to link the new node to the list, the list can be very easy to extend the data storage space [3].

The Principle Diagram of Nuclear Instrument
As shown in Figure 3, nuclear instrument mainly contains four modules [4]:   • Detector module: It access the radiation signal.
• The signal acquisition module: It is mainly completes the signal shaping, amplification, filtering, AD conversion, spectrum data acquisition etc., at the same time, the nuclear radiation signal obtained by the detector is converted into digital signal, which is the form of ray spectrum, for analysis software.• Data storage module: It caches the digital signals.
• Main control module: It executes the corresponding operation according to the command.Such as the realization of data storage module, parameter setting, spectrum display, data storage, PC serial communication and other functions.Among them, the data storage module is the focus of this design, it is realized by the MCU data cache function.It communicates with the main control module through the serial port, and realizes the data transmission.When the main control module is free to send the data to the command module, the data module executes the corresponding operation according to the command, sends the data to the main control module for processing [5].
The data storage module to achieve the data cache has two programs [6]: 1) A program for controlling the access of data by MCU through external data storage.But this will not only increase the complexity of the hardware circuit, but also increase the cost.
2) This grogram is directly use the memory of the MCU as a data storage unit.But the storage unit of MCU is generally small, if using a general array of storage, will resulting in the lost of data easily because of the insufficient memory.
According to the above problems, this design has designed a data storage method based on the "chain link", which can realize the reasonable utilization of the small storage space of MCU without adding any external memory.

The Overall Design of Data Storage
In our design of nuclear instrument, the processor uses 8-bit microcontroller to control and store the data sent by the nuclear signal acquisition.When the nuclear instrument is idle, the command is sent to the MCU, MCU according to the command to execute corresponding operation, and send data to the nuclear instrument for processing.How to store data is the focus of this design [7].

Software Design
Data storage mode: Status register MS (Table 1): response to the state of storage space, empty/non-full = 0, full = 1 [8].For example, the A + 0 bit corresponds to the first address for the M0H data storage space.
Opening up 8 storage spaces from the start address AA to the AA + 7, and storing the first address of the available storage space, respectively.The address is entered by the user, can be a non continuous (see Table 2).
For example, the size of data storage space (Table 3) with the first address as M0H is K0.

Table 1. Status register MS.
A The space of address.
AA is the starting address.

Z. Liu et al.
4 There are 8 storage spaces from the start address KK to the KK + 7, respectively, 8 open storage space of the size of the data, the size of the space by the user input, and the size is defined by the user [9].

Flow Chart
As shown in Figure 4, when the data is stored in the last unit of the data storage unit, the status register MS is corresponding to the position 1 (i.e., the memory cell block is in the state of the data), and by MS query, the first address of the next storage space in the empty state is stored in the last storage unit of the storage the next storage space is "linked" to the storage space.As shown in Figure 5, when the data is taken to the last unit of the memory cell, the status register MS is corresponding to a bit 0 (i.e., the memory cell block is idle), and by storing the last memory block of the value of the unit to the PC, so that PC point to the first address of the next data storage unit to fetch data.
The storage method has the following advantages: 1) The space of data storage is not continuous.
2) When a data space is full, the data storage space can be dynamic opened, and the size of the data space can be specified.3) It can reasonably use the data storage space resources and reduce the waste of data storage space resources.4) It can avoid the data storage too fast, resulting in data compression.

Conclusion
In this paper, the data storage mode of linked list is applied to the system of MCU.The processor uses 8-bit microcontroller to control and store the data sent by the nuclear signal acquisition and the chain structure of linked list makes the distributed space of MCU link together, and links the spare storage space that the data have taken quickly to the usable storage resource again, so as to realize the target of recycling the storage space resource, which saves the resource of storage space, makes a reasonable use of storage space and avoids the cover of data caused by data saving too quickly.This data storage method solves some problems existing in the traditional data storage mode, the program design is simple and it has a strong replication ability.

Figure 1 .
Figure 1.The structure of list.

Figure 2 .
Figure 2. The structure storage of array.

Figure 3 .
Figure 3.The composition of nuclear instrument.

Figure 4 .
Figure 4.The follow chart of the received data.

Figure 5 .
Figure 5.The follow chart of the transmitted data.

Table 3 .
The size of data space.