Modbus TCP Server Protocol

See also: Ethernet Configuration Overview

 

Using Modbus TCP for OCS to OCS Communication

Comparing Ethernet IP, Modbus TCP & Ethernet Global Data

Modbus Configuration

If Modbus TCP Server protocol will be used in the application, the general OCS configuration must be performed, and Modbus must be enabled.

Note: This is a Built-In (Resident) Industrial Protocol. To enable Modbus protocol, use Cscape Programming Software, to perform the following two steps:

  1. Open the Ethernet LAN1 Configuration dialog (Controller > Hardware Configuration > LAN1/Config), as described in Ethernet Configuration Overview.

  2. Enable Modbus by checking the Modbus Server checkbox in the LAN1 Configuration dialog. No additional configuration is required for Modbus protocol As long as Modbus is enabled, and the OCS has been assigned an IP Address and Net Mask, it will respond to service requests from a Modbus TCP Client.

  3. If there is a need to use Modbus UDP or to change the default Modbus TCP port, or if there needs to be restrictions on Modbus Write Access to this OCS, click on the Configure Selected Protocol button.

  4. To restrict Modbus Write access to this OCS, check the Enable Write Inhibit checkbox. Specify a 1-bit register that, when set high, will not allow the Modbus Client to write data to this OCS. Change the mode to Modbus TCP or Modbus UDP as needed per the Client device. Change the Port used for Modbus communications if the default port 502 is not sufficient.

Modbus Operation

With respect to Modbus TCP Server protocol, the OCS’s behavior depends on whether the OCS is in RUN mode or not. When the OCS is in RUN mode, it responds normally to Modbus TCP Client requests.

When the OCS is not in RUN mode, it still responds to Modbus TCP Client requests, with the following differences:

  1. When a request is received from a Modbus TCP Client to write a block of OCS registers, a reply is sent to the Client, but the data is not written to OCS registers.

  2. When a request is received from a Modbus TCP Client, to read a block of OCS registers, a reply is sent to the Client, but the data returned to the Client is all zeroes.

  3. A Modbus TCP Client can determine if the OCS is RUN mode in either of the following two ways:

    • By reading the OCS Always On register (%S7), which is 1 if the OCS is in RUN mode and 0 if the OCS is not in RUN mode (because of item 2 above).

    • By issuing a Read Exception Status request, which returns an Exception Status of 0 if the OCS is in RUN Mode or 1 if the OCS is not in RUN mode.

  4. When “Write Inhibit” is enabled in the configuration:

    • If the configured register value is “High”, client cannot write any values to the server.

    • If the configured register value is “Low”, client can be enabled to write values to the server.

Return to the TopModbus TCP Server Protocol