<commit_before># Finslib API Reference

### `finslib_memory_area_read_bit( sys, start, data, num_bit );`

### Parameters

| Parameter | Type | Description |
| :--- | :--- | :--- |
|**`sys`**|`struct fins_sys_tp *`|A pointer to a structure with the FINS context|
|**`start`**|`const char *`|An ASCII string describing the first memory element to retrieve|
|**`data`**|`bool *`|Pointer to the buffer where the result must be stored|
|**`num_bit`**|`size_t`|The number of bits to return|

### Return Value

| Type | Description |
| :--- | :--- |
|`int`|A return value from the list [`FINS_RETVAL_...`](fins_retval.md) indicating the result of the query|

### Description

The function `finslib_memory_area_read_bit()` can be used to retrieve a block of bits from a memory area in a remote PLC. The connection with the PLC should already be present before this function is called.

Data is transferred unmodified from the FINS data stream to the caller supplied buffer.  Enough dataspace is the responsibility of the calling function, but `finslib_memory_area_read_word()` will return an error if a NULL pointer is provided for data storage.

The start of the memory area is provided as an ASCII string which represents the starting address in human readable format. Example formats are **`CIO20.0`** and **`W100.5`**.

The requested number of bits is not limited by the amount of data a PLC can send in one FINS packet because `finslib_memory_area_read_bit()` will automatically use multiple request at the FINS layer if the dataset will be too large.

The return value is either **`FINS_RETVAL_SUCCESS`** when the function succeeded, or one of the other **`FINS_RETVAL_`** values if an eror occurs. In the latter case the data in the return buffer is unreliable and should not be used.

### See Also

* [`FINS_RETVAL...`](fins_retval.md) &ndash; Libfins function return code list
* [`FINS_DATA_TYPE...`](fins_data_type.md) &ndash; Libfins data types
* [`finslib_forced_set_reset_cancel();`](finslib_forced_set_reset_cancel.md)
* [`finslib_memory_area_read_word();`](finslib_memory_area_read_word.md)
* [`finslib_memory_area_write_bit();`](finslib_memory_area_write_bit.md)
* [`finslib_memory_area_write_word();`](finslib_memory_area_write_word.md)
* [`finslib_multiple_memory_area_read();`](finslib_multiple_memory_area_read.md)<commit_msg>Fixed typo<commit_after># Finslib API Reference

### `finslib_memory_area_read_bit( sys, start, data, num_bit );`

### Parameters

| Parameter | Type | Description |
| :--- | :--- | :--- |
|**`sys`**|`struct fins_sys_tp *`|A pointer to a structure with the FINS context|
|**`start`**|`const char *`|An ASCII string describing the first memory element to retrieve|
|**`data`**|`bool *`|Pointer to the buffer where the result must be stored|
|**`num_bit`**|`size_t`|The number of bits to return|

### Return Value

| Type | Description |
| :--- | :--- |
|`int`|A return value from the list [`FINS_RETVAL_...`](fins_retval.md) indicating the result of the query|

### Description

The function `finslib_memory_area_read_bit()` can be used to retrieve a block of bits from a memory area in a remote PLC. The connection with the PLC should already be present before this function is called.

Data is transferred unmodified from the FINS data stream to the caller supplied buffer.  Enough dataspace is the responsibility of the calling function, but `finslib_memory_area_read_word()` will return an error if a NULL pointer is provided for data storage.

The start of the memory area is provided as an ASCII string which represents the starting address in human readable format. Example formats are **`CIO20.0`** and **`W100.5`**.

The requested number of bits is not limited by the amount of data a PLC can send in one FINS packet because `finslib_memory_area_read_bit()` will automatically use multiple request at the FINS layer if the dataset will be too large.

The return value is either **`FINS_RETVAL_SUCCESS`** when the function succeeded, or one of the other **`FINS_RETVAL_`** values if an error occurs. In the latter case the data in the return buffer is unreliable and should not be used.

### See Also

* [`FINS_RETVAL...`](fins_retval.md) &ndash; Libfins function return code list
* [`FINS_DATA_TYPE...`](fins_data_type.md) &ndash; Libfins data types
* [`finslib_forced_set_reset_cancel();`](finslib_forced_set_reset_cancel.md)
* [`finslib_memory_area_read_word();`](finslib_memory_area_read_word.md)
* [`finslib_memory_area_write_bit();`](finslib_memory_area_write_bit.md)
* [`finslib_memory_area_write_word();`](finslib_memory_area_write_word.md)
* [`finslib_multiple_memory_area_read();`](finslib_multiple_memory_area_read.md)
{'fraction_non_alphanumeric': 0.10997004706889174, 'fraction_numerical': 0.002995293110825845, 'mean_word_length': 5.584507042253521, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2119085', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1440, 'n_words': 532}