Modbus Protocol

Article by:
Date Published:
Last Modified:

Overview

The Modbus communication protocol is a serial communication protocol. The Modbus protocol does not define the physical layer. Instead it uses RS-232C compatible serial interfaces, which are very common on microcontrollers.

Check out the Mobicon Modbus Protocol Reference Guide for detailed info. Another good tutorial is Lammert Bies’ Modbus interface.

Terminology

  • Coil: Discrete output (e.g. digital GPIO output pin on microcontroller)
  • Holding register: Internal, two-byte wide digital register that are used for storing values

ASCII Framing

Messages start with a colon (:) and end with a carriage return-line feed pair (CR-LF). Each byte of data between is sent as ASCII-encoded HEX (0-9, A-F).

Function Codes

The common function codes are shown in the below table.

CodeDescription
01Read coil status
02Read input status
03Read holding registers
04Read input registers
05Force single coil
06Preset single register
07Read exception status
15Force multiple coils
16Preset multiple registers
17Report slave ID

Software

FreeMODBUS - A Modbus ASCII/RTU and TCP implementation: Software targeted at embedded platforms.

free-dotnet-modbus: A free .NET implementation of the Modbus protocol.

ModNet: Free Windows-based Modbus protocol client, which checks Modbus RTU compliance.


Authors

Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Related Content:

Tags

comments powered by Disqus