Skip to content
Elausys

Modbus TCP Gateways for Alarm Systems / AJAX-MBTCP User Manual

Modbus TCP protocol

Supported function codes, exception responses and the Modbus TCP message header.

elausys · 15 September 2026
On this page

Supported Function Codes

The gateway supports the following Modbus function codes:

CodeNameDescription
0x01Read CoilsRead coil status (status registers)
0x05Write Single CoilWrite a single coil (command registers)

Exception Codes

The gateway returns the following Modbus exception codes when an error occurs:

CodeNameDescription
0x01Illegal FunctionFunction code not supported
0x02Illegal Data AddressCoil address out of range
0x03Illegal Data ValueInvalid value (neither 0xFF00 nor 0x0000)

MBAP Header

All Modbus TCP communication uses the standard MBAP (Modbus Application Protocol) header:

ByteFieldValue
0–1Transaction IDSet by client (echoed in response)
2–3Protocol ID0x0000 (Modbus)
4–5LengthNumber of following bytes
6Unit ID0x01
7Function Code0x01, 0x05
8+DataFunction-specific payload

Frequently Asked Questions

Which Modbus function codes are supported?

Use 0x01, Read Coils, and 0x05, Write Single Coil. The gateway exposes coils rather than holding registers.

Which values are valid for Write Single Coil?

The documented values are 0xFF00 for ON and 0x0000 for OFF. Other values return exception 0x03, Illegal Data Value.

Which Unit ID belongs in the MBAP header?

Set the Unit ID to 0x01, which is decimal 1.

Keep exploring

Find the other guides for this product in the documentation.

Back to AJAX-MBTCP User Manual