You are here: Start » Application Notes » Interfacing Zebra 4Sight computer (Modbus TCP - Client) to Aurora Vision Studio

Interfacing Zebra 4Sight computer (Modbus TCP - Client) to Aurora Vision Studio

Purpose and equipment

This document explains how to configure Modbus TCP PLC with Aurora Vision Studio using Zebra 4Sight computer. In this setup, the Zebra 4Sight computer running Aurora Vision Studio acts as a Modbus Client (Master), while the PLC acts as a Modbus Server (Slave).

Required equipment:

  • 4Sight computer (used 4Sight XV7);
  • Siemens S7-1200 PLC;
  • Ethernet switch with at least 3 In/Outs might be useful - simplifies configuration;
  • PC with TIA Portal V19 (for PLC configuration);
  • Aurora Vision Studio 5.7 or later (version 5.7 used).

Application notes demonstrates configuration steps for specific 4sight model, but it is not obligatory to use this one. If you have different model, please refer to manuals provided by its manufacturer.

Hardware connection

In application notes there is configured one network which uses Ethernet switch. Devices connected to this network have addresses 192.168.1.XXX, where XXX stands for number 1-254 unique for every device/port connected.

In Zebra 4Sight manual it is mentioned that PLC Software should not be installed on Z4Sight PC. Taking this into account, we have one PLC and two computers in our network: Before proceeding to the further point, make sure that all devices are powered up.

Configuring AIL on Zebra 4Sight

Before creating the application in Aurora Vision Studio, the Modbus Client service must be enabled in the AIL configuration.

  1. Open the AILConfig application on the Z4Sight computer.
  2. In the left pane, navigate to Communication -> Modbus.
  3. Add a new instance. Set parameters:
    • Name: Modbus1
    • Type: tcp
    • Mode: client
    • Interface: any
  4. Save the configuration

Aurora Vision Studio application

The application utilizes dedicated Aurora Imaging Library Modbus filters to read and write holding registers and coils.

  1. Inside the Main macrofilter, go to the ACQUIRE section and add a Loop filter to keep the task running continuously.
  2. In the PROCESS section, create a new Task Macrofilter named MainLoop. Add four macrofilter inputs:

    • inDeviceID of type AILSystemAndDeviceIdentifier*
    • inInstanceName of type String*
    • inSeverID of type Integer*
    • inServerAddress of type String*

    Set the inInstanceName value to match the AILConfig setup (Modbus1) and the inServerAddress to the address of the PLC (192.168.1.1).

  3. Open the MainLoop macrofilter. In the ACQUIRE section, add the Loop filter. Set its inDelay input to the desired polling rate (e.g., 500 ms) to regulate the communication frequency.
  4. In the PROCESS section, add the AILSystem_Modbus_Client_ReadDiscreteInputs filter. Link the inDeviceID, inInstanceName, inSeverID and inServerAddress from the macrofilter inputs. Set inOffset to 0 and the inCount to 4. Present the outValues in the Preview window.
  5. Add the AILSystem_Modbus_Client_ReadHoldingRegisters_uint16 filter. Link the inDeviceID, inInstanceName, inSeverID and inServerAddress from the macrofilter inputs. Set inOffset to 0 and inCount to 4. Present the outValues in the Preview window.
  6. Add the AILSystem_Modbus_Client_WriteCoils filter. Link the inDeviceID, inInstanceName, inSeverID and inServerAddress from the macrofilter inputs. Set inOffset to 0 and the inValues to {False;False;True;True}.
  7. Add the AILSystem_Modbus_Client_WriteHoldingRegisters_uint16 filter. Link the inDeviceID, inInstanceName, inSeverID and inServerAddress from the macrofilter inputs. Set inOffset to 8 and the inValues to {12;54;78;96}.
  8. In the Project Explorer, right-click on the MainLoop macrofilter block, select Add New Error Handler, and choose IO_ERROR.

Configuring PLC in TIA Portal

Note:Aurora Vision Studio (and the Modbus protocol standard) transmits data in Big-Endian format. Siemens S7-1200 PLCs store data in Little-Endian format. A byte-swap conversion will be required on the PLC side to interpret the values correctly.
  1. Device Configuration

    After adding the S7-1200 PLC to the project, apply the following settings in the Properties tab:

    • PROFINET interface [X1]: Set the appropriate IP address and add/setup the Subnet. Ensure it is in the same subnet as the Z4Sight computer.

    • System and clock memory: Check Enable the use of system memory byte and Enable the use of clock memory byte.

    • Access level: Set to Full access (no password).

    • Connection mechanisms: Check Permit access with PUT/GET communication from remote partner and uncheck Only allow secure PG/PC and HMI communication.

  2. Creating Data Blocks

    Two Data Blocks are required to manage the data arrays and the connection parameters:

    • BUFF [DB1] - it holds the raw Modbus arrays and the processed (byte-swapped) arrays.
      1. Define the following variables:
        • DATA of type Array[1..100] of Word (Raw data received from AVS)
        • DATA_SEND of type Array[1..100] of Word (Raw data to be sent to AVS)

      2. Right-click the block, go to Properties -> Attributes, and uncheck the Optimize block access option. This is mandatory to expose absolute addressing.

    • BUFF_CLEAN [DB4] - it holds the processed (byte-swapped) arrays.
      1. Define the following variables:
        • DATA of type Array[1..100] of Word (Raw data received from AVS)
        • DATA_SEND of type Array[1..100] of Word (Raw data to be sent to AVS)

      2. Right-click the block, go to Properties -> Attributes, and uncheck the Optimize block access option. This is mandatory to expose absolute addressing.
    • MBConfig [DB2] - it stores the connection parameters and status flags for both the read and write operations. Set their Start values as follows:
      1. CONNECT of type TCON_IP_v4:
        • InterfaceId: 64
        • ConnectionType: 11
        • RemoteAddress: 192.168.1.50 (IP address of the Z4Sight computer)
        • LocalPort: 502
        • ID: 1.
      2. Add Bool flags: NDR, DR, ERROR.
      3. Add STATE of type Word.

  3. Main Logic [OB1]

    Create structure as showed in images below:



When monitoring values in the TIA Portal Watch Table, always refer to the BUFF_CLEAN arrays to see the correct decimal values.