Modbus Server Definition

This licensed MotoHawk™ block defines Modbus Server (Slave) device for Serial or Ethernet protocol type.

Block ID

Modbus Server Definition

Library

motohawk_modbus_lib/Modbus Server Definition

Description

Licensing

In order for the Woodward Custom Modbus library to be used, the user's MotoHawk security token will need to have the proper license added to it. For instructions on how to accomplish this, please see the instructions for adding the MotoHawk Modbus Library license.

A user can check whether their MotoHawk security token has the needed product license at the Matlab command line by executing the woodward_custom_modbus_check_license command. A returned value of 1 means the MotoHawk Modbus Library is licensed, while a returned value of 0 means it is not.

Overview

Modbus Server Definition defines a Modbus server that provides access to application objects and services remote Modbus clients.

The Modbus Application Data Unit (ADU) is built by a Client (Client) that initiates the Modbus transaction. Function codes inform the Server device on what action to perform. Valid codes are in range of 1..255 (128-255 reserved by exception codes).

The data field sent from a Client (Client) to a Server (Server) contains additional information that the Server uses to take action defined by the function code. This could contain discrete and register addresses, the quantity of items to be handled etc. When Server responds to the Client request it uses the function code field to indicate either a normal (error-free) response or an exception response. For details please go to related Modbus request blocks.

Serial

The address field allows to address up to 247 Servers connected to the same bus. Client initiates only one MODBUS transaction at the same time and Servers will never transmit data without receiving a request from the Client.

The Client issues requests to Servers in two modes:

Unicast Mode (Address 1-247): Client addresses an individual Server. After receiving and processing the request, the Server replies to the Client. This Mode is supported by all functions.

Broadcast Mode (Address 0): Client sends a request to all Servers. No response is returned.

Error checking field is the result of a "Redundancy Checking" calculation that is performed on the message content. The are two kinds of calculation methods which are used depending on the transmission mode being used (RTU : CRC16 or ASCII : LRC). For more information please refer to Modbus over Serial line Specification and implementation guide .

Note: Size of the referenced Serial Definition block queue should be 256B for RTU and 513B for ASCII protocol type. Otherwise it might happen that a long Modbus request is ignored.

Motohawk Serial implementation limits the supported function codes per the table below

Ethernet

The main MODBUS server functions are to wait for a Modbus request on 502 TCP port (configurable through Remote Port parameter), to process this request and then to build a MODBUS response depending on device context.

A Modbus communication requires the establishment of a TCP connection between a Client and a Server. The Modbus server is addressed using its IP address; therefore, the Modbus Unit Identifier will be ignored by this Server implementation.

Motohawk Ethernet implementation limits the supported function codes per the table below

Memory layout

The Server Function Definition block will allow a Server device to define a memory layout with up to 65535 Modbus objects. The Server Function Definition block does not define the data. Instead it allows existing data to be mapped to Modbus functions.

In the example presented below each function type {Coil, Input Register, Discrete Input and Holding Register} has been separated into distinguishable elements within a single memory space that the Client can then access. However, each of those distinguishable elements could also overlay each other. The Server Function Definition block defines a Server's register layout. An exception response will be returned if the Client accesses a Server incorrectly.

Some function types {Input, Discrete} are read only and may not be written.

Block Parameters

Parameter Field Values Comments/Description
Name Single quote enclosed alpha numeric A unqiue, c-legal name that is used by Function Definition blocks to reference this definition.
Adapter definition reference name Single quote enclosed alpha numeric Reference to the adapter definition block. For example the adapter could be a Serial or Ethernet definition.
Adapter type Drop-down list Defines the protocol type (ASCII, RTU, TCP) which implicitly defines the adapter that is needed.
Maximum number of connections 1-16 Shown only for TCP. Defines the maximum number of simultaneous MODBUS requests the Server (Server) can accept.
Remote Port 1-65535 Shown only for TCP. Defines the Ethernet listening port
Server ID* 1-247 Shown only for ASCII or RTU. Defines Server device Modbus address.
Use custom frame timeout Check Box When checked allows to specify a custom RTU frame timeout. This field is visible only for RTU protocol type. If this option is not used, the default timeout is based on baud rate selection: 1750us for baud rates greater than 19200 and 3.5 character time otherwise.
Frame Timeout[us]* 1000-100000 [us] Specifies a custom RTU frame timeout.
Servicing Task Name Single quote enclosed alpha numeric Identifies the task that server servicing will execute in.
When the application does not define its own tasks then use 'BGNDTask', 'FGNDTask' or 'ApplicationInterruptTask'.
Polling Period[ms] Non-zero numeric Specifies the minimum polling rate.
Allow parameters marked with * to be calibrated Check Box (enable) Allows attributes marked with (*) to be calibrated
Read access level 0-8 Sets security level 0 lowest, 8 highest, for user access to read value
Write Access Level 0-8 Sets security level 0 lowest, 8 highest, for user access to write value
Instrumentation Group Alpha-numeric text Determines Folder name and hierarchy. Use "|" character between folder names to delineate subgroup structure