Click here to check out our new design
   
B2B of Travelocity →
Live Chat

Modbus Protocol

Buy custom Modbus Protocol essay

Modbus protocol

MODBUS protocol is simply a messaging structure. It is used widely to provide master/slave or client/server communication between intelligent devices connected on different types of networks or busses. It also regulates messages between a client or server and one or more servers or slaves. It is one of the oldest communication protocols since it was first developed in 1978 by Modicon.  It uses a traditional approach to connect devices on a network based on a master/ slave relationship system through serial lines.

Depending on the media over which it is being transported, MODBUS is available in several different types. The types include:

Modbus RTU – It is considered the original Modbus and the most widely used. It is used over serial lines mainly over the RS-232 and RS-485 links.

Modbus ASCII – It is much the same as RTU, but the data sent is encoded. RTU uses raw binary. It is mainly used on radio networks/ wireless communication.  

Modbus/TCP – It is also the same as RTU, but it is used over Ethernet. Another difference is that it does not use RTU check sum, instead it uses the check sum built into Ethernet.

Modbus/UDP – Is similar to Modbus TCP but does not use TCP sockets. It uses UDP sockets instead

Modbus+ - This protocol is rarely used. It uses the Modbus name but does not abide to the Modbus communication standards. It is just a proprietary protocol.

Modbus over Ethernet – It refers to channeling Modbus RTU between two points over Ethernet using some special hardware. The name is used by sellers but is not an official name.

The project being undertaken uses serial communication, which takes place over serial lines. There are two main types used in serial communication; ASCII and RTU. ASCII means American Standard Code for Information Interchange while RTU means Remote Terminal Unit. Both of these are traditional methods, but ASCII uses encoded data while RTU use raw binary data. ASCII is mainly used over radio networks. Data is sent sequentially over the communication channel one bit at a time in serial communication the

According to Naskar, Basuli, & Sen Sarma (2008): “ MODBUS protocol describes the process a controller uses to request access to another device, how it will respond to requests from the other devices, and how error will be detected and reported. It establishes a common format for the layout and contents of message field.”

Modbus RTU - is an open serial protocol that relies on client/ server or master/ slave communication through RS – 232 or RS 485 serial links. It is reliable and easy to implement. The master/ slave communication means that communication is started by one device (the master) while the other device is the recipient (slave).The slaves only communicate when they are sending a response to the master’s message. The response is either an action, where the slave perform the requested action, or sends back the data requested. The master device can communicate with the slaves either individually or talk to all of them at the same time. The two modes of communication are unicast mode and broadcast. They are briefly explained below.

Unicast mode is the type of communication where the master talks to a specific slave at a time. After the slave receives and processes the request, it sends a reply to the client/ master. In this type of communication, there are only two messages- a request from the client, and a response from the slave. For the master to identify each slave, it must have a unique address. The address can only range from 1 to 247.

On the other hand, broadcast mode is when the master or client can send a request or talk to all slaves/servers. In this case, there is usually no response from the slaves. This is because when a master sends a request to all slaves, it is usually a writing command that does not need to be replied to. The slaves carry out the command by doing the action required. In this kind of communication, all slaves must accept the broadcast for writing function.  Below are illustrations of the two communication methods.

Fig1:  The blue lines are the communication requests from the master and response from the slave. The master sends a request to slave C. Slave C in return sends a response to the master, replying to the request.

In the figure above, the master sends a writing function/ command to the slaves. The commands are unidirectional because there are no responses.

Modbus communication

Basically, Modbus protocol provides a standard platform that devices use to pass messages to each other. During communication, the protocol determines how each device will know its address, know if a message is addressed to it, determine the action it is supposed to take, and also extract any other data or information in the message. If a reply is needed, the slave will write the message and send it using MODBUS protocol. To sum this up, while transmitting messages, the MODBUS protocol is the common language that devices on the network use to change data.

Regardless of the type of transmission being used (ASCII or RTU) the communication content and cycle are same. It is also important to note that the Modbus protocol references all the data addresses to zero. This means that the first address will be referenced as 0. For example, in hex, coil 1 will be named or addressed as coil 0 while the last coil, 127, will be addressed as coil 126 (ABB, 2005)

The messages sent over the network must contain an address, function code, 8-bit data types and error checking field. This structure applies to both the request and response.

A detailed format of the Modbus request and response would be like the following.

The request of the Modbus protocol has the following fields:

  •  address of the slave that is being sent the request (if the query is broadcast, the
  • address is 00),
  • a function code that states the task needed to be performed,
  • data to be sent, and
  • an error-checking field.

The reply contains the following fields:

  • the address of the slave,
  • confirmation of the task performed in form of a function code,
  • any data or information to be returned, and
  • an error-checking field

The messages sent must have a starting and an ending point. These points help the device receiving the message to know that the message has come, decide if it is theirs or not, and know when the message has been received completely.  If there is an error, the slave will send the error as its response to the request.

The common functions of the Modbus protocol include:


RTU overview

RTU uses an open, serial communication method. It uses RS- 232 or RS- 485. It is easy to use and mostly used in Industrial Automation Systems (IAS) or Building management Systems (BMS). Modbust RTU adopts a simple 16 bit Cyclic Redundant Check sum. The message is simplified to make sure there is reliability.

RS-232 serial communication

Serial communication is the process of sending data one bit at a time sequentially, through a communication channel or the bus of a computer. The RS- 232 is a standard for transferring serial binary data between(DTE) data terminal equipment and a (DCE) data –circuit terminating equipment. It is commonly used in the serial ports of a computer. It works with a maximum speed of 20kps, and can only work effectively on a cable length that does not extend more than 50 feet. Rs- 232 was the preferred RTU communication mode in the olden days. Increase in needs such as direct connection of DTE’s without use of modems, long distance communication, connection of a number of DTE’s on a network, and the need for faster communication rates made people shift to other methods.  The RS- 485 came to be the preferred communication standard because it performs well on all the four issues that the RS- 232 failed. It is used widely in the modern world than the RS-232. The RS- 232 has noise issues compared to RS-485. Standard MODBUS ports on Modicon controllers use an RS-232C compatible serial interface that defines connector pin-outs, cabling, signal levels, transmission baud rates, and parity checking. The devices can be connected together directly or using modems.

In RTU mode, messages begin with a silent interval not less than 3.5 character times. The first field that is transmitted is the device/ controllers address. The acceptable characters transmitted for all the fields are hexadecimal 0 to 9, and then A to F. When the first field is received, each device on the network checks and decides if it is addressed to it. After the last transmitted character, another interval of at least 3.5 character times marks the end of the message. A new message can then follow after this interval. There must not be a break in between a message- it must be sent as a continuous stream. If there is a delay exceeding 1.5 character times, the device that is receiving the message will flush the message and assume that the next byte will be a new message address.  In the same case, if a message begins earlier than the necessary interval of 3.5 character times from the last message, the receiving device will treat the message as a continuation of the last message. This will result to an error because the final CRC field will not be valid when the two messages are combined.       

The other kind of common connection is a DTE to DTE connection, for instance connection between two PCs, in order to exchange data between them. For that kind of connection, null-modem connection is needed.
The third type is DCE to DCE connection. It uses tail circuit cable, but it is a rare kind of connection.

Some technical specifications or characteristics of the RS-232 include: (a) Signal voltages: -5V to -15V (logical 1), +5V to +15V (logical 0) on the other side -3V to -15V (logical 1), +3V to +15V (logical 0) on the receiver side. Typically on a standard PC +/- 12V is used. (b) Maximal cable length: 50 feet at 19200 bps, 3000 feet at 2400bps (it can be much higher without troubles in most cases). (c) Connectors: The common RS-232 connectors are the DB-9 and DB-25. There is a female and a male version for each. In most cases, the DTE has a male while the DCE has a female connector (although this can be different in some other cases). (Naskar, Basuli, & Sen Sarma, 2008)

Characteristics of RS- 232

Cabling

Single-ended

Number of devices

1 transmit, 1 receive

Communication mode

Full duplex

Max distance

50 feet at 19.2kbps

Data rate (max)

1Mbps

Signaling

Unbalanced

Mark (data 1)

-5V (min) -15V (max)

Space (data 0)

5V (min) 15V (max)

Input level (min)

_+3V

Output Current

500mA (NB most drivers used in PCs are limited to 10mA)

Impedance

5K ohms (Internal)

Bus Architecture

Point-to-point

The RTU mode of the MODBUS protocol is advantageous over ASCII in that; (a) the error checking method is done using the LRC (Liner Redundancy Check), but RTU checks errors by CRC (Cyclic Redundancy Check) method. RTU mode also needs synchronization for data communication between master-slave terminals; this disadvantageous when compared to the ASCII mode. However, if the RTU method is implemented, the MODBUS protocol enhance communication making it faster, more rigid and secure.

Buy custom Modbus Protocol essay

Our advantages Our advantages Our advantages
Buy essayHesitating

Related essays


  1. B2B of Travelocity
  2. Science and Culture
 
close