Skip to content

Sorting by Height with CODESYS OPC UA (SP16 or higher)

Requirements

Downloads

CODESYS OPC UA.zip

Resolving Conflicts with the Local Discovery Server (LDS)

If a Local Discovery Server (LDS) is running on your system, you may need to deactivate it to connect Factory I/O to the CODESYS OPC UA Server. See more here

This sample provides a CODESYS project ready to download to the CODESYS Control Win and control the Sorting by Height (Advanced) scene.

  1. Download the zip archive (top of this page), extract it and open the project in CODESYS.

  2. If prompted to update the project, click on Set all to newest and next on OK

    codesys project update

  3. Right-click on CODESYS Control Win PLC icon (Systray) and select Start PLC.

    codesys control win

  4. Double click on Device (CODESYS Control Win V3) from the Devices panel (1) and click on Scan Network... (2).

    codesys select device

  5. Select the Device displayed in the Gateway-1 and click OK (3). If no device is shown check that you have properly started CODESYS Control Win V3 (step 2).

    CODESYS v3.5 SP17 or later

    If you are using CODESYS v3.5 SP17 or later, once you select the device, it will ask you to log on to the device. If you followed the Setting up CODESYS OPC UA (SP17) or the Setting up CODESYS OPC UA (SP18 or later) tutorial, then you only have to log on, and the communication with Factory I/O should work without any issues. If you don't have a Device User configured, you will need to do so. For that, see points 10 through 15 from either of the above-mentioned tutorials.

  6. Click on Online > Login (Alt+F8). When prompted to download the program to the PLC, click on Yes. Next, click on Debug > Start (F5).

  7. Copy the file Tutorial (CodeSys UA).factoryio to Documents\Factory IO\My Scenes on your computer.

  8. Start Factory I/O, press Ctrl+O and open that scene.

  9. Finally, switch to Run mode.

Resolving Conflicts with the Local Discovery Server (LDS)

If a Local Discovery Server (LDS) is running on your system, you may need to deactivate it to connect Factory I/O to the CODESYS OPC UA Server.

By default, CODESYS uses port 4840 for OPC UA communication. However, this same port is also used by OPC UA Local Discovery Servers (LDS). As a result, when Factory I/O attempts to connect to CODESYS via port 4840, it may instead connect to the LDS service running on your computer. Since the LDS is not an OPC UA server, the connection will fail.

To resolve this issue, disable or uninstall the LDS service on your system:

Open the Services Manager:

  1. Start > Control Panel > System and Security > Administrative Tools > Services

  2. Locate the service named “OPC UA Local Discovery Server”.

  3. Right-click the service and select Stop. Additionally, you should set Sartup type to Manual (Properties) so this problem does not happen again when you reboot your computer.

  4. Confirm the change by clicking OK.