EtherCAT Master PLC - CODESYS

The CODESYS software from https://de.codesys.com/ is a powerful and simple-to-use choice for running PLC software without special hardware requirements. Therefore, it can be easily used for establishing a network communication to GOAL network stacks.

Table of content

Requirements

 

CODESYS example Project

This CODESYS PLC project is designed to work with GOAL EtherCAT application 01_simple_io.

Initial Setup and configuration

Open the windows properties for interface of choice and disable all options except NPCAP.

 

  • Run CODESYS Control Win V3 - x64 SysTray and choose Run PLC from the symbol menu

  • Run CODESYS Control Win V3 - x64 and choose Run Gateway from the symbol menu

  • The red element on the symbol signs active software.

Gateway and PLC in RUN mode
  • start CODESYS V3.5 SP16 Patch 4 and open the provided example project from above.

  • choose Tools->Device Repositority… and Install (1) the xml file of the GOAL device, which is located at the platform specific edt directory at projects/goal_ecat*/<sample project>/. Afterwards, it is available in the list of Installed Device Descriptions (2)

 

  • choose device configuration (1) and Scan Network (2) for detecting the local PLC (3) after confirming the controller by OK, the state switches from grey to green (4)

  • Open EtherCAT_Master configuration (1) and Browse… (2) the network port on your local machine.

  • update the slave (1) by searching the previously imported xml description in the list and confirm via Update Device.

  • Open the Slave configuration (1) and choose EtherCAT I/O Mapping (2) to map the PLC variables to IOs (3) as listed in table below.

Variable

Description

Variable

Description

Application.PLC_PRG.applVarU32Output

applVarU32Output

Application.PLC_PRG.applVarU8Output

applU8LedOutput

Application.PLC_PRG.applVarU32Input

applVarU32Input

Application.PLC_PRG.applVarU8Input

applU8ButtonInput

(Optional) Enabling Distributed Clocks

  • Open the General tab (1) in the slave configuration and select Expert settings (2). Confirm that Distributed Clock is enabled and DC-Synchron (3)

 

Running PLC software

  • Build (1) the PLC software and Login (2) afterwards.

  • Confirm requests about performing a download resp. Login with download if PLC program is already running.

Open the PLC_PRG (1) and start it by clicking the left symbol (2). The connection will be established, exchanging application data (3).