Other Installments in This Series:
- Connect to Device via Programming Computer
- Set Device Boot Settings
- Confirm Hardware Configuration and Activate Configuration
- Activating Licenses
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.
10. Connect to the device via Programming Computer
First, we'll need to check if TwinCAT XAE is able to communicate with the PLC. 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 device. On the programming computer, right-click on the TwinCAT gear icon and select Router > Edit Routes.
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 connections settings.
The most reliable method to find the device is to enter the IP address in the field at the top, then click "Enter Host Name / IP." If the Beckhoff device doesn’t appear, make sure you can ping it (if the firewall pinging rules are enabled) and check your device’s or network’s firewall settings.
Select the device. The most reliable way to add a route is to set the address info to reference the IP address, not the host name. 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 device in the popup and click "Okay." Default credentials for Beckhoff devices 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 S appear under the Connected column in the Add Route Dialog and the TwinCAT Static Routes window. You can exit these windows now.
From within the TwinCAT XAE engineering software, open your project. Then use the target dropdown menu and select "Choose Target System."
In the window that pops up, expand the browser tree and select the Beckhoff device. Click "OK."
If you are prompted to change the solution platform, do so.
11. Set Device 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 will ensure that this project is started automatically on boot of the Beckhoff device.
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.
If you want to enable auto-login for the machine, check the Auto Logon box. Enter the username and password for the device and click Apply to save the boot settings to the device.
12. Confirm Hardware Configuration and Activate Configuration
Next, we will need to activate the Beckhoff device’s configuration. Make sure your IO cards are powered and connected to the PC 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."
Double-click to open the device settings. On the Adapter tab, click "Search..."
The popup 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.
Now you can activate the hardware configuration using the steps icon in the top ribbon:
If the button is greyed out, make sure you have selected the correct target in the TwinCAT XAE software and have a valid route.
Press "OK" when the Activate Configuration confirmation window pops up.
If issues arise during this step, you may need to troubleshoot your specific hardware setup and make sure your TwinCAT project setup matches.
If your Beckhoff device does not have runtime licenses (most likely if you are setting it up for the first time) XAE will prompt you to generate trial licenses. Click "Yes" and follow the prompts. These trial licenses will be replaced by your full licenses (if you have them) in a later step.
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.
13. Activating Licenses
Activating licenses in TwinCAT can be somewhat tricky and this walkthrough will be covering 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 dongle USB or card, it is critical 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. If you’re not using a dongle, you can skip to generating a license request.
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 the dongle isn’t already in your project, you can click the "Add..." button to the right of the dropdown to add it. The dongle will appear in the project tree under License.
After clicking add, the License Device window for the dongle will popup. From here, you can use the "Search in I/O configuration..." or the "Search USB Dongle on Target..." buttons to select the proper dongle from your target Beckhoff Device. To use these buttons, you’ll have to put TwinCAT back into configuration mode, which you can do with the blue gear icon in the engineering environment. Once you’re done selecting the proper dongle, put TwinCAT back into run mode with the green gear icon.
If the dongle doesn’t appear while searching, be sure your IO is configured correctly and the device 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).
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..."
TwinCAT will prompt you to save the license request file somewhere on your computer. Save it, and when the program prompts you to “Send license request to Beckhoff,” select "No" (we’ll do this manually).
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.
Find the license request (*.tclrq) file you just saved on your computer. Open up your email program, and attach this file in an email to email@example.com. Send the email.
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.
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.
Learn more about DMC's Beckhoff expertise and contact us today to get started on your next project.