Modbus/TCP Server - How to access data

This chapter provides instructions to access data of the WinCC OA Modbus server. In this example the WinCC OA Modbus driver is used to query data. The configuration of other Modbus/TCP clients is analogous.

Configuration of the server project

  1. Add a WCCOAmodsrv manager to the console. Create a new server as well as the appropriate allowed connection for your client. Server and connection of this example were configured as described in the Configuration of the Modbus/TCP server chapter.

  2. Open the Plantmodel Editor and create the necessary view. The view "View_ModServer1" is used and assigned to the server in this example. Create the sub-elements via the "create RTUs" button and add the node "testDP" (with node ID 1 and an assigned data point of type int) to memory area 3.

    The data of testDP in memory area 3 shall be queried by the Modbus/TCP driver.

Configuration of the client project

  1. Add a WCCOAmod manager to the console and configure the driver accordingly (see Configuration of the Modbus/TCP driver). Define the hostname or the IP address of your server including the port (in this example 192.168.34:502). Note that the unit address must match the node ID of RTU 1 (=1).

  2. Open the PARA and add an _address config to a data point of type int. Configure it as follows (see also Defining the peripheral addresses of the Modbus/TCP driver):

    The SPS number must be stated as defined in the driver configuration panel (=1). The element of the CNS view which shall be queried belongs to memory area 3. Therefore it must be accessed via FC4 (read input registers). Refer to Modbus/TCP server details for further information on memory areas and function codes. The reference number corresponds to the node ID of the testDP element (=1). This results in the reference address M.1.4.1

  3. Enable an appropriate poll group and the value of testDP is written on the original value of the result data point.