ModBus Protocol and Deep Dive

ModBus Protocol and Deep Dive

How it Work :

The Protocol Modbus transmits the signals over Serial Lines between two devices.We can even connect two devices using single serial cable using serial port in a master slave configuration to make the setup.

    Where data will be send in the form of Zeros and Ones  what we called Bits which is nothing but the voltage difference between 5V to -5V. These bits are send with the baud rate of 9600.

Which Mode to Select :

    ASCII mode :

The answer to this question is depends on the Application we have, we can understand this with the help of this explanation.If we select the ASCII mode then data will send in the form of Eight-bit (Byte)  in a message as a two ASCII characters.

Modbus ASCII is a serial protocol which runs on RS-232 and  RS-485 physical layer. All slaves devices are polled on demand by the master devices and there is only one master. The format of the message frame can be up to 252 bytes in length, and up to 247 addresses are possible. The message frame and function codes.

Advantage :

    It allows time intervals of up to 1 seconds between two characters with any error. It uses Longitudinal redundancy check checksum with message frame by leading colon “ : “ and trailing newline (CR/LF)

RTU mode :

If we select the RTU mode then data will send in the form of Eight-bit (Byte)  in a message as a two four-bit hexadecimal characters.It is compact in nature which send the signals in the form of binary representation. It follows the Commands/data with CRC for security.

Modbus RTU is just like a Modbus ASCII protocol with little variation. The only difference is in the encoding of the data. Where ASCII encodes the message in ASCII characters, while RTU uses bytes instead of ASCII, and that’s why it increases the protocol’s throughput. So RTU is more popular, particularly in new installations in industry.

Advantage :

    It allows more character than ASCII for the same baud

rate. But it should be transmitted in a continuous stream.Using any mode, the message is transmitted into frame that has fixed starting and ending point so that device can understand when to start, what is address of the devices what is the data or payload. It also check for the tampering of thendata towards the security of the data to be received using CRC.

Frame Format :

>—-Start(28 bits)—Address(8 bits)—Function(8 bits)—Data(n*8 bits)—CRC(16 bits)—End(28)—>

 

Modbus TCP mode :

If we select the RTU mode then data will send in the form of Eight-bit (Byte)  in a message as a two four-bit hexadecimal characters.It is compact in nature which send the signals in the form of binary representation. It follows the Commands/data with CRC for security.

Modbus TCP/IP is a modified version of previous protocol where One simple way of demonstrating  Modbus TCP/IP is to focus on encapsulating a Modbus RTU packet within a TCP/IP packet. It is simple to implement Modbus TCP/IP. As we know TCP/IP protocol follows the ISO-OSI layer and having hand shaking and error checking mechanism so iit is slow compared to other Ethernet industrial protocols – but still fast enough for monitoring applications.

Advantage :

    It allows more character than ASCII for the same baud rate. But it should be transmitted in a continuous stream.Using any mode, the message is transmitted into frame that has fixed starting and ending point so that device can understand when to start, what is address of the devices what is the data or payload. It also check for the tampering of thendata towards the security of the data to be received using CRC.