Uart转Modbus-TCP客户机模块的设计与实现
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
随着信息技术的发展,工业控制领域的许多设备都有网络互连的需求,伴随着以太网技术向低内存、低容量的发展趋势,嵌入式以太网技术应运而生。工控领域中,很多工控设备的物理接口层都是使用串口连接。串口设备具有传输带宽窄、传输距离近、布线成本高、抗干扰能力弱的缺点,而以太网技术克服了以上缺点,所以将串口设备转换成以太网设备更加利于网络组建。Modbus协议是流行的现场总线之一,Modbus-TCP协议具有简单、高效、稳定的优势,是我们在应用层设计中的首选。在这些背景下,我们提出了本文的课题Uart转Modbus-TCP客户机的设计与实现。
     经过充分的调查和研究,选用性价比高的意法半导体生产的Cotex-M3内核的STM32F107系列单片机为硬件载体,选用Keil、Modbus Salve、SecureCRT等开发调试工具搭建开发环境,选用国产的RT-Thread操作系统、瑞士科学院的TCP/IP协议栈LwIP、开源的Modbus协议Lib-Modbus作为软件基础。将这些软件集合到一起,并在这些软件的基础上,编写外围设备的各种驱动及应用软件,包括Flash读写驱动、TCP客户端应用、串口应用、Modbus应用。根据系统对指令的需求,精心设计了指令的协议和规范。
     经过设计和调试,完成了Modbus-TCP协议的8种基本操作,并进行了功能测试和性能测试,除读写多保持寄存器外,功能均已实现。性能方面,在间隔100ms发送指令,均不出现错误。设计中不足之处是,没有对多条指令同时到达时,将多条指令统一成一条指令进行Modbus协议操作以提高执行的效率。在设计的模块上执行操作时,建议发送完指令后,等待模块的回应以后再执行下一条指令的发送,这样会得到一个更稳定的系统。
With the development of information technology, a lot of equipment in the field of industrial control requires internetworking, and along with Ethernet technology developing into the trend of low memory and low capacity, the embedded Ethernet technology emerges according to the need. In the field of industrial control, the physical interface layer of much equipment uses a serial port connection. The serial port equipment has defects of short transmission belt width, short transmission distance and high cost of wiring, weak anti-interference ability, but Ethernet technology overcomes the shortcomings mentioned above, so converting serial device into Ethernet device is more conducive to form a network. Modbus protocol is one of the popular fieldbus, and it has advantages of simplicity, efficiency and stability, so it is our first choice in the application layer design. Under this background, we put forward in this paper, the research subject of turning Uart to Modbus TCP client design and implementation.
     After full investigation and research, to choose cost-effective stmicroelectronics production Cotex-M3STM32F107series single chip processor as the hardware carrier of kernel, to use Keil, Modbus Salve, SecureCRT development and debugging tools to form the development environment, and to choose domestic RT-operating system Thread, the Swiss academy of sciences of the LwIP TCP/IP protocol stack, open-source Lib-Modbus Modbus protocol as the basic of software. Putting the software together, and writing various peripheral driver and application software, including read and write Flash drives, TCP applications, serial port application, Modbus client applications on the basis of the software. According to the system requirements for instructions,I have designed the command protocol and specification carefully.
     Through designing and debugging, I have completed8kinds of basic operation of Modbus TCP, and have carried on the functional testing and performance testing. Except reading and writing more to keep a register of functions, most functions have been implemented. In respect of performance, sending commands at the interval of100ms does not have error. The shortcoming in design is that it can not integrate multiple instructions into one when they arrive at the same time in operating the Modbus protocol to improve the efficiency of execution. When performing operations on design of module, it is recommended that after sending the order, waiting for the module of the response of the execution to send next instruction, which will lead to a more stable system.
引文
[1]罗安明,韩新民.现场总线技术的发展及趋势[J].机电产品开发与创新,2011(1):9-11.
    [2]朱钱祥,汪伟,张琦.2011现场总线技术发展[J].可编程控制器与工厂自动化,2011(12):37-39.
    [3]邵建均.热工远程监控的研究与软件开发[D].南京理工大学,2004.
    [4]陈磊.从现场总线到工业以太网的实时性问题研究[D].浙江大学,2004.
    [5]邓欣茹,丁建兴,杨翼,等Modbus/TCP工业以太网的现状与发展[J].工业控制计算机,2004(9):14-15+36.
    [6]田召.基于VB语言的MODBUS/TCP-IP通讯模块的开发[J].电子工业专用设备,2009(10):41-45.
    [7]金青.基于Modbus协议的嵌入式系统网桥的研究[D].北京交通大学,2006.
    [8]刘文军.面向停车场的电动汽车充电网络控制系统[D].华南理工大学,2012.
    [9]张向利.基于以太网的数控系统现场总线技术研究[D].华中科技大学,2008.
    [10]周冬鑫.惯性运动捕捉前端设备研究与设计[D].浙江大学,2011.
    [11]RT-Thread工作室RT-Thread实时操作系统编程指南版本0.3.0[Z].2010.
    [12]吴帮明.高速列车跟踪试验鉴测系统设计与实现[D].西南交通大学,2011.
    [13]梁志勇.基于LM3S8962处理器的煤矿监测系统的研究[D].北京交通大学,2011.
    [14]李新明,李艺.多线程技术[J].小型微型计算机系统,1998(2):66-73.
    [15]洪英,陈曦.嵌入式实时多任务程序设计[J].计算机应用,2000(7):10-12.
    [16]邱祎.嵌入式实时操作系统RT-Thread的设计与实现[D].电子科技大学,2007.
    [17]池元武.嵌入式实时操作系统动态内存管理优化方案的研究[D].上海交通大学,2011.
    [18]邓彬伟.嵌入式系统I/O设备驱动模式和结构的研究[D].华中师范大学,2005.
    [19]倪建军.嵌入式Modbus/Modbus TCP网关的设计与研究[D].北京交通大学,2008.
    [20]李勇,黄健.一种用低成本实现的Modbus/TCP转换器[J].单片机与嵌入式系统应用,2010(9):70-72.
    [21]李振江Linux系统下Modbus主协议栈设计与实现[D].安徽大学,2012.
    [22]薛海涛,和卫星,陈晓平.数据采集系统中Modbus协议的实现[J].微计算机信息,2007(28):68-69+281.
    [23]潘长清.基于Modbus协议的嵌入式数据通信系统研究[D].北京交通大学,2008.
    [24]佚名Vinton Cerf互联网的现在和未来[J].中国教育网络,2007(4):24-25.
    [25]DUNKELS A.TCPIP协议栈的设计与实现[Z].2001.
    [26]李秋菊.通用异步接收发送器的设计[D].西安电子科技大学,2007.
    [27]意法半导体(中国)投资有限公司STM32 Reference Manual(RM0008)[EB/OL].2010-1-10.http://www.stmicroelectronics.com.cn/we b/cn/home.html.
    [28]袁文华.基于以太网通信的专变采集终端研究与设计[D].山东大学,2011.
    [29]MPS.MP1593[Z].2006.
    [30]佚名.国家标准GB/T 19582-2008《基于Modbus协议的工业自动化网络规范》发布会[J].仪器仪表标准化与计量,2008(2):5.

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700