Modbus Protocol

Modbus is a communication protocol developed by Modicon (now Schneider Electric) in 1979 for use with its programmable logic controllers (PLCs).

It's a simple, robust and widely adopted protocol used in industrial electronic devices. Originally designed for RS232 communication, but today RS485 is more common.

Protocol Variants

Modbus RTU

Binary representation, more compact and efficient for serial communication.

Modbus ASCII

ASCII representation, human-readable but less efficient. Maximum size is 513 characters.

Modbus TCP

Ethernet-based version using TCP/IP protocol stack.

Physical Layer

Common serial configurations:

  • 1 start bit
  • 8 data bits
  • 0 or 1 parity bit (even/odd/none)
  • 1 or 2 stop bits

Protocol Layers

ISO/OSI Layer Modbus Layer
7. Application layer Modbus Application layer
6. Presentation layer -
5. Session layer
4. Transport layer
3. Network layer
2. Data link layer
1. Physical layer Physical layer

Communication Model

Master-Slave Architecture

  • Master: Initiates all communication
  • Slaves: Respond only when addressed
  • Broadcast: Master can send to all slaves (address 0), no response expected

Function Codes

Code Function Description
01 Read Coils Read 1-2000 contiguous coils
02 Read Discrete Inputs Read 1-2000 contiguous discrete inputs
03 Read Holding Registers Read 1-125 contiguous holding registers
04 Read Input Registers Read 1-125 contiguous input registers
05 Write Single Coil Write a single coil
06 Write Single Register Write a single holding register
15 Write Multiple Coils Write 1-1968 contiguous coils
16 Write Multiple Registers Write 1-123 contiguous registers

Application Layer

Detailed application layer documentation to be completed...

SerialMon Support

  • Modbus RTU frame parsing
  • Function code interpretation
  • Address and data tracking
  • Error detection and reporting
  • Master-slave communication monitoring

Note: Modbus ASCII support is currently under development.