Modbus Function Code 07 (0x07): Read Exception Status Specification & Hex Guide
When polling dozens of legacy RTUs over slow 9600-baud RS-485 serial lines, SCADA masters need the fastest possible way to check whether a remote PLC or controller has an active alarm, low backup battery, or fault latch. Instead of issuing a multi-byte Function Code 01 (Read Coils) poll with starting addresses and counts, the Modbus Application Protocol Specification V1.1b3 provides Function Code 07 (0x07) — Read Exception Status.
FC 07 packs eight device-specific status bits into a single byte response using a 1-byte request PDU—making it one of the smallest packets in industrial automation. This guide covers the protocol rules, hex byte layouts, bit-decoding table, Python pymodbus code, and how to test frames in ModbusSimulator.
1. How Function Code 07 Works (Serial Line Specification)
Per the Modbus specification, Function Code 07 is a Serial Line only function (Modbus RTU and Modbus ASCII) designed for quick polling of 8 predefined Exception Status outputs inside a slave controller.
- No Address or Quantity Fields: The request PDU contains only the function code
0x07. Which internal coils or fault bits map to bits 0–7 is vendor-defined (historically Modicon 984/584 mapped 8 specific system coils). - 1-Byte Bitmask Response: The slave replies with
0x07plus a singleOutput Databyte (bits 0 through 7, LSB = bit 0, MSB = bit 7). - Not a Protocol Exception Response: Unlike an error frame (where the MSB of the function code is set to 1, e.g.,
0x83+ Modbus exception code), FC 07 reads application-level health flags.
2. Request & Response Hex Frame Analysis
Below is a complete Modbus RTU transaction querying Slave ID 1 (0x01), which returns Exception Status byte 0x6D (binary 0110 1101):
Modbus RTU Request Frame (4 Bytes Total)
[Slave ID] [Function Code] [CRC-16 Lo Hi]
01 07 41 E2
Modbus RTU Normal Response Frame (5 Bytes Total)
[Slave ID] [Function Code] [Output Data] [CRC-16 Lo Hi]
01 07 6D E3 9F
| Bit Position | Binary Value (0x6D) |
Example Vendor Meaning |
|---|---|---|
| Bit 0 (LSB) | 1 | Controller Run / Online |
| Bit 1 | 0 | Memory Battery OK |
| Bit 2 | 1 | I/O Bus Warning Active |
| Bit 3 | 1 | High Temperature Alarm |
| Bit 4 | 0 | No Watchdog Timeout |
| Bit 5 | 1 | Power Brownout Latched |
| Bit 6 | 1 | Remote Mode Selected |
| Bit 7 (MSB) | 0 | No Fatal Fault |
3. Standard Exception Codes for FC 07
If the slave cannot process Function Code 07, it responds with function code 0x87 (0x07 | 0x80) and a 1-byte exception code:
| Exception Code | Name | Cause in FC 07 |
|---|---|---|
0x01 |
Illegal Function | Most common on modern TCP-only PLCs that omit legacy serial-only FC 07 support. |
0x04 |
Server Device Failure | Internal hardware diagnostic bus or status register bank failed to respond. |
4. Python Implementation Using Pymodbus (RTU Serial)
from pymodbus.client import ModbusSerialClient
def poll_exception_status(port="COM3", baudrate=9600, slave_id=1):
client = ModbusSerialClient(port=port, baudrate=baudrate, bytesize=8, parity="N", stopbits=1, timeout=1.0)
if not client.connect():
raise RuntimeError(f"Unable to open serial port {port}")
resp = client.read_exception_status(slave=slave_id)
if resp.isError():
print(f"FC 07 error: {resp}")
else:
status_byte = resp.status
print(f"Exception Status Byte: 0x{status_byte:02X} (bin: {status_byte:08b})")
for bit in range(8):
print(f" Bit {bit}: {(status_byte >> bit) & 1}")
client.close()
if __name__ == "__main__":
poll_exception_status()
5. Testing Serial & TCP Frames With ModbusSimulator
Before commissioning RS-485 field buses or migrating legacy Modicon PLCs, inspect raw serial frames and timing using ModbusSimulator (Windows Modbus emulator, Modbus slave simulator, and Modbus TCP simulator):
- Verify baud rate, parity (8-N-1 vs 8-E-1), and CRC-16 checksums without physical hardware.
- Watch real-time hex traffic logs to distinguish normal FC 07 status bytes from
0x87exception responses. - Compare FC 07 polling against FC 08 (Diagnostics) and FC 17 (Report Server ID).
Debug Modbus RTU & TCP Packets on Windows
Download ModbusSimulator for Windows — unified Master + Slave simulator with raw hex packet capture and virtual COM testing.
Download Free 30-Day TrialFrequently Asked Questions
What is Modbus Function Code 07 (0x07)?
Function Code 07 is Read Exception Status, a serial-line command that reads eight predefined status bits (1 byte) from a remote slave device in a single compact frame.
Why does a modern Modbus TCP PLC return Exception 01 for FC 07?
Per the Modbus spec, FC 07 is defined for Serial Line (RTU/ASCII). Many Ethernet-native Modbus TCP devices do not implement it and return 0x01 Illegal Function.
Is FC 07 the same as a Modbus Exception Code?
No. A Modbus Exception Response uses function code 0x80 + original_FC to report an error. FC 07 is an active query reading 8 vendor-defined status flags.
How many bytes is an FC 07 RTU request?
Just 4 bytes on the wire: 1-byte Slave ID, 1-byte Function Code (0x07), and 2-byte CRC-16 checksum.