FreeMODUS简介

介绍一个Modbus协议的实现

中英文介绍一下FreeMODUS。

About

关于

FreeMODBUS是一个针对嵌入式应用的一个免费(自由)的通用MODBUS协议的实现(移植)。Modbus是一个工业制造环境中应用的一个通用协议。一个Modbus通信协议栈包括两层:Modbus应用层协议,该层定义了数据模式和功能;另外一层是网络层。在当前版本中,FreeMODBUS 提供了一个针对Modbus 应用层协议V1.1以及支持在Modbus over serial line speifications 1.0 协议中定义的RTU/ASCII 传输模式。自从0.7版本以后,FreeModbus也支持在 Modbus Messaging on TCP/IP Implementation Guide V1.0a中定义的Modbus TCP协议。FreeModbus是遵循BSD许可证,这意味着用户可以将FreeModbus应用于商业环境中。目前支持的Modbus功能包括:

FreeMODBUS is a free implementation of the popular Modbus protocol specially targeted for embedded systems. Modbus is a popular network protocol in the industrial manufacturing environment. A Modbus communication stack requires two layers. The Modbus Application Protocol which defines the data model and functions and a Network layer. In its current version FreeMODBUS provides an implementation of the Modbus Application Protocol v1.1a and supports RTU/ASCII transmission modes defined in the Modbus over serial line specification 1.0. Since version 0.7 FreeModbus also supports Modbus TCP defined in Modbus Messaging on TCP/IP Implementation Guide v1.0a. It is licensed under the BSD[1] which permits its usage in commercial environments. The following Modbus functions are currently supported:

  • Read Input Register (0x04)
  • Read Holding Registers (0x03)
  • Write Single Register (0x06)
  • Write Multiple Registers (0x10)
  • Read/Write Multiple Registers (0x17)
  • Read Coils (0x01)
  • Write Single Coil (0x05)
  • Write Multiple Coils (0x0F)
  • Read Discrete Inputs (0x02)
  • Report Slave ID (0x11)
  • 读输入寄存器(0x04)
  • 读保持寄存器(0x03)
  • 写单个寄存器 (0x06)
  • 写多个寄存器 (0x10)
  • 读/写多个寄存器(0x17)
  • 读线圈状态 (0x01)
  • 写单个线圈(0x05)
  • 写多个线圈(0x0F)
  • 读离散输入(0x02)
  • 报告从结点ID (0x11)

The implementation is based upon the most recent standards and should be fully standard compliant. Receiving and transmitting of Modbus RTU/ASCII frames is implemented as a state machines which is driven by callbacks from the hardware abstraction layer. This makes porting to new platforms easy. If a frame is complete it is passed to the Modbus Application Layer where its content is inspected. Hooks are available in the Application Layer to add new Modbus functions.

本移植是基于最新的标准并且力求遵循标准。Modbus RTU/ASCII帧的接受和发送通过硬件提取层的回调函数驱动的一个状态机实现的。这就使得该协议很容易移植到新的平台上。当一个数据帧组合完毕,该数据将自动被传到Modbus应用层,数据帧的内容在该应用层得到解释。应用层提供Hooks(钩子函数),以方便增加新的Modbus功能。


If Modbus TCP is used the porting layer must send an event to the protocol stack if a new frame is ready for processing. The protocol stack then calls a function which returns the received Modbus TCP frame and processes it. If valid a response is created and the porting layer is supplied with the Modbus response. It should then send the response back to the client.

如果在处理一个新的数据帧时用到了Modbus TCP,移植层必须向协议层发送一个事件标志。协议层将调用一个返回接收到的Modbus TCP帧的功能函数。如果创建了一个有效的回复并且移植层支持Modbus回复。该层将向子端回复一个反馈。

你可能感兴趣的:(FreeMODUS简介)