Modbus Client Response
The MotoHawk™ Modbus licensed Response block is used to retrieve the response to a previously issued Modbus Client Request.
Block ID
Modbus Client Response
Library
motohawk_modbus_lib/Client
Description
The block face title of this block is dependent on the Function selected in the mask dialog configuration. The selected Function Type also affects which input ports and mask parameters are available.
This block collects a response that has been received for a given Modbus Client Request. Output ports available depend on the selected Function Type.
The block expected to be paired with a Modbus Client Request block. There is a 1:1 mapping between Request and Responses (unless a broadcast). Response data is not available immediately after a Request is issued as a round trip to the Server must be completed. The user can poll for the Response, or use the Modbus Client Response Trigger block to be notified that a response has been received.
- Poll: Enable the Age output port of the Modbus Client Response
block and when Age = 0 and the Output Status is not in Error, then a new response has been received.
- Trigger: Configure a Modbus Client Response Trigger block
to execute a Modbus Client Response block of the same named
Request. The Trigger only executes when a recognisable response of a referenced request is received.
Modbus broadcast (ID = 0) requests do not produce a response, so this block does not need to be executed.
When enabled, ID and IP ports can be used to direct received data to appropriate storage based on their source.
Read Function Types will also expose a data port of an appropriate size and type based on the FunctionType and Number of selection.
Click here for example usage
Function Types Available
Function | Allowed Transport | Comments/Description |
---|---|---|
Read Coil | TCP / Serial | Response to Read 1 or more Coils (boolean array) |
Read Discrete Input | TCP / Serial | Response to Read 1 or more Discrete Inputs (boolean array) |
Read Holding Register | TCP / Serial | Response to Read 1 or more Holding Registers (uint16 array) |
Read Input Register | TCP / Serial | Response to Read 1 or more Input Registers (uint16 array) |
Write Coil | TCP / Serial | Response to Write 1 or more Coils (boolean array). |
Write Holding Registers | TCP / Serial | Response to Write 1 or more Holding Registers (uint16 array). |
Mask Holding Registers | TCP / Serial | Response to Set or clear specific bits of a Holding Register (uint16). |
Event Count Report | Serial | Response to Read server Event Counter (uint16) |
Output Status
A status value returns the success or failure of the Response operation. motohawk_modbus_client_status_enum Matlab script enumerates the possible values of the Status output.
Possible output statuses are:
Status | Value | Comments/Description |
---|---|---|
NO_ERROR | 0 | No issue querying response (no new data) |
ILLEGAL_FUNCTION | 1 | Unsupported or illegal Function Type. |
ILLEGAL_DATA_ADDR | 2 | Data address was out of range. |
SYSTEM_ERROR | 4 | Please report issue to Woodward mcssupport@woodward.com. |
ILLEGAL_DATA_VALUE | 3 | Data value was out of range. |
ADAPTER_TIMEOUT | 5 | Response data was not received from Server |
LINK_INACTIVE | 6 | There was an error in the communications link. |
INCORRECT_RESPONSE | 7 | Received data not formed as expected. Eg: Number of registers does not correspond to byte count. |
OTHER_PROTOCOL_ERROR | 8 | CRC error or Invalid broadcast addressing (read requested) |
RESPONSE_RECEIVED | 10 | Expected response has been received. New data retrieved. |
Block Parameters
Parameter Field | Values | Comments/Description |
---|---|---|
Request Reference Name | Alpha-numeric text, single-quote enclosed | Name of the Request defined by the corresponding Modbus Client Request block |
Modbus Definition Reference | Alpha-numeric text, single-quote enclosed | Name of the Modbus Client Definition. |
Function Type | Drop-down list | Lists supported functions. Must match the referenced Modbus Client Request block setting |
Number of <Function Type> | Integer | When the Function Type selected applies to Coils/Registers/Inputs, this field is exposed and allows the user to select how many of the Coils/Registers/Inputs to read or write in a single transaction. Must match the referenced Modbus Client Request block setting |
Show response Age port | Checkbox | Show Age of data output port. Age = The number of times this block has executed without a response having been received |
Show server IP port | Checkbox | IP address returned by the Server is exposed as an input port when checked. This is only relevant if the Modbus Definition is configured for TCP/IP transport |
Show server ID | Checkbox | ID returned by the Server is exposed as an input port when checked. Mostly relevant to Serial transport, however is passed through when using TCP/IP |
Block Signals
Output Ports
Port | Comments/Description |
---|---|
Status | scalar uint8 and shows the current status of the Response |
Age | Number of times this block has executed without a response having been received. Ie, when Age = 0 a response has been received and output data is new. This port is visible when enabled in the mask |
IP Address | Vector of 4 uint8 values that form the IP Address of the remote Server |
ID | Scalar uint8 that defines the Server Unit Identifier |
Data | Data returned in the response. The data type is dependent on the Function Type chosen, and the can be a scalar or a vector depending on the Number of Parameter. This port is shown only for Read Function types. |