register_read_message — Register Read Messages

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

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

API Documentation

Register Reading Request/Response

class pymodbus.register_read_message.ReadRegistersRequestBase(address, count)

Base class for reading a modbus register

decode(data)

Decode a register request packet

Parameters:data – The request to decode
encode()

Encodes the request packet

Returns:The encoded packet
class pymodbus.register_read_message.ReadRegistersResponseBase(values)

Base class for responsing to a modbus register read

decode(data)

Decode a register response packet

Parameters:data – The request to decode
encode()

Encodes the response packet

Returns:The encoded packet
getRegister(index)

Get the requested register

Parameters:index – The indexed register to retrieve
Returns:The request register
class pymodbus.register_read_message.ReadHoldingRegistersRequest(address=None, count=None)

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.

execute(context)

Run a read holding request against a datastore

Parameters:context – The datastore to request from
Returns:An initialized response, exception message otherwise
class pymodbus.register_read_message.ReadHoldingRegistersResponse(values=None)

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)

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.

execute(context)

Run a read input request against a datastore

Parameters:context – The datastore to request from
Returns:An initialized response, exception message otherwise
class pymodbus.register_read_message.ReadInputRegistersResponse(values=None)

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(read_address, read_count, write_address, write_registers)

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.”

decode(data)

Decode the register request packet

Parameters:data – The request to decode
encode()

Encodes the request packet

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_read_message.ReadWriteMultipleRegistersResponse(values=None)

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.

decode(data)

Decode the register response packet

Parameters:data – The response to decode
encode()

Encodes the response packet

Returns:The encoded packet

Table Of Contents

Previous topic

pymodbus — Pymodbus Library

Next topic

register_write_message — Register Write Messages

This Page