节点文献
Uart转Modbus-TCP客户机模块的设计与实现
Design and Implementation of the Module of Uart to Modbus-TCP Client
【作者】 王怀宽;
【导师】 李正平;
【作者基本信息】 安徽大学 , 电路与系统, 2013, 硕士
【摘要】 随着信息技术的发展,工业控制领域的许多设备都有网络互连的需求,伴随着以太网技术向低内存、低容量的发展趋势,嵌入式以太网技术应运而生。工控领域中,很多工控设备的物理接口层都是使用串口连接。串口设备具有传输带宽窄、传输距离近、布线成本高、抗干扰能力弱的缺点,而以太网技术克服了以上缺点,所以将串口设备转换成以太网设备更加利于网络组建。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协议操作以提高执行的效率。在设计的模块上执行操作时,建议发送完指令后,等待模块的回应以后再执行下一条指令的发送,这样会得到一个更稳定的系统。
【Abstract】 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.
【Key words】 Modbus-TCP; RT-Thread; Lib-Modbus; STM32F107; AT-Command; LwIP;