Received 2 April 2016; accepted 16 May 2016; published 19 May 2016
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 process- ing 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  . 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.
2. Comparison of Storage Methods of “Linked List” and “Array”
2.1. Linked List Storage Mode
The list is a data storage method, a list consisted of head pointer, node and the end of the chain  . 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”).
2.2. 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  :
Figure 1. The structure of list.
Figure 2. The structure storage of array.
Figure 3. The composition of nuclear instrument.
・ 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  .
The data storage module to achieve the data cache has two programs  :
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.
4. 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 pro- cessing. How to store data is the focus of this design  .
4.1. Software Design
Data storage mode:
Status register MS (Table 1): response to the state of storage space, empty/non-full = 0, full = 1  .
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 avai- lable 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.
Table 2. The space of address.
AA is the starting address.
Table 3. The size of data space.
KK is the starting address.
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  .
4.2. 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 space, and the next storage space is “linked” to the storage space.
Figure 4. The follow chart of the received data.
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.
Figure 5. The follow chart of the transmitted data.
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.
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.
This work was supported by the research projects of national defense science and technology (JSJL2014404B001), the National Natural Science Foundation of China (41374112).
 Cheng, Y., Yu, X.P. and Luo, Z.X. (2011) Application of a Pointer-Based Approach in Nuclear Data Storage. Proceedings of 2011 International Conference on Computers, Communications, Control and Automation, Hongkong, 20 February 2011.
 Cheng, Y., Tuo, X.G. and Zhou, C.W. (2011) Development of Portable α Spectrum Equipment Based on PIPS Detector. Nuclear Electronics and Probing Technique, No. 4, 444-446.
http://www.cnki.net/KCMS/detail/detail.aspx?QueryID=4&CurRec=1&recid=&filename=HERE201104020 &dbname=CJFD2011&dbcode=CJFQ&pr=&urlid=&yx=&uid=WEEvREcwSlJHSldSdnQ0S25uQnUybUdXa VN6WUg0clRnTSt4L3N1QmVESnNQdlRhWTV0NUk4cEgrNElXL1F0US9RPT0=$9A4hF_YAuvQ5obgVAqNKPCY cEjKensW4IQMovwHtwkF4VYPoHbKxJw!!&v=MTY5NDR1eFlTN0RoMVQzcVRyV00xRnJDVVJMeWZZdWRzRm lEbFU3ck1MU2paYTdHNEg5RE1xNDlIWklSOGVYMUw=
 Li, J.Q., Zhao, J.G. and Zhang, Q.H. (2011) Analysis and Summary about Pointer Knowledge in C Language Teaching. Computer Education, No. 8, 243-245.
 Liu, Y., Lu, L.-S. and He, W.-Q. (2010) An Easy Stack-Analogy On-Chip Memory Dynamic Allocation Compilation Technique. Computer Engineering and Science, 32, 112-115.
 Zhu, Y.-W. (2008) A Research on Experience Data Storage Method. Computer and Modernization, No. 5, 411-413.
 Li, X.P., Guo, J.C. and Luo, P. (2006) A New Method for Expanding the Memory of 51-Series SCM. Electronic Measurement Technology, No. 1, 87-91.
 Bi, H.-Y., Mao, X.-B., Liu, Y.-F. and Ran, Z.-Y. (2011) A File Dump Storage Device Based on MCU. Electronic Design Engineering, 19, 316-317.