DMC, Inc.
Beckhoff PLC Programming window

Beckhoff Setup Basics: Getting Started with a Beckhoff PLC

This blog is Part 2 of a multi-part series. Make sure to check out the other blogs on this topic:

  1. Beckhoff Setup Basics: IPC Configuration Steps
  2. Beckhoff Setup Basics: Getting Started with a Beckhoff PLC
  3. Beckhoff Basics: HMI Configuration

Summary

This is the second installment of a three-part blog series covering all you need to know about getting started with a Beckhoff PLC/HMI. In this blog, we’ll be covering how to configure and license the PLC to run your code.

Term Definitions

Throughout this blog series, I refer to two devices repeatedly. For clarity, those devices are as follows:

  1. “Beckhoff IPC” – The hardware, likely obtained from Beckhoff, that will run the PLC and HMI server. Device configuration will occur on this device.
  2. “Programming Computer” – A computer, such as an engineer’s laptop, where the TwinCAT XAE development environment is installed. Programming happens on this device, as well as some of the configuration of the Beckhoff IPC.

Connect to the IPC Via a Programming Computer

First, we’ll need to check if TwinCAT XAE is able to communicate with the IPC. If you’ve done this before, feel free to skip this step.

Next, make sure your programming computer is connected to the Programming Port on the Beckhoff IPC. On the programming computer, right-click on the TwinCAT gear icon and select Router > Edit Routes.

Beckhoff PLC Programming

On the TwinCAT Static Routes popup, select “Add.” The Add Route Dialog will appear. Check the Advanced Settings box at the bottom left to expose the full connection settings.

'Add Route Dialog' Beckhoff PLC programming

The most reliable method to find the IPC is to enter the IP address in the field at the top, then click “Enter Host Name / IP.” If the Beckhoff IPC doesn’t appear, make sure you can ping it (if the firewall pinging rules are enabled) and check your IPC’s or network’s firewall settings.

'Add Route Dialog' Beckhoff PLC programming 'Add Route' button

Select the Beckhoff IPC. The most reliable way to add a route is to set the address info to reference the IP address, not the hostname. This is because many plant networks don’t have DNS set up in such a way that allows access of factory devices via hostname. Select this option, then “Add Route.” Enter the proper credentials for your IPC in the popup and click “Okay.” Default credentials for Beckhoff IPCs are:

  • User: Administrator
  • Password: 1

If you have changed these, use the appropriate credentials. If the connection process succeeds, you should see an X or a small lock appear under the Connected column in the Add Route Dialog and the TwinCAT Static Routes window. You can exit these windows now.

From within TwinCAT XAE Shell, open your project. Then use the target dropdown menu and select “Choose Target System.”

Note: these instructions will show screenshots from 32-bit XAE Shell, but can be followed the same in XAE Shell 64-bit.

TwinCAT XAE Shell

In the window that pops up, expand the browser tree and select the Beckhoff IPC. Click “OK.”

'Choose Target System' Beckhoff IPC

If you are prompted to change the solution platform, do so.

TcXaeShell window 'Yes' button selected

Set IPC Boot Settings

Before the TwinCAT project can be downloaded to the PLC, a few boot settings need to be configured. First, right-click on the PLC project in the solution explorer and make sure “Autostart Boot Project” is checked. This ensures the project starts automatically when the Beckhoff IPC boots.

Beckhoff TwinCAT Solution Explorer

Next, double-click on “SYSTEM” in the solution explorer, then navigate to the Settings tab. Select “Run Mode (Enable)” under Boot Settings (Target). This will make sure the PLC enters run mode on boot.

Beckhoff TwinCAT Solution Explorer Blog Demo

If you want to enable auto-login for the Beckhoff IPC, check the Auto Logon box. Enter the username and password for the IPC and click Apply to save the boot settings to the IPC.

Confirm Hardware Configuration and Activate Configuration

Next, we will need to activate the PLC configuration. Make sure your IO cards are powered and connected to the IPC before continuing with this step.

To do this, first navigate to I/O > Devices > [YourEtherCATMasterDeviceName]. For example, in this project, the EtherCAT Master device is named “Device 1.”

EtherCAT devices

Double-click to open the device settings. On the Adapter tab, click “Search…”

Beckhoff PLC Programming 'Adapter' tab

The pop-up window should include a list of NICs with the TwinCAT RT Ethernet Driver installed. Select the NIC that will be used to connect to IO.

EtherCAT device

If no Ethernet adapters are listed, then please return to the “Install the Beckhoff Real-Time Ethernet Driver” section in Part 1 of this blog series.

If EtherCAT devices are already connected to the PLC, you can add them to the I/O tree by either manually adding the devices in the correct topology or scanning for devices. To scan, right-click the EtherCAT Master and select “Scan.”

Note: Scanning is only possible when the PLC is in Config mode.

EtherCAT device scan

Now you can activate the hardware configuration using the steps icon in the top ribbon:

Beckhoff PLC programming

If the button is grayed out, make sure you have selected the correct target in the TwinCAT XAE software and have a valid route.

When the Activate Configuration confirmation window appears, click “OK.”

If issues arise during this step, you may need to troubleshoot your hardware setup and verify that your TwinCAT project is configured correctly.

If your Beckhoff IPC does not have runtime licenses installed, which is common during an initial setup, TwinCAT XAE will prompt you to generate trial licenses. Click “Yes” and follow the prompts.

If you have purchased full runtime licenses, you can install them in a later step to replace the trial licenses.

Enter the Captcha required for trial licenses.

You can now click the login button to log in to the PLC. Once logged in, you can also click the start button if you need to start the PLC’s runtime.

Beckhoff PLC programming 'Activate Configuration' window
Beckhoff PLC programming trial license window
Beckhoff PLC programming security code

You can now click the login button to log in to the PLC. Once logged in, you can also click the start button if you need to start the PLC’s runtime. 

Activating Licenses

Activating licenses in TwinCAT can be somewhat tricky, and this walkthrough will cover the basics. For further help with licensing, your contact at Beckhoff is a great resource.

First, you’ll need to select the proper license device. If using a USB dongle or card, it is critical that you select the right device before sending your license request file to Beckhoff. License request/response files are tied to device IDs, and so once a request has been sent and a response received, that license can only be used with that device. To change devices, you’ll have to get in touch with Beckhoff headquarters in Germany, and depending on your location, that might take some time. So try to avoid that by getting the license device correct first!

To select the proper device, go to System > License.

Beckhoff PLC programming 'License' menu

If you’re using a dongle and it’s already in the project, you can select it from the License Device dropdown in the “Order Information (Runtime)” tab.

If you are not using a dongle, select Target from the dropdown to bind the licenses to the Beckhoff IPC’s hardware ID. In this case, you can skip the remaining dongle-related steps and proceed directly to generating a license request.

We do recommend the use of a dongle when possible, so the IPC can be replaced without losing licenses.

Beckhoff PLC programming 'License Device' drop down menu

If the dongle is not already configured in your project, click “Add…” to the right of the dropdown to add it. The dongle will then appear under License in the project tree.

After you click “Add…”, the License Device window will open. From here, you can select the appropriate dongle on your target Beckhoff IPC by clicking “Search in I/O Configuration…” or “Search USB Dongle on Target…”.

To use either option, TwinCAT must be in Config mode. You can switch to Config mode by clicking the blue gear icon in the TwinCAT engineering environment. After selecting the correct dongle, return TwinCAT to Run mode by clicking the green gear icon.

Beckhoff PLC programming 'Search in I/O Configuration...'

If the dongle doesn’t appear while searching, be sure your IO is configured correctly and the IPC recognizes the dongle. When the dongle has been selected, the dongle status information should populate.

Now that the dongle is in your project, you can go back to the License window, and you should be able to select it in the license device dropdown. Make sure that when you select it from the dropdown, the system ID changes (indicating the dongle system ID is different from the target system ID). Also ensure the system ID of the dongle is something reasonable (e.g., not a bunch of 0s; this might indicate you’re not communicating properly with the dongle).

If you have multiple license devices (e.g. target and a dongle), a “License Device” column will appear in the table at the bottom of the window. Make sure to select the correct device that you’d like to store each license on (most likely choose the dongle for all licenses).

Beckhoff PLC programming license device identification

Now that we’ve selected the correct license device, we need to generate a license request file. To do this we’ll first need to enter a license ID (provided by your contact at Beckhoff) in the license ID box. You can also enter a customer ID and a comment, but these are optional. Once you’ve entered a license ID, click “Generate File…”.

Beckhoff PLC programming 'Generate File' request

TwinCAT will prompt you to save the license request file to your programming computer. Save the file, then, when prompted to “Send license request to Beckhoff,” select “No”. We’ll send the file manually instead.

Note: This is your last chance to turn back before tying licenses to a device ID! Check over your license hardware setup and make sure everything is in order. If there are problems, regenerate the license file with the corrected settings before sending to Beckhoff.

Locate the license request (*.tclrq) file you just saved. Create a new email, attach the file, and send it to tclicense@beckhoff.com.

Beckhoff PLC programming demo license email example

If everything is set up correctly and your license request is valid, Beckhoff will respond with an automatically generated email that has a license response file (*.tclrs). Save this file to your programming computer.

If the file is not attached to the email, the email will include whatever issues the automated system had with your license request, and you may need to work this out with your Beckhoff contact.

Back in the license window, use the “License Response File” button to select the license response file. For the new license response to take effect, you’ll need to restart TwinCAT on the target, which you can do with the green gear icon.

Beckhoff PLC programming 'License Response File' button

If everything worked properly, the Current Status column in the License window should be green and read valid for every license. You may need to refresh the window (close it and re-open it) to see this status change.

Now that we’ve correctly activated and configured the licenses, we are ready to configure the HMI server, which we cover in part three of this blog series.

Have an upcoming project? DMC can help you get started or take the next step.

Learn more about DMC’s Beckhoff automation expertise and programming and get started modernizing your system today.