Function Codes
▮ Overview
What you'll learn
Reads, writes, diagnostics, and the codes you'll actually meet in the field.
Sections
10
Labs
1
Quiz
8 Qs
What you'll be able to do
- Recite the four read codes and the four write codes from memory.
- Pick FC 03 vs FC 04 vs FC 06 vs FC 16 for a given task.
- Parse an exception PDU into function code + exception code.
Why you'll need this
- "A device only responds to FC 03, not FC 04. Map says input registers. What do you actually request?"
Three things people get wrong
- 1.Using FC 06 for two registersFix FC 06 writes one register only. FC 16 writes a contiguous block in one request, but device-level atomic behavior still requires vendor documentation or verified lab evidence.
- 2.Sending FC 02 to a holding-register mapFix Wrong table. Use FC 03 (holding) or FC 04 (input).
- 3.Ignoring the 0x80 bit on the response FCFix Any returned FC ≥ 0x80 is an exception — read the next byte for the cause.
From the field
The device that lied about its function codes
A cheap meter advertised support for FC 03 and FC 04 but actually mirrored the same registers behind both. Integrators kept asking why the 'input' values matched the 'holding' values. The capture showed identical byte sequences on either FC. Trust the bus, not the brochure.
Cited sources
Primary sources come from protocol and standards publishers. Secondary sources provide supporting tool, vendor, or reference context.
- Primary sourceModbus Application Protocol V1.1b3 ↗Function code definitions — section 6
This module is paginated — step through the sections, run the labs, then take the quiz. Progress is saved locally.
Print one-pager →