Testing Services

Modbus Testing Guide - RTU & TCP Automation

Function codes, register and coil validation, exception testing, and endurance runs - what Modbus testing covers and how to automate it.

Modbus testing guide RTU TCP PLC

WHAT IS MODBUS TESTING?

Modbus testing is the validation of Modbus RTU or Modbus TCP communication between a Modbus master (client) and one or more Modbus slave (server) devices - verifying correct function code handling, register and coil values, exception response behaviour, and communication timing.

Modbus is the most widely deployed industrial protocol in the world - found in PLCs, HMIs, sensors, drives, flow meters, smart meters, and building management systems. It defines a simple request-response model where a master sends requests to addressed slaves: read coils, read discrete inputs, read/write holding registers, read input registers.

Two variants, same test approach: Modbus RTU uses serial RS485/RS232 framing with CRC-16 checksum; Modbus TCP wraps the same PDU in a TCP/IP frame over Ethernet. TestBot's Modbus Server and Client agents support both transports. The same test cases cover both - only the transport configuration changes.

MODBUS FUNCTION CODES

Standard Modbus Function Codes - What Each Tests

FCNameData ObjectsWhat It Tests
01 (0x01)Read CoilsOutput coils (1-bit read/write)Coil state read, bit-packing, quantity limits
02 (0x02)Read Discrete InputsInput coils (1-bit read-only)Discrete input state, correct read-only enforcement
03 (0x03)Read Holding Registers16-bit read/write registersRegister values, byte order, quantity limits (max 125 registers)
04 (0x04)Read Input Registers16-bit read-only registersInput register values, read-only enforcement
05 (0x05)Write Single CoilSingle output coil0xFF00 = ON, 0x0000 = OFF - correct encoding validation
06 (0x06)Write Single RegisterSingle holding register16-bit value write, immediate readback confirmation
15 (0x0F)Write Multiple CoilsMultiple output coilsBulk coil write, byte count validation, partial byte handling
16 (0x10)Write Multiple RegistersMultiple holding registersBulk register write, byte count = 2× register count validation
Exception responsesVarious FC with error-Illegal function (01), illegal data address (02), illegal data value (03), slave device failure (04)

TESTBOT MODBUS AGENTS

Agent
Modbus Server Agent
Hardware Required
RS485 USB Adapter
Hardware Required
Simulate a Modbus RTU/TCP slave device (PLC or sensor) - let your host system read and write coils, registers, and discrete inputs.
Agent
Modbus Client Agent
Hardware Required
RS485 USB Adapter
Hardware Required
Send read/write requests to a real Modbus slave device - the most common industrial test scenario, validating your PLC or sensor directly.
TEST SCENARIOS

Modbus Test Scenarios With TestBot

ScenarioAgents UsedValidated Outcome
PLC Register Read ValidationModbus Client Agent - FC03 read holding registersAll defined registers return values within spec; out-of-range addresses return exception 02
Sensor Coil State TestModbus Client Agent - FC01 read coilsAll coil states match physical sensor states; bit-packing correct
HMI Write and ConfirmModbus Client Agent - FC16 write + FC03 readbackWritten values confirmed by readback within 100ms
Slave Simulation for Master TestModbus Server Agent (slave simulation)Master device under test correctly reads and writes all simulated register maps
Exception Response ValidationModbus Client Agent - invalid address + function codeCorrect exception codes returned for each error condition
Endurance Test (24h)Modbus Client Agent - continuous FC03 pollZero communication errors over 24-hour endurance run; all values within tolerance

Frequently Asked Questions - Modbus Testing

Modbus testing FAQ

Modbus testing is the validation of Modbus RTU or TCP communication - verifying that a device correctly handles all implemented function codes, returns correct register and coil values, sends correct exception responses for invalid requests, and meets timing requirements. It covers both the Modbus master (client) and slave (server) sides of the communication.

Continue Learning

RELATED GUIDES

Automate Your Modbus Device Testing

Modbus Server + Client bundle covers both sides. RS485 Adapter for RTU, PC Ethernet for TCP. 14-day free trial.