---
name: "modbus_get_byte_from_bits"
section: "3"
platform: "linux"
package: "libmodbus-dev"
version: "3.1.6-2.1"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/modbus_get_byte_from_bits"
---

# modbus\_get\_byte\_from\_bits(3)

get the value from many bits

## NAME

modbus\_get\_byte\_from\_bits - get the value from many bits

## SYNOPSIS

**uint8\_t modbus\_get\_byte\_from\_bits(const uint8\_t \****src***, int** *index***, unsigned int** *nb\_bits***);**

## DESCRIPTION

The **modbus\_get\_byte\_from\_bits()** function shall extract a value from many bits. All *nb\_bits* bits from *src* at position *index* will be read as a single value. To obtain a full byte, set nb\_bits to 8.

## RETURN VALUE

The function shall return a byte containing the bits read.

## SEE ALSO

[**modbus\_set\_bits\_from\_byte**(3)](/modbus_set_bits_from_byte/3.md) [**modbus\_set\_bits\_from\_bytes**(3)](/modbus_set_bits_from_bytes/3.md)

## AUTHORS

The libmodbus documentation was written by Stéphane Raimbault \<stephane.raimbault@gmail.com\>
