Skip to content

Example: EK1000 with EL2008 and EL3182

This example builds a complete project: logiccloud switches the 8 outputs of an EL2008 and reads channel 1 of an EL3182 through an EK1000 over UDP. The setup is the one of the logiccloud test with a Beckhoff EK1000 on a Raspberry Pi 4 class device (arm64).

PartValue in this example
logiccloud deviceRaspberry Pi 4, linux/arm64, logiccloud Control 6.92.8 or later, IP address 192.168.3.102
Router192.168.3.1, routes between 192.168.3.0/24 and 192.168.2.0/24
EK1000IP address 192.168.2.110, EtherCAT Open Mode set to UDP
Bus, in wiring orderEK1000, EL2008 (8 digital outputs), EL3182 (2 analog inputs), EL9011 (end cap)
ENI fileexported from the TwinCAT project of this bus

Replace the IP addresses with yours.

Follow Setting up the EK1000:

  1. Set Open Mode to UDP in TwinCAT and export the ENI file (Export Configuration File…).
  2. Shut down the TwinCAT PC or disconnect it from the network, then switch the power of the EK1000 off and on.
  3. On the logiccloud device, check the route: ip route get 192.168.2.110 shows via 192.168.3.1, and ping -c 3 192.168.2.110 gets 3 replies.
  1. Create a project for the platform linux/arm64.
  2. Replace the program my_program with this program. The variables marked { IN } receive the bus inputs, the variables marked { OUT } go to the bus outputs. The HMI variables connect the HMI.
PROGRAM my_program
VAR_INPUT
(* From the EtherCAT bus *)
ek_EomRunning : BOOL { IN }; (* EK1000 Device Inputs / EomRunning 0xF100:01 *)
ek_MasterLock : BOOL { IN }; (* EK1000 Device Inputs / MasterLock 0xF100:02 *)
ai_Underrange : BOOL { IN }; (* EL3182 Ch. 1 AI Inputs / Status__Underrange 0x6000:01 *)
ai_Overrange : BOOL { IN }; (* EL3182 Ch. 1 AI Inputs / Status__Overrange 0x6000:02 *)
ai_Error : BOOL { IN }; (* EL3182 Ch. 1 AI Inputs / Status__Error 0x6000:07 *)
ai_Value : INT { IN }; (* EL3182 Ch. 1 AI Inputs / Value 0x6000:11 *)
(* From the HMI *)
hmi_Relay1 : BOOL { IN HMI };
hmi_Relay2 : BOOL { IN HMI };
hmi_Relay3 : BOOL { IN HMI };
hmi_Relay4 : BOOL { IN HMI };
hmi_Relay5 : BOOL { IN HMI };
hmi_Relay6 : BOOL { IN HMI };
hmi_Relay7 : BOOL { IN HMI };
hmi_Relay8 : BOOL { IN HMI };
END_VAR
VAR_OUTPUT
(* To the EtherCAT bus: EL2008 channels 1 to 8 *)
do_Relay1 : BOOL { OUT }; (* EL2008 Channel 1 / Output 0x7000:01 *)
do_Relay2 : BOOL { OUT }; (* EL2008 Channel 2 / Output 0x7010:01 *)
do_Relay3 : BOOL { OUT }; (* EL2008 Channel 3 / Output 0x7020:01 *)
do_Relay4 : BOOL { OUT }; (* EL2008 Channel 4 / Output 0x7030:01 *)
do_Relay5 : BOOL { OUT }; (* EL2008 Channel 5 / Output 0x7040:01 *)
do_Relay6 : BOOL { OUT }; (* EL2008 Channel 6 / Output 0x7050:01 *)
do_Relay7 : BOOL { OUT }; (* EL2008 Channel 7 / Output 0x7060:01 *)
do_Relay8 : BOOL { OUT }; (* EL2008 Channel 8 / Output 0x7070:01 *)
(* To the HMI *)
hmi_AiValue : INT { OUT HMI };
hmi_AiError : BOOL { OUT HMI };
END_VAR
do_Relay1 := hmi_Relay1;
do_Relay2 := hmi_Relay2;
do_Relay3 := hmi_Relay3;
do_Relay4 := hmi_Relay4;
do_Relay5 := hmi_Relay5;
do_Relay6 := hmi_Relay6;
do_Relay7 := hmi_Relay7;
do_Relay8 := hmi_Relay8;
hmi_AiValue := ai_Value;
hmi_AiError := ai_Error OR ai_Underrange OR ai_Overrange;
END_PROGRAM
  1. Save the program. Open Configurations > my_config > Inputs/Outputs and select Refresh. Expected: 24 variables, among them ek_EomRunning to ai_Value and do_Relay1 to do_Relay8.
  2. Optional: on the HMI page, add 8 toggle buttons for hmi_Relay1 to hmi_Relay8, an output for hmi_AiValue and a state indicator for hmi_AiError.

ai_Value is the raw value of the terminal. For its scaling to a current, see the Beckhoff documentation of the EL3182.

In the project tree, open the menu of the runtime, select Add connection, EtherCAT, Create new, and enter:

TabFieldValue
GeneralConnection nameEK1000 bus (UDP)
GeneralRoleMainDevice: logiccloud runs the EtherCAT segment
BusTransportUDP (EK1000 coupler)
BusHost192.168.2.110
BusPort (default 34980)empty
BusCycle time (ms)10
BusTimeout (ms)50

Select Save.

Open the menu (⋮) of the connection, select Available items, then Import ENI file, and select the exported file.

Expected result: Slaves imported: 3, and a warning that the EL9011 was not imported (it has no EtherCAT slave controller). The devices are:

PositionDeviceProcess data used in this example
1EK1000Device Inputs (0x1A00): EomRunning, MasterLock
2EL2008Channel 1 to Channel 8 (0x1600 to 0x1607): Output
3EL3182Ch. 1 AI Inputs (0x1A00): status bits and Value

The device names come from the ENI file, for example Term 2 (EL2008).

  1. Open EK1000 bus (UDP) Mappings.
  2. Select Advanced fill, tick the 14 variables of the table below, and select Use selected variables. The grid gets one row per variable.
  3. In each row, select the EtherCAT item. The list shows each entry as <position> <device> / <PDO> / <entry> (<index>:<subindex>, <bits> bit, <direction>); type part of it, for example 0x7000:1, to filter. The Type is preset from the entry.
PLC variableEtherCAT item (position, PDO, entry)DirectionType
ek_EomRunning1, 0x1A00 Device Inputs, EomRunning (0xF100:1, 1 bit)InputBool
ek_MasterLock1, 0x1A00 Device Inputs, MasterLock (0xF100:2, 1 bit)InputBool
do_Relay12, 0x1600 Channel 1, Output (0x7000:1, 1 bit)OutputBool
do_Relay2 … do_Relay82, 0x1601 Channel 2 … 0x1607 Channel 8, Output (0x7010:1 … 0x7070:1)OutputBool
ai_Underrange3, 0x1A00 Ch. 1 AI Inputs, Status__Underrange (0x6000:1, 1 bit)InputBool
ai_Overrange3, 0x1A00 Ch. 1 AI Inputs, Status__Overrange (0x6000:2, 1 bit)InputBool
ai_Error3, 0x1A00 Ch. 1 AI Inputs, Status__Error (0x6000:7, 1 bit)InputBool
ai_Value3, 0x1A00 Ch. 1 AI Inputs, Value (0x6000:17, 16 bit)InputInt
  1. Select Save all. Expected: Successfully saved 'EK1000 bus (UDP) Mappings'. The connection now has 14 mappings.

Mappings tab of the example with the 14 mappings

  1. Build the project and deploy the runtime to the device.
  2. Open the log of the EtherCAT connector on the device. Expected lines:
    • EtherCAT scan finished with bus=udp:192.168.2.110:34980 and slaves=3
    • EtherCAT master state with state=OP and slaves=3
  3. Switch hmi_Relay1 on in the HMI or the debug view. Expected: the LED of EL2008 channel 1 lights up.
  4. Change the current on EL3182 channel 1. Expected: ai_Value changes.

If the log shows timeout waiting for reply or Topology mismatch, see Troubleshooting.

To run the same bus over layer 2, set Open Mode of the EK1000 to RAW, cable it to a network interface of the device, and select Layer 2 (network interface) with that interface on the Bus tab. Steps 2, 4, 5 and 6 stay the same; the log shows bus=layer2:<interface>. On a device installed with the Linux installation script, first install the container with the host network: see Layer 2 on a device installed with the Linux script.