Module ModbusMaster
The class that creates a modbus master communication protocol.
Info:
- Copyright: Debaru Kft. 2017
- Release:
- License: GNU
- Author: Debaru Kft
| 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. |
| 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. |
| assign (tag) |
Assign an existing tag to a modbus master point. |
| tag () |
Create a new tag for a modbus master point. |
-
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:
-
host
-
Represents the host name of the connection
-
tcp_port
-
Represents the port number of the connection
-
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
-
data_bits
-
Represents the number of data bits of the connection
-
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
-
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
-
receive_timeout
-
Represents the receive timeout settings of the connection. Resolution is in ms.
-
query_delay
-
Tells the system how much time should it wait between two query. Resolution is in ms.
-
round_delay
-
Tells the system how much time should it wait between two query rounds. Resolution is in ms.
-
error_threshold
-
Number of unsuccessful queries after which a slave is determined unreachable.
-
ireg (address)
-
Input register of the slave device.
-
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
-
assign (tag)
-
Assign an existing tag to a modbus master point.
Parameters:
-
tag ()
-
Create a new tag for a modbus master point.
Returns:
Tag