.. _get_input_register_bit: get_input_register_bit ------------------------------------------ This function reads a **single bit** from the controller **input register** using the specified **register address**. It is typically used for PLC I/O register monitoring in Ethernet-based environments. **Definition** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section .. code-block:: cpp bool get_input_register_bit(unsigned short address, int& out_val, int timeout_ms = 300) { return _get_input_register_bit(_rbtCtrl, address, &out_val, timeout_ms); }; **Parameter** .. list-table:: :widths: 20 20 20 55 :header-rows: 1 * - **Parameter Name** - **Data Type** - **Default Value** - **Description** * - address - unsigned short - - - **Input register address** (bit index, 0~63) * - out_val - int& - - - **Input bit value** to read |br| `0` : OFF |br| `1` : ON * - timeout_ms - int - 300 - Timeout in milliseconds **Return** .. list-table:: :widths: 25 75 :header-rows: 1 * - **Value** - **Description** * - 0 - Error: failed to read input register bit * - 1 - Success: input register bit read **Example** .. code-block:: cpp #include "DRFLEx.h" #include using namespace DRAFramework; int main() { CDRFLEx robot; const char* ip = "192.168.137.120"; if (!robot.open_connection(ip)) { std::cout << "Failed to connect: " << ip << std::endl; return 1; } // Read bit (timeout 300 ms) // Initialize to -1 to indicate “not read yet” if the call fails. int out_bit = -1; robot.get_input_register_bit(0, out_bit, 300); std::cout << "addr=0, out_bit=" << out_bit << std::endl; robot.close_connection(); return 0; } This example reads the input register bit at **address 0 (Bit_Input_Register[0])**.