.. _object_ModbusRtuSlave: :index:`ModbusRtuSlave` ----------------------- Description *********** The ModbusRtuSlave object implements a Modbus RTU slave which communicates with a Modbus RTU master via a serial port. This object was introduced in InCore 2.0. :**› Inherits**: :ref:`ModbusServer ` Overview ******** Properties ++++++++++ .. hlist:: :columns: 3 * :ref:`baudRate ` * :ref:`busInterface ` * :ref:`dataBits ` * :ref:`parity ` * :ref:`portName ` * :ref:`stopBits ` * :ref:`ModbusServer.address ` * :ref:`ModbusServer.registers ` * :ref:`ModbusDevice.activityLed ` * :ref:`ModbusDevice.autoConnect ` * :ref:`ModbusDevice.error ` * :ref:`ModbusDevice.errorString ` * :ref:`ModbusDevice.state ` * :ref:`Object.objectId ` * :ref:`Object.parent ` Methods +++++++ .. hlist:: :columns: 1 * :ref:`ModbusDevice.connectDevice() ` * :ref:`ModbusDevice.disconnectDevice() ` * :ref:`Object.deserializeProperties() ` * :ref:`Object.fromJson() ` * :ref:`Object.serializeProperties() ` * :ref:`Object.toJson() ` Signals +++++++ .. hlist:: :columns: 1 * :ref:`ModbusServer.dataErrorOccurred() ` * :ref:`ModbusServer.mapErrorOccurred() ` * :ref:`ModbusServer.registersDataChanged() ` * :ref:`ModbusDevice.connected() ` * :ref:`ModbusDevice.disconnected() ` * :ref:`ModbusDevice.errorOccurred() ` * :ref:`Object.completed() ` Enumerations ++++++++++++ .. hlist:: :columns: 1 * :ref:`ModbusDevice.BusInterface ` * :ref:`ModbusDevice.Error ` * :ref:`ModbusDevice.State ` Properties ********** .. _property_ModbusRtuSlave_baudRate: .. _signal_ModbusRtuSlave_baudRateChanged: .. index:: single: baudRate baudRate ++++++++ This property holds the data baud rate of the serial port used for communicating with the Modbus RTU master. :**› Type**: :ref:`SerialPort.BaudRate ` :**› Default**: :ref:`SerialPort.Baud115200 ` :**› Signal**: baudRateChanged() :**› Attributes**: Writable .. _property_ModbusRtuSlave_busInterface: .. _signal_ModbusRtuSlave_busInterfaceChanged: .. index:: single: busInterface busInterface ++++++++++++ This property holds the bus interface to use for communication. See the :ref:`BusInterface ` enumeration for details. This property was introduced in InCore 2.8. :**› Type**: :ref:`BusInterface ` :**› Default**: :ref:`ModbusDevice.SerialPort ` :**› Signal**: busInterfaceChanged() :**› Attributes**: Writable .. _property_ModbusRtuSlave_dataBits: .. _signal_ModbusRtuSlave_dataBitsChanged: .. index:: single: dataBits dataBits ++++++++ This property holds the number of data bits of the serial port used for communicating with the Modbus RTU master. :**› Type**: :ref:`SerialPort.DataBits ` :**› Default**: :ref:`SerialPort.Data8 ` :**› Signal**: dataBitsChanged() :**› Attributes**: Writable .. _property_ModbusRtuSlave_parity: .. _signal_ModbusRtuSlave_parityChanged: .. index:: single: parity parity ++++++ This property holds the parity mode of the serial port used for communicating with the Modbus RTU master. :**› Type**: :ref:`SerialPort.Parity ` :**› Default**: :ref:`SerialPort.NoParity ` :**› Signal**: parityChanged() :**› Attributes**: Writable .. _property_ModbusRtuSlave_portName: .. _signal_ModbusRtuSlave_portNameChanged: .. index:: single: portName portName ++++++++ This property holds the name of the serial port used for communicating with the Modbus RTU master. :**› Type**: String :**› Signal**: portNameChanged() :**› Attributes**: Writable .. _property_ModbusRtuSlave_stopBits: .. _signal_ModbusRtuSlave_stopBitsChanged: .. index:: single: stopBits stopBits ++++++++ This property holds the number of stop bits of the serial port used for communicating with the Modbus RTU master. :**› Type**: :ref:`SerialPort.StopBits ` :**› Default**: :ref:`SerialPort.OneStop ` :**› Signal**: stopBitsChanged() :**› Attributes**: Writable .. _example_ModbusRtuSlave: Example ******* .. code-block:: qml import InCore.Foundation 2.5 import InCore.Modbus 2.5 import InCore.IO 2.5 Application { name: "Modbus RTU slave example" System { id: system Polling on cpuLoad { } Polling on deviceHumidity { } Polling on deviceTemperature { } } LED { index: LED.StatusBlue value: ledReg.data } ModbusRtuSlave { id: slave address: 1 portName: "ttyO1" baudRate: SerialPort.Baud250000 // expose CPU load as float (address 0+1) ModbusRegister { type: ModbusRegister.Input address: 0 dataType: ModbusRegister.Float count: 2 data: system.cpuLoad } // expose device temperature and humidity at address 2+3 ModbusRegister { type: ModbusRegister.Input address: 2 count: 2 data: [ system.deviceTemperature, system.deviceHumidity ] } // control blue status LED through coil 0 ModbusRegister { id: ledReg type: ModbusRegister.Coil address: 0 } } }