Modbus Client Request

This MotoHawk™ block set supports Modbus Client (Master) access.

The Request block is used to send a Function Request to a Modbus Server device.

Block ID

Modbus Client Request

Library

motohawk_modbus_lib/Modbus Client Request

Description

The block face title 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 queues a Modbus request with the supplied input parameters and a configured Function Type on an Adapter defined by a referenced Modbus Client Definition. The system will de-queue and send the queries to the Server at the default RTI tick rate.

The Adapter Type used for communication defines influences the function of the the ID and IP ports.

Serial - The Server device needs to be addressed using the Server ID input port. The Server IP Address input port is ignored and can be disabled using Show Server IP address port parameter.

Ethernet - The Server device needs to be addressed using the Server IP Address input port. Optionally the Server ID input port can be used to provide the Server Unit identifier in case of communication to a MODBUS+ or a MODBUS serial line Server through a gateway between an Ethernet TCP-IP network and a MODBUS serial line. The Server ID input port can be disabled using Show Server ID address port parameter. In this case the 0xFF value will be used as the Unit Identifier.

Unless the request is a broadcast (ID = 0), this block is expected to be paired with a Modbus Client Response block in order to collect the response data. Response data is not available immediately 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.

Click here for example usage

Function Types Available

Function Allowed Transport Comments/Description
Read Coil TCP / Serial Read 1 or more Coils (boolean array)
Read Discrete Input TCP / Serial Read 1 or more Discrete Inputs (boolean array)
Read Holding Register TCP / Serial Read 1 or more Holding Registers (uint16 array)
Read Input Register TCP / Serial Read 1 or more Input Registers (uint16 array)
Write Coil TCP / Serial Write 1 or more Coils (boolean array).
Write Holding Registers TCP / Serial Write 1 or more Holding Registers (uint16 array).
Mask Holding Registers TCP / Serial Set or clear specific bits of a Holding Register (uint16).
Event Count Report Serial Read server Event Counter (uint16)

Output Status

A status value returns the success or failure of the request 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 Request submitted succesfully.
ILLEGAL_FUNCTION 1 Unsupported or illegal Function Type.
ILLEGAL_DATA_ADDR 2 Data address supplied was out of range.
ILLEGAL_DATA_VALUE 3 Data value was out of range.
SYSTEM_ERROR 4 Please report issue to Woodward mcssupport@woodward.com.
ADAPTER_TIMEOUT 5 Either:
- Response data was not received from Server, or
- Data was received, but was not collected by the response block.
LINK_INACTIVE 6 Unable to send request due to an error in the communications link.
INCORRECT_RESPONSE 7 Received data not formed as expected.
OTHER_PROTOCOL_ERROR 8 CRC error or Invalid broadcast addressing

Block Parameters

Parameter Field Values Comments/Description
Name Alpha-numeric text, single-quote enclosed Name of the request. Should be unique and C-legal (no special characters such as spaces, dashes or commas, but underscore allowed).
Modbus Definition Reference Alpha-numeric text, single-quote enclosed Name of the Modbus Client Definition.
Function Type Drop-down list Lists supported functions.
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. The maximum value is shown on the block mask and is defined by the Modbus Protocol.
Show server IP port Checkbox IP address of destination 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 of destination Server is exposed as an input port when checked. The value 255 is used when unchecked. Mostly relevant to Serial transport, however is passed through when using TCP/IP

Block Signals

Input Ports

Port Comments/Description
Address Scalar uint16 which defines a starting address or any read or write
IP Address Vector of 4 uint8 values that form the IPV4 Address of the remote Server
ID Scalar uint8 that defines the Server Unit Identifier
Data Provides the data to be written. 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 Write Function types.

Output Ports

Port Comments/Description
Status scalar uint8 and shows the current status of the request