| 1 | # modbus_get_byte_from_bits |
| 2 | |
| 3 | ## Name |
| 4 | |
| 5 | modbus_get_byte_from_bits - get the value from many bits |
| 6 | |
| 7 | ## Synopsis |
| 8 | |
| 9 | ```c |
| 10 | uint8_t modbus_get_byte_from_bits(const uint8_t *src, int index, unsigned int nb_bits); |
| 11 | ``` |
| 12 | |
| 13 | ## Description |
| 14 | |
| 15 | The *modbus_get_byte_from_bits()* function shall extract a value from many |
| 16 | bits. All `nb_bits` bits from `src` at position `index` will be read as a |
| 17 | single value. To obtain a full byte, set `nb_bits` to 8. |
| 18 | |
| 19 | ## Return value |
| 20 | |
| 21 | The function shall return a byte containing the bits read. |
| 22 | |
| 23 | ## See also |
| 24 | |
| 25 | - [modbus_set_bits_from_byte](modbus_set_bits_from_byte.md) |
| 26 | - [modbus_set_bits_from_bytes](modbus_set_bits_from_bytes.md) |