register_read_message
— Register Read Messages¶
API Documentation¶
Register Reading Request/Response¶
-
class
pymodbus.register_read_message.
ReadRegistersRequestBase
(address, count, **kwargs)[source]¶ Base class for reading a modbus register
-
__init__
(address, count, **kwargs)[source]¶ Initializes a new instance
Parameters: - address – The address to start the read from
- count – The number of registers to read
-
-
class
pymodbus.register_read_message.
ReadRegistersResponseBase
(values, **kwargs)[source]¶ Base class for responsing to a modbus register read
-
__init__
(values, **kwargs)[source]¶ Initializes a new instance
Parameters: values – The values to write to
-
-
class
pymodbus.register_read_message.
ReadHoldingRegistersRequest
(address=None, count=None, **kwargs)[source]¶ This function code is used to read the contents of a contiguous block of holding registers in a remote device. The Request PDU specifies the starting register address and the number of registers. In the PDU Registers are addressed starting at zero. Therefore registers numbered 1-16 are addressed as 0-15.
-
class
pymodbus.register_read_message.
ReadHoldingRegistersResponse
(values=None, **kwargs)[source]¶ This function code is used to read the contents of a contiguous block of holding registers in a remote device. The Request PDU specifies the starting register address and the number of registers. In the PDU Registers are addressed starting at zero. Therefore registers numbered 1-16 are addressed as 0-15.
-
class
pymodbus.register_read_message.
ReadInputRegistersRequest
(address=None, count=None, **kwargs)[source]¶ This function code is used to read from 1 to approx. 125 contiguous input registers in a remote device. The Request PDU specifies the starting register address and the number of registers. In the PDU Registers are addressed starting at zero. Therefore input registers numbered 1-16 are addressed as 0-15.
-
class
pymodbus.register_read_message.
ReadInputRegistersResponse
(values=None, **kwargs)[source]¶ This function code is used to read from 1 to approx. 125 contiguous input registers in a remote device. The Request PDU specifies the starting register address and the number of registers. In the PDU Registers are addressed starting at zero. Therefore input registers numbered 1-16 are addressed as 0-15.
-
class
pymodbus.register_read_message.
ReadWriteMultipleRegistersRequest
(**kwargs)[source]¶ This function code performs a combination of one read operation and one write operation in a single MODBUS transaction. The write operation is performed before the read.
Holding registers are addressed starting at zero. Therefore holding registers 1-16 are addressed in the PDU as 0-15.
The request specifies the starting address and number of holding registers to be read as well as the starting address, number of holding registers, and the data to be written. The byte count specifies the number of bytes to follow in the write data field.”
-
__init__
(**kwargs)[source]¶ Initializes a new request message
Parameters: - read_address – The address to start reading from
- read_count – The number of registers to read from address
- write_address – The address to start writing to
- write_registers – The registers to write to the specified address
-
execute
(context)[source]¶ Run a write single register request against a datastore
Parameters: context – The datastore to request from Returns: An initialized response, exception message otherwise
-
-
class
pymodbus.register_read_message.
ReadWriteMultipleRegistersResponse
(values=None, **kwargs)[source]¶ The normal response contains the data from the group of registers that were read. The byte count field specifies the quantity of bytes to follow in the read data field.