| 1 | # modbus_write_bit |
| 2 | |
| 3 | ## Name |
| 4 | |
| 5 | modbus_write_bit - write a single bit |
| 6 | |
| 7 | ## Synopsis |
| 8 | |
| 9 | ```c |
| 10 | int modbus_write_bit(modbus_t *ctx, int addr, int status); |
| 11 | ``` |
| 12 | |
| 13 | ## Description |
| 14 | |
| 15 | The *modbus_write_bit()* function shall write the status of `status` at the |
| 16 | address `addr` of the remote device. The value must be set to `TRUE` or `FALSE`. |
| 17 | |
| 18 | The function uses the Modbus function code 0x05 (force single coil). |
| 19 | |
| 20 | ## Return value |
| 21 | |
| 22 | The function shall return 1 if successful. Otherwise it shall return -1 and set |
| 23 | errno. |
| 24 | |
| 25 | ## See also |
| 26 | |
| 27 | - [modbus_read_bits](modbus_read_bits.md) |
| 28 | - [modbus_write_bits](modbus_write_bits.md) |