Design of the Food Information Acquisition System for the High-voltage Fence Base on the DMA

This design presents the using of the DMA module in the dsPIC33 microcontroller, through which the system could get the multiple client analog signal to achieve a real-time food information acquisition in a nearly synchronization time. The food information which get by the acquisition system would be transformed into the monitoring center for the further analysis. As the food information is acquisitted in the more same time, the more accurate result will get.


INTRODUCTION
Food information acquisition and monitoring is the most important function in the scientific research and engineering.In many areas, the acquisition system often require multiple real-time signals, sampling Interval between the various signals should be as small as possible, thereby, to ensure the signals can be correlation analysis.In the high-voltage fence systems, high-voltage generating unit mainly change the AC 180~240 V lower voltage into AC 3000~6000 V higher voltage signal, using a special transformer, to ensure the security system has a high-voltage shock to the criminal offender or the other animals, so as to deter and protect the jail or the warehouse (Guo and Li, 2010).At present, the method of detecting the voltages and currents is often used of the low voltage side of the transformer.Jin et al. (2008) the detector often is placed in the monitor room for the convenience of installation and application.This method is easy to be implemented but this method is to detect the food information of the lower voltage side of the transformer while the touching on the fence is happening at the farend higher voltage side.So the measurement is lag in response time and then there is a high rate of false alarm in the power circuit.Shuwei and Ming (2008) therefore, some manufacturers have detected the voltage and current of the higher voltage side in situ to improve the detection accuracy, but because of the multi-signal food information should be detected, by the common method, the acquisition would use the conventional time division multiplex switch to sample food information by time-sharing programs.Therefore, the synchronization of signal is not strong (Wang and Li, 2004).Whereas, real-time food information collection is a very important role for judging the working conditions of the front end of the high-voltage fence (Wang, 2012).In addition, the shocking of the human or animal who touches the high-voltage fence often occurs in a short time.If the conventional low-end detector is often in the lag time, the alarm of the system is often ignored.In this study, with DMA (Direct Memory Access) technology, based on the high performance micro-controller of the dsPIC33FJ64GP708, the design fulfills a leading edge signal (Teng, 2010).

MATERIALS AND METHODS
System overview: In this study, a high-voltage fence in a prison is the object, which is researched and designed with this method.The simplified diagram of the highvoltage fence in the prison is shown in Fig. 1.
As indicated in Fig. 1, the currents and voltages of the circuit, what is locate of the front end of the highvoltage fence could be detected through the specific current or voltage transformer.Under normal circumstances, the resistors of R1, R2 is infinite resistance (Shenming, 2009).If someone touches the fence grid, the resistance of the resistors will instantly fall.So, the currents and voltages of the circuit will be instantly changed.The food information acquisition system must detect the change in time in order to learned the fence information.However, due to the bird or wet weather, the resistance value often fluctuate, which causes some false alarms, specially the decline of the resistance value.Therefore, quickly detecting the voltage and current changes can improve the accuracy of the alarm information.In this study, there are three high-voltage signals and two current signals.In order to promote the accuracy of the judgment, the detector of There are 24 ADC channels in the selected CPU, which has two ADC modules.If using the traditional AD transformation and interrupt processing, it will take CPU more work time and the interval of sampling time of the voltage and current of the grid.As the result, there will be larger deviation in the food information analysis programme on the next step.In this design, by DMA function of the MCU to combine the AD conversion in the MCU with itself, the MCU directly copy the AD conversion result from the AD buffer to specific memory.By this means, the system forms a synchronous sampling system.At a specific time the synchronous sampling food information will be transferred to the upper computer via the RS485 communication for the further analysis.This study just involves the hardware and software design of a signal acquisition circuit, the function of the upper computer will be introduced in the other paper.The block diagram of the food information acquisition system of high-voltage fence is shown in Fig. 2.
The signals of voltage and current shown in the Fig. 1 are respectively changed into 0~10 V alternating voltage and imported the food information acquisition system by the voltage transformer and current transformer.The AHT2M1 module is used to detect the of temperature and humidity of the circumstance where the fence grid work in.The analog voltage output of the module directly access the food information acquisition system.While the others discrete signal such as infrared detection and alarm signals is connected by photoelectric coupler isolation to the digital input ports of the MCU.
Digital signal controller and DMA module: The MCU of dsPIC33FJ64GP708 released by the Microchip cooperation, using in the food information acquisition system, is a high performance 16 bit digital signal controller, combines the advantages of control of single chip microcomputer and the high-speed operational characteristics of Digital Signal Processor (DSP) (Shenzhen, year).It uses a modified harvard architecture and RISC (Reduced Instruction-Set Computer) technology.The speed of operation is up to 40 MIPS with 64 K byte operations enhanced flash and 16 K bytes of static RAM, including 2 KB DMA RAM.The single cycle instruction pre-fetching mechanism is used to help maintain the throughput and provide predictable execution, implements that MCU and DSP instructions seamlessly integrated into the architecture and implementation from the same execution unit.At the same time, the chip integrates abundant other functional modules.
Direct Memory Access (DMA) controller is an important subsystem in the series of 16 bit Digital Signal Controller (DSC).Through this subsystem, the MCU can conveniently transfer food information between the CPU and its peripherals without CPU assistance.In the MCU of the dsPIC33F series, the DMA controller is optimized for real-time embedded applications of high performance, these applications require a preferred consideration of certainty and system response time delay.
DMA technology is an important function in the modern computer hardware.It can realize the different speed of hardware devices for food information transmission without CPU intervention and subjecting plentiful interruptible load of the CPU.Otherwise, the Fig. 2: Block diagram of food information acquisition system CPU copy each piece of food information from the source to its registers and then write them once again back to the new place.In this time, the CPU can't be used for other work.The module of DMA transmits the food information from one address space to another address space.After the CPU initializes the transfer action, the transfer is executed by the DMA itself.A typical example is moving an external memory blocks to faster memory area in the chips.For the CPU processor is not involved in this study, it can have time to deal with some other things, so as to improve work efficiency.DMA transfers is very important for high performance embedded system and the networks.The DMA function structure diagram is shown in the Fig. 3.
In the dsPIC33F, the DMA controller based on the structure of the register is a very useful subsystem, through a set of food information and address bus, it connects the internal Dual Port SRAM (DPSRAM) and peripheral Special Function Registers (SFR) which has the DMA function.Without the need the intervention of CPU, the controller can configure the food information transmission function and program DMA control registers in the code initialized process, the CPU just needs to respond to interrupt after the food information transfer is completed, thus eliminate food information transmission delay time, improving the utilization ratio of CPU.
Dspic33F is based on the structure of the register of system function module.It can access to any resources on the chip.The architecture allows the CPU and the DMA to transfer food information at the same time with the DPSRAM and the peripheral bus controller.8 DMA channels with eight different source peripherals and target peripherals exchange food information efficiently, each channel has a set of control and status registers and can be configured to transfer food information from DPSRAM buffer to the peripheral in SFR, or from the peripheral SFR to the DPSRAM buffer.In this design, we configures the ADC channel for DMA channel, the increasing DMA RAM indirect addressing in turn, the continuous food information block transfer, as far as possible to reduce the food information acquisition time interval.

RESULTS AND DISCUSSION
The function of the system is to acquire, process and display food information of the high-voltage fence.Because the high voltage fence system is composed by several segments in general, a mass of food information will be acquired in the whole system.So the food information transfer adopts the polling method between the host computer and the client food information acquisition system.All of the client food information acquisition system response to host computer by the serial interrupt.When the host computer transform a command of reading food information through the Serial port (RS485), the interrupt program will be activated, in which the food information, which has been stored in the a specific storage area by the interrupt of the DMA, will be transmitted to the host computer.For this study introduces the application of DMA, the DMA software design is simply introduced.The main program of the MCU is not introduced.
DMA transfers can be triggered by the timer and external interrupt.The DMA controller supports 8 independent channels, each channel can be configured to send food information to the selected peripherals or receive food information from the selected peripherals.Each DMA channel is unidirectional and it can send a food information block that contains up to 1024 food information elements, then send out a break to CPU, indicating a block of food information has already been processed.Each DMA channel has a set of 6 status and control registers.Before starting DMA, it must be initialized.In this acquisition system, the ADC conversion modules is corresponded with DMA0.
The initialization procedure DMA0 system applications are as follows: After the program initialization is completed, the ADC conversion circuit automatically fulfill the conversion, then other processes of the procedure read the corresponding AD conversion food information, proceeding food information processing and transmission display etc.

CONCLUSION
This study introduces the dsPIC33F microcomputer controller and the function of its DMA and successfully applied it to the prison perimeter high-voltage fence, saving CPU time and ensuring that the voltage and current signals are collected can be compared simultaneously, thus laid a good foundation for improving the perimeter alarm accuracy rate of high voltage fence.

Fig. 1 :
Fig. 1: The simplified diagram of the high-voltage fence the temperature and humidity is designed, which could detect the condition of circumstance.So, there are seven analog signals in the system.There are 24 ADC channels in the selected CPU, which has two ADC modules.If using the traditional AD transformation and interrupt processing, it will take CPU more work time and the interval of sampling time of the voltage and current of the grid.As the result, there will be larger deviation in the food information analysis programme on the next step.In this design, by DMA function of the MCU to combine the AD conversion in the MCU with itself, the MCU directly copy the AD conversion result from the AD buffer to specific memory.By this means, the system forms a synchronous sampling system.At a specific time the synchronous sampling food information will be transferred to the upper computer via the RS485 communication for the further analysis.This study just involves the hardware and software design of a signal acquisition circuit, the function of the upper computer will be introduced in the other paper.The block diagram of the food information acquisition system of high-voltage fence is shown in Fig.2.The signals of voltage and current shown in the Fig.1are respectively changed into 0~10 V alternating voltage and imported the food information acquisition system by the voltage transformer and current transformer.The AHT2M1 module is used to detect the of temperature and humidity of the circumstance where