Module author: Galen Collins <bashwork@gmail.com>
Section author: Galen Collins <bashwork@gmail.com>
Base class for reading a modbus register
Decode a register request packet
Parameters: | data – The request to decode |
---|
Encodes the request packet
Returns: | The encoded packet |
---|
Base class for responsing to a modbus register read
Decode a register response packet
Parameters: | data – The request to decode |
---|
Encodes the response packet
Returns: | The encoded packet |
---|
Get the requested register
Parameters: | index – The indexed register to retrieve |
---|---|
Returns: | The request register |
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.
Run a read holding request against a datastore
Parameters: | context – The datastore to request from |
---|---|
Returns: | An initialized response, exception message otherwise |
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.
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.
Run a read input request against a datastore
Parameters: | context – The datastore to request from |
---|---|
Returns: | An initialized response, exception message otherwise |
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.
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 the register request packet
Parameters: | data – The request to decode |
---|
Encodes the request packet
Returns: | The encoded packet |
---|
Run a write single register request against a datastore
Parameters: | context – The datastore to request from |
---|---|
Returns: | An initialized response, exception message otherwise |
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 the register response packet
Parameters: | data – The response to decode |
---|
Encodes the response packet
Returns: | The encoded packet |
---|