MODBUS_MASK_WRITE_RE(3)
π MODBUS_MASK_WRITE_RE(3) π
okay so bestie, welcome to the libmodbus Manual page for MODBUS_MASK_WRITE_RE(3). This is the one where we mask a single register. Not mask as in hiding your feelings, mask as in bit-math. π
β¨ NAME β¨
modbus_mask_write_register β mask a single register. That's it. That's the name. One register, getting the mask treatment. π
β¨ SYNOPSIS β¨
Here's the signature, no cap:
int modbus_mask_write_register(modbus_t *ctx, int addr, uint16_t and,
uint16_t or);
β¨ DESCRIPTION β¨
The modbus_mask_write_register() function shall modify the value of the holding register at the address addr of the remote device using this algorithm:
new value = (current value AND 'and') OR ('or' AND (NOT 'and'))
It uses the Modbus function code 0x16 (mask single register). iconic. This is giving bit-mask main character energy, periodt. β¨
β¨ RETURN VALUE β¨
The function shall return 1 if successful. Otherwise it shall return -1 and set errno. ngl, 1 is the slay, -1 is the "check errno bestie" moment. π
β¨ SEE ALSO β¨
β¨ AUTHORS β¨
- Martijn de Gouw
<martijn.de.gouw@prodrive.nl> - The libmodbus documentation was written by StΓ©phane Raimbault
<stephane.raimbault@gmail.com>
and that's the whole vibe. This page is from libmodbus v3.1.6, dated 11/17/2025. mwah π
π¦ where this page comes from
- debian bookworm: libmodbus-dev 3.1.6-2.1+deb12u1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms