For information on the latest version, please have a look at GL013301.
get_modbus_input
This function reads the value of a Modbus I/O register previously configured and registered in the robot controller. It is primarily used to retrieve Modbus digital or analog input data in Manual Mode or during I/O feedback monitoring.
Definition
DRFLEx.h within class CDRFLEx, public section (line 865)
// get modbus register
unsigned short get_modbus_input(string strSymbol)
{
return _get_modbus_input(_rbtCtrl, strSymbol.c_str());
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
strSymbol |
string |
The name of the Modbus signal registered in the controller. |
Return
Value |
Description |
|---|---|
unsigned short |
The current value of the Modbus input register. |
Example
// When the Modbus digital inputs are connected and registered as “di1” and “di2”
unsigned short input1 = drfl.get_modbus_input("di1");
unsigned short input2 = drfl.get_modbus_input("di2");
cout << "DI1 state: " << input1 << endl;
cout << "DI2 state: " << input2 << endl;
This example reads the current states of two Modbus input points, di1 and di2, and prints their ON/OFF status to the console. The signals must be registered beforehand using add_modbus_signal.