Module ModbusMaster

The class that creates a modbus master communication protocol.

Info:

  • Copyright: Debaru Kft. 2017
  • Release:
  • License: GNU
  • Author: Debaru Kft

Functions

ModbusMaster () Creates a master modbus communication platform
start () Starts automatic polling.
read_iregs (slaveid, from, to) Reads the specified range of modbus iregisters.
read_hregs (slaveid, from, to) Reads the specified range of modbus hregisters.
read_dinputs (slaveid, from, to) Reads the specified range of modbus dinputs.
read_coils (slaveid, from, to) Reads the specified range of modbus coils.
write_register (slaveid, address, value) Writes the supplied value to the desired modbus register
write_coil (slaveid, address, value) Writes the supplied value to the desired modbus register
slave (slaveid) Returns a ModbusSlaveLocator based on the slaveid
debug_as (name) Logs the input and output data of the serial port, with name.

Fields

host Represents the host name of the connection
tcp_port Represents the port number of the connection
serial_device Represents the port mode.
baud Represents the baud number of the connection
data_bits Represents the number of data bits of the connection
parity Represents the parity settings of the connection
stop_bits Represents the number of stopbits of the connection
flow_control Represents the flow control settings of the connection
frame_timeout Represents the frame timeout settings of the connection.
receive_timeout Represents the receive timeout settings of the connection.
query_delay Tells the system how much time should it wait between two query.
round_delay Tells the system how much time should it wait between two query rounds.
error_threshold Number of unsuccessful queries after which a slave is determined unreachable.

ModbusSlaveLocator

ireg (address) Input register of the slave device.
hreg (address) Holding register of the slave device
dinput (address) Discrete input of the slave device
coil (address) Coil of the slave device
is_connected () Returns a ModbusSlavePointLocator instance that the user can then test for connection.
is_error () Returns a ModbusSlavePointLocator instance that the user can then test for error.

ModbusMasterPointLocator

assign (tag) Assign an existing tag to a modbus master point.
tag () Create a new tag for a modbus master point.


Functions

ModbusMaster ()
Creates a master modbus communication platform
start ()
Starts automatic polling. During automatic polling, manual polling is not enabled.

Returns:

    bool
read_iregs (slaveid, from, to)
Reads the specified range of modbus iregisters.

Parameters:

Returns:

    int (1: success, 0: timeout, -1 error)
read_hregs (slaveid, from, to)
Reads the specified range of modbus hregisters.

Parameters:

Returns:

    int (1: success, 0: timeout, -1 error)
read_dinputs (slaveid, from, to)
Reads the specified range of modbus dinputs.

Parameters:

Returns:

    int (1: success, 0: timeout, -1 error)
read_coils (slaveid, from, to)
Reads the specified range of modbus coils.

Parameters:

Returns:

    int (1: success, 0: timeout, -1 error)
write_register (slaveid, address, value)
Writes the supplied value to the desired modbus register

Parameters:

Returns:

    int (1: success, 0: timeout, -1 error)
write_coil (slaveid, address, value)
Writes the supplied value to the desired modbus register

Parameters:

Returns:

    int (1: success, 0: timeout, -1 error)
slave (slaveid)
Returns a ModbusSlaveLocator based on the slaveid

Parameters:

Returns:

    ModbusSlaveLocator
debug_as (name)
Logs the input and output data of the serial port, with name.

Parameters:

Fields

host
Represents the host name of the connection
tcp_port
Represents the port number of the connection
  • type int (default: 502)
serial_device
Represents the port mode.
  • 0 tcp_port and host is used
  • 1 RS232 (port1)
  • 2 RS485
  • 3 RS232 (port2)
  • type int (default: 0)
baud
Represents the baud number of the connection
  • type int (default: 9600)
data_bits
Represents the number of data bits of the connection
  • type int (default: 8)
parity
Represents the parity settings of the connection
  • Options NONE, EVEN, ODD
  • type string (default: NONE)
stop_bits
Represents the number of stopbits of the connection
  • type int (default: 1)
flow_control
Represents the flow control settings of the connection
  • Options NONE, RTSCTS, XONXOFF
  • type string (default: NONE)
frame_timeout
Represents the frame timeout settings of the connection. Resolution is in ms. Only available when serialport mode is selected
  • type int (default: 5)
receive_timeout
Represents the receive timeout settings of the connection. Resolution is in ms.
  • type int (default: 500)
query_delay
Tells the system how much time should it wait between two query. Resolution is in ms.
  • type int (default: 10)
round_delay
Tells the system how much time should it wait between two query rounds. Resolution is in ms.
  • type int (default: 500)
error_threshold
Number of unsuccessful queries after which a slave is determined unreachable.
  • type int (default: 10)

ModbusSlaveLocator

ireg (address)
Input register of the slave device.

Parameters:

Returns:

    ModbusMasterPointLocator
hreg (address)
Holding register of the slave device

Parameters:

Returns:

    ModbusMasterPointLocator
dinput (address)
Discrete input of the slave device

Parameters:

Returns:

    ModbusMasterPointLocator
coil (address)
Coil of the slave device

Parameters:

Returns:

    ModbusMasterPointLocator
is_connected ()
Returns a ModbusSlavePointLocator instance that the user can then test for connection.

Returns:

    ModbusMasterPointLocator
is_error ()
Returns a ModbusSlavePointLocator instance that the user can then test for error.

Returns:

    ModbusMasterPointLocator

ModbusMasterPointLocator

assign (tag)
Assign an existing tag to a modbus master point.

Parameters:

tag ()
Create a new tag for a modbus master point.

Returns:

    Tag
generated by LDoc 1.4.6 Last updated 2023-09-25 09:31:08