register_write_message — Register Write Messages

Module author: Galen Collins <bashwork@gmail.com>

Section author: Galen Collins <bashwork@gmail.com>

API Documentation

Register Writing Request/Response Messages

class pymodbus.register_write_message.WriteSingleRegisterRequest(address=None, value=None)

This function code is used to write a single holding register in a remote device.

The Request PDU specifies the address of the register to be written. Registers are addressed starting at zero. Therefore register numbered 1 is addressed as 0.

decode(data)

Decode a write single register packet packet request

Parameters:data – The request to decode
encode()

Encode a write single register packet packet request

Returns:The encoded packet
execute(context)

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_write_message.WriteSingleRegisterResponse(address=None, value=None)

The normal response is an echo of the request, returned after the register contents have been written.

decode(data)

Decode a write single register packet packet request

Parameters:data – The request to decode
encode()

Encode a write single register packet packet request

Returns:The encoded packet
class pymodbus.register_write_message.WriteMultipleRegistersRequest(address=None, values=None)

This function code is used to write a block of contiguous registers (1 to approx. 120 registers) in a remote device.

The requested written values are specified in the request data field. Data is packed as two bytes per register.

decode(data)

Decode a write single register packet packet request

Parameters:data – The request to decode
encode()

Encode a write single register packet packet request

Returns:The encoded packet
execute(context)

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_write_message.WriteMultipleRegistersResponse(address=None, count=None)

“The normal response returns the function code, starting address, and quantity of registers written.

decode(data)

Decode a write single register packet packet request

Parameters:data – The request to decode
encode()

Encode a write single register packet packet request

Returns:The encoded packet