1MODBUS_MASK_WRITE_RE(3)        libmodbus Manual        MODBUS_MASK_WRITE_RE(3)
2
3
4

NAME

6       modbus_mask_write_register - mask a single register
7

SYNOPSIS

9       int modbus_mask_write_register(modbus_t *ctx, int addr, uint16_t and,
10       uint16_t or);
11

DESCRIPTION

13       The modbus_mask_write_register() function shall modify the value of the
14       holding register at the address addr of the remote device using the
15       algorithm:
16
17           new value = (current value AND 'and') OR ('or' AND (NOT 'and'))
18
19       The function uses the Modbus function code 0x16 (mask single register).
20

RETURN VALUE

22       The function shall return 1 if successful. Otherwise it shall return -1
23       and set errno.
24

SEE ALSO

26       modbus_read_registers(3) modbus_write_registers(3)
27

AUTHORS

29       Martijn de Gouw <martijn.de.gouw@prodrive.nl> The libmodbus
30       documentation was written by Stéphane Raimbault
31       <stephane.raimbault@gmail.com>
32
33
34
35libmodbus v3.1.6                  07/21/2022           MODBUS_MASK_WRITE_RE(3)
Impressum