ModPackQTModPackQT
GlossaryResourcesSign up
HomeResourcesModbus GlossaryFC22 — Mask Write Register
Function CodesModbus Term

FC22 — Mask Write Register

Modify specific bits of a holding register without changing others.

Definition

Function Code 22 performs a bitwise AND and OR on a register value — letting you set, clear, or preserve individual bits atomically. The slave computes: Result = (CurrentValue AND AndMask) OR (OrMask AND NOT AndMask). This is useful for setting or clearing individual bits in a configuration register without disrupting adjacent bits.

Quick Facts

FC hex0x16
FormulaResult = (Value & AndMask) | (OrMask & ~AndMask)
Use caseBit-level control of configuration registers

Related Terms

Try it in ModPackQT

See FC22 — Mask Write Register in action — poll registers, write values, and explore function codes in a free browser-based Modbus tool.

Was this definition helpful?

Back to full Modbus Glossary (49 terms)

ModPackQT Modbus Glossary · Updated 2026