Modbus 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.


  • 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.

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


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.

Posted: December 14th, 2012 at 2:26 pm
Last Updated on: November 26th, 2017 at 1:38 pm