基于嵌入式ARM平台的远程IO数据采集系统的研究和开发._arm数据采集系统
基于嵌入式ARM平台的远程IO数据采集系统的研究和开发.由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“arm数据采集系统”。
Research and Development of the Remote I/O Data Acquisition System Based on Embedded ARM Platform
INTRODUCTION
With the wide use of the networked, intelligent and digital distributed control system, the data acquisition system based on the single-chip is not only limited in proceing capacity, but also the problem of poor real-time and reliability.In recent years, with the rapid development of the field of industrial proce control and the fast popularization of embedded ARM proceor, it has been a trend that ARM proceor can substitute the single-chip to realize data acquisition and control.Embedded ARM system can adapt to the strict requirements of the data acquisition system, such as the function, reliability, cost, size, power consumption, and so on.In this paper, a new kind of remote I/O data acquisition system based on ARM embedded platform has been researched and developed, which can measure all kinds of electrical and thermal parameters such as voltage, current, thermocouple, RTD, and so on.The measured data can be displayed on LCD of the system, and at the same time can be transmitted through RS485 or Ethernet network to remote DAS or DCS monitoring system by using Modbus/RTU or Modbus/TCP protocol.The system has the dual redundant network and long-distance communication function, which can ensure the disturb rejection capability and reliability of the communication network.The new
generation remote data acquisition and moni-toring system based on the high-performance embedded ARM microproceor has important application significance.STRUCTRUE DESIGN OF THE WHOLE SYSTEM
The whole structure chart of the remote data acquisition and monitoring system based on embedded ARM platform is shown in Figure 1.In the scheme of the system, the remote I/O data acquisition modules are developed by embedded ARM proceor, which can be widely used to diversified industries such as electric power, petroleum, chemical, metallurgy, steel, transportation and so on.This system is mainly used for the concentrative acquisition and digital conversion of a variety of electrical and thermal signals such as voltage, current, thermal resistance, thermo-couple in the production proce.Then the converted data can be displayed on the LCD directly, and also can be sent to the embedded controller through RS485 or Ethernet network communication interface by using Modbus/RTU or Modbus/TCP protocol.The data in the embedded controller platform is transmitted to the work-stations of remote monitoring center by Ethernet after further analyzed and pro-ceed.At the same time, these data can be stored in the real time database of the database server in remote monitoring center.The system has the dual redun-dant network and long-distance communication
function, which can ensure the disturb rejection capability and reliability of the communication network.The hardware platform of the Remote I/O data acquisition system based on emb-edded ARM uses 32-bit ARM embedded microproceor, and the software plat-form uses the real-time multi-task operating system uC/OS-II, which is open-source and can be grafted, cut out and solidified.The real time operating system(RTOS makes the design and expansion of the application becomes very easy, and without more changes when add new functions.Through the division of the appli-cation into several independent tasks, RTOS makes the design proce of the application greatly simple.Figure 1 Structure of the whole system THE HARDWARE DESIGN OF THE SYSTEM
The remote I/O data acquisition system based on embedded ARM platform has high universality, each acquisition device equipped with 24-way acquisition I/O channels and isolated from each other.Each I/O channel can select a variety of voltage and current signals, as well as temperature signals such as thermal resis-tance, thermocouple and so on.The voltage signals in the range of 0-75 mV ,1-5V ,0-5V, and so on, the current signals in the range of 0-10mA and 4-20 mA, the thermal resistance measurement components including Cu50, Cu100, Pt50, Pt100, and the thermocouple measurement components including K, E, S, T, and so on.Figure2.Structure of the remote I/O data acquisition system based on ARM proceor The structural design of the embedded remote I/O data acquisition system is shown in Figure 2.The system equipped with some peripherals such as power, keyboard, reset, LCD display, ADC, RS485, Ethernet, JTAG, I2C, E2PROM, and so on.The A/D interface circuit is independent with the embedded system, which is independent with the embedded system, which is system has setting buttons and 128*64 LCD, which makes the debugging and modification of the parameters easy.The collected data can be sent to the remote embedded controller or DAS, DCS system by using
Modbus/RTU or Modbus/TCP protocol through RS485 or Eth-ernet communication interface also, and then be used
for monitoring and control after farther disposal.The system of RS485 has a dual redundant network and long-distance communication function.As the embedded Ethernet interface makes the remote data exchange of the applications become very easy, the system can choose RS485 or Ethernet interface through jumper to communicate with host computer.Ethernet interface use independent ZNE-100TL intelligent embedded Ethernet to serial port conversion module in order to facilitate the system maintenance and upgrade.The ZNE-100TL module has an adaptive 10/100M Ethernet interface, which has a lot of working modes such as TCP Server, TCP Client, UDP, Real COM, and so on, and it can support four connections at most.Figure3.Diagram of the signal pretreatment circuit
Figure 3 shows the signal pretreatment circuit diagram.The signals of thermo-couple such as K,E,S,T etc and 0-500mV voltage signal can connect to the positive end INPx and the negative end INNx of the simulate multiplexers(MUX directly.The 4-20mA current signal and 1-5V voltage signal must be transformed by resis-tance before connecting to the positive end INPx and the negative end INNx of the MUX of certain channel.The RTD thermal resistance signals such as Cu50, Cu100, Pt50 and Pt100 should connect one 1mA constant current before connecting to the positive end INPx and the negative end INNx of the MUX of certain channel.Figure4.Diagram of ADC signal circuit Figure 4 shows the ADC signal circuit, which using the 16-bit ADC chip AD7715.The connection of the chip and the system is simple and only need
five lines which are CS(chip select, SCLK(system clock, DIN(data input, DOUT(data output and DRDY(data ready.As the ARM microproceor has the characteristics of high speed, low power, low voltage and so on, which make its capacity of low-noise, the ripple of power, the transient response performance, the stability of clock source, the reliability of power control and many other aspects should be have higher request.The system reset circuit use special microproceor power monitoring chip of MAX708S, in order to improve the reliability of the system.The system reset circuit is shown in Figure 5.Figure5.Diagram of system reset circuit
SOFTWARE DESIGN AND REALIZATION OF THE SYSTEM
The system software of the remote I/O data acquisition system based on embedded ARM platform use the real-time operating system(RTOS uC/OS-II, which is open-source and can be grafted,cut out and solidified.The key part of RTOS is the real-time multi-task core, whose basic functions including task management, resource management, system management, timer management, memory management, information management, queue management and so on.These functions are used though API service functions of the core.The system software platform use uC/OS-II real-time operating system core simplified the design of application system and made the whole structure of the system simple and the complex application hierarchical.The design of the whole system includes the tasks of the operating system and a series of user applications.The main function of the system is mainly to realize the initialization of the system hardware and the operating system.The initialization of hardware includes interr-upt、keyboard、LCD and so on.The initialization of operating system includes the control blocks and events control blocks, and before the start of multi-task schedu-ling, one task must be started at least.A start task has been created in this system, which is mainly responsible for the initialization and startup of clock, the start-up of interruption, the initialization of communication task module, as
well as the division of tasks and so on.The tasks must be divided in order to complete various functions of the real-time multi-task system.Figure6.Functional tasks of the system software Figure6 shows the functional tasks of the system software.According to importance of the tasks and the demands of real-time, the system applications are divided into six tasks with different priority, which including the tasks of A/D data acquisition, system monitoring, receive queue, data send, keyboard input, LCD display.The A/D data acquisition task demands the highest real-time requirements and the LCD display task is the lowest.Because each task has a different priority, the higher-priority task can acce the ready one by calling the system hang up function or delay function.Figure7.Chart of AD7715 data transfer flow Figure 7 shows the data conversion flow of AD7715.The application A/D conversion is an important part of the data acquisition system.In the uC/OS-II real-time operating system core, the realization proce of A/D driver depends mainly on the conversion time of A/D converter, the analog frequency of the conversion value, the number of input channels, the conversion frequency and so on.The typical A/D
conversion circuit is made up of analog multiplexer(MUX, amplifier and analog to digital converter(ADC.Figure8.Diagram of the application transfer driver Figure8 shows the application procedure transfer driver.The driver chooses the analog channel to read by MUX, then delay a few microseconds in order to make the signal pa through the MUX, and stabilize it.Then the ADC was triggered to start the conversion and the driver in the circle waiting for the ADC until its completion of the conversion.When waiting is in progre, the driver is detecting the ADC state signal.If the waiting time is longer than the set time, the cycle should be end.During waiting time of the cycle, if the conversion completed signal by ADC has been detected, the driver should read the results of the conversion and then return the result to the application.Figure9.Diagram of serial receive Figure9 shows the serial receive diagram with the buffer and signal quantity.Due to the existence of serial peripheral equipment does not match the speed of CPU, a buffer zone is needed, and when the data is sending to the serial, it need to be written to the buffer, and then be sent out through serial one by one.When the data is received from the serial port, it will not be proceed until several bytes have been received, so the advance data can be stored in buffer.In practice, two buffer zones, the receiving buffer and the sending buffer, are needed to be opened from the memory.Here the buffer zone is defined as loop queue data structure.As the signal of uC/OS-II provides the overtime waiting mechanism, the serial also have the overtime reading and writing ability.If the initialization of the received data signal is 0, it exprees the loop buffer is empty.After the interrupt received, ISR read the received bytes from the UART receiving buffer, and put into receiving buffer region, at last wake the user task to execute read operation with the help of received signal.During the entire
proce, the variable value of the current bytes in recording buffer can be inquired, which is able to shows whether the receive buffer is full.The size of the buffer zone should be set reasonable to reduce the poibility of data lo, and to avoid the waste of storage space.CONCLUSIONS
With the rapid development of the field of industrial proce control and the wide range of applications of network, intelligence, digital distributed control System, it is neceary to make a higher demand of the data accuracy and reliability of the control system.Data acquisition system based on single-chip has been gradually eliminated because the problem of the poor real-time and reliability.With the fast popularization of embedded ARM proceor, there has been a trend that ARM proceor can alternate to single-chip to realize data acquisition and control.The embedded ARM system can adapt to the strict requirements of the data acquisition system, such as the function, reliability, cost, size, power consum-ption, and so on.In this paper, A kind of ARM-based embedded remote I/O data acquisition system has been researched and developed, whose hardware platform use 32-bit embedded ARM proceor, and software platform use open-source RTOS uC/OS-II core.The system can be widely applied to electric power, petroleum, chemical, metallurgy, steel, transportation and so on.And it is mainly used in the collection and monitoring of all
kinds of electrical and thermal signals such as voltage, current, thermal resistance, thermocouple data of the production proce.Then these data can be sent to the remote DAS, DCS monitoring system through RS485 or Ethernet interface.The system has the dual redundant network and long-distance communication function, which can ensure the disturb rejection capability and reliability of the communication network.基于嵌入式ARM平台的远程I / O数据采集系统的研究和开发
导言
随着网络化,智能化,数字化分布式控制系统的广泛使用,基于单芯片的数据采集系统不仅在处理能力上受限制,并且在实时性和可靠性方面也出现了问题。近几年来,随着工业过程控制领域的迅速发展和嵌入式ARM处理器的迅速普及,ARM处理器代替单芯片实现数据的采集和控制成为了趋势。嵌入式ARM系统能适应数据采集系统的严格要求,如功能性,可靠性,成本,体积,功耗等等。
在本文中提出一种新型的基于ARM嵌入式平台的远程I / O数据采集系统已被研制开发,它可以衡量各种电气和热参数,如电压,电流,热电偶,热电阻等等。那个测量数据可以显示在液晶显示器的系统中,同时可通过使用Modbus / RTU或的Modbus / TCP协议从RS485或以太网网络传送到DAS或DCS远程监控
系统。该系统具有双冗余网络和长途电通信功能,它可以确保通信网络的干扰抑制能力和可靠性。基于高性能嵌入式ARM微处理器的新一代远程数据采集和监控系统具有重要的应用意义。
整个系统的结构设计
基于嵌入式ARM的平台的远程数据采集和监控系统的整个结构图在以下的图1中展示。在这系统的计划中,通过使用广泛用于多种行业如电气电力,石油,化工,冶金,钢铁,运输等的嵌入式ARM处理器来开发远程I / O数据采集模块。该系统主要用于的集中采购和将各种电和热信号如电压,热电阻,热电偶在生产过程中进行数字转换。转换的数据可直接在液晶显示器上显示,也可以通过使用的Modbus / RTU或的Modbus / TCP协议的RS485总线或以太网网络通信接口被发送到嵌入式控制器。嵌入控制器平台的数据通过进一步以太网的分析和处理被传送至远程监控中心的工作站。与此同时,这些数据可以存储在远程监控中心数据库服务器的实时数据库中。该系统具有双冗余网络和远程通讯功能,它可以确保通信网络的干扰抑制能力和可靠性。
基于嵌入式ARM远程I / O数据采集系统的硬件平台使用32位ARM嵌入式微处理器和软件平台使用的是开源的并且可移植,削减和巩固的实时多任务操作系统的第二代UC / OS核心。实时操作系统(RTOS)使设计和应用的扩大变得非常容
易,增加新的功能时也没多大变化。通过几个独立的任务的应用,实时操作系统使得应用的设计过程极为简单。
系统的硬件设计
基于嵌入式ARM平台的远程I / O数据采集系统具有很高的普遍性,每个购置设备配备24收购方式的I / O渠道且彼此孤立。每个I / O通道可以选择不同的电压和电流信号,以及温度信号如热电阻,热电偶等。在05V的,010毫安和4100TL智能嵌入式以太网串口转换模块。该ZNE500mV的电压信号可以直接接到模拟多路复用器(复用器)的INPx正极和INNx负极。45V的电压信号必须用阻抗转换。热电阻的电阻信号如Cu50,Cu100,Pt50和Pt100应在接到某些频道的复用器INPx正极和INNx负极前连接一1毫安的恒流源。
图4显示了使用16位ADC芯片AD7715的ADC信号电路。芯片与系统的连接非常简单,只需要CS(芯片选择),SLCK(系统时钟),DIN(数据输入),DOUT(数据输出)和DRDY(数据准备)5根线。
由于ARM微处理器具有高速,低功耗,低电压等优点,这使它在低噪音,纹波权力,瞬态响应性能,时钟来源的稳定,功率控制和许多其他方面需要有更高的要求。为了改善系统的可靠性该系统复位电路中使用特殊的微处理器电源监测芯片MAX708S。图5展示了该系统复位电路。
系统软件的设计与实现
基于嵌入式ARM平台的远程I / O数据采集系统的软件使用的是开源的并且可移植,削减和巩固的实时多任务操作系统的第二代UC / OS核心。RTOS的关键部分是实时多任务的核心,其基本功能包括任务管理,资源管理,系统管理,计时器管理,内存管理,信息管理,队列管理等。通过API服务职能核心使用这些功能。
该系统软件平台使用的是单一化的uC/ OS第二代实时简化操作系统核心,使整个结构系统简单和应用层次复杂。整个系统的设计包括操作系统的任务和一系列的用户应用程序。系统的主要职能是实现系统硬件和操作系统的初始化。硬件初始化包括中断,键盘,液晶显示器等。操作系统初始化包括控制模块和事件控制,在多任务调度前,至少有一个任务开始。一个开端任务已建立在这一系统,这系统主要负责初始化和启动的时钟,开办中断,通信任务模块的初始化,以及任务分工等。为了完成实时多任务系统的多种职能那个任务必须被划分。
图6显示系统软件的功能任务。根据任务的重要性和实时要求,系统的应用曾划分为六个不同优先级的任务,其中包括A / D数据采集任务,系统监控,接受队列,数据传送,键盘输入,液晶显示屏显示。A / D数据采集任务要求最高的实时要求和液晶显示器显示任务是最低的。因为每个任务都有不同的优先事项,通过使用系统挂断功能或延迟功能更高的优先任务可以开始已经准备好的任务。
图7显示的是AD7715的数据转换流。A / D转换器的应用是数据采集系统的一个重要组成部分。在uS/ OS的第二代实时操作系统的核心中,A / D驱动程序的实现过程主要取决于A / D转换器的转换时间,有转换价值的模拟频率,输入通
道的数量,转换频率等等。典型的A / D转换电路由模拟复用器(复用器),放大器和模拟到数字转换器(ADC)组成。
图8显示了申请程序转移的驱动程序。驱动程序可以在模拟通道读取由复用器,那么几微秒的延迟,以便使信号通过多路开关,并使其稳定。然后,当转换开始时,ADC被触发,并且驱动程序在一个周期内等待ADC的触发,直到完成转换。当等待的进展,该驱动程序检测ADC的状态信号。如果等待时间比规定的时间越长,周期应该结束。在等待的周期时间,如果转换完成ADC的信号被检测到,驱动程序应改为转换的结果,然后将结果返回给应用程序。
图9显示了缓冲区和信号量的序列接收图。由于外围串行设备的存在CPU的运行速度匹配,一个缓冲区是必要的,当数据发送到序列,它必须被写入缓冲区,然后通过串行逐一地被发送出去。当从串行端口收到数据,这些数据将不会被处理直到收到一些字节,因此先前的数据可以存储在缓冲区中。在实践中,两个缓冲区,一个接收缓冲区和一个发送缓冲区,它们是需要从内存开放出来。在这里缓冲区像循环队列数据结构一样被定义。
由于uC/OS-II提供额外时间等待机制的信号,串口也具有额外的阅读和写作能力。如果收到的数据信号初值为0,它表示循环缓冲区是空的。在中断收到后,ISR从UART接受缓冲区中读到收到的数据,并投入接收缓冲区域,最后通过收到的数据开始用户执行读操作的的任务。在整个过程中,变量价值目前字节在存储缓冲区中的字节的变量值是可以被询问的,这能够表明接收缓冲区是否已满。为了降低数据丢失的可能性和避免浪费存储空间应合理地设置缓冲区的大小。
结论
随着工业过程控制领域的快速发展和网络,智能,数字化分布式控制系统广泛应用,有必要发展对数据准确性和控制可靠性要求更高的系统。由于较差的实时性和可靠性基于单片机数据采集系统已逐步被淘汰。随着嵌入式ARM处理器的迅速普及,ARM处理器替代单芯片实现数据采集与控制成为了一种新的趋势。嵌入式ARM系统能够适应数据采集系统的严格要求,如功能,可靠性,成本,大小,耗电量等等。
在本文中一种基于ARM的嵌入式远程I / O数据采集系统已被研究和开发,其硬件平台采用32位嵌入式ARM处理器和软件平台的使用开源的RTOS uS/ OS-Ⅱ核心。该系统可广泛应用于电力,石油,化工,冶金,钢铁,交通运输等方面。这是主要用于收集和监测各种电气和热信号,如电压,电流,热电阻,生产过程中的热电偶数据。然后通过RS485或以太网接口将这些数据发送到远程的DAS,DCS控制系统的监测系统。该系统具有双冗余网络和长途通信功能,它可以确保干扰抑制和通信网络的可靠性。