Blog

TwinCAT Tips and Tricks

TwinCAT 3 Tips & Tricks

Beckhoff TwinCAT 3 XAE is based on Microsoft Visual studio and is seems pretty simple at first glance, but there are many little features that can help make programming more efficient and enjoyable. Here are a few of my favorites.


Tall Cursor

Hold Alt and drag to make the cursor tall and type on many lines at once in the TwinCAT XAE. This also works with copy-pasting blocks of code. 

Tall Cursor in TwinCAT

Bonus – This also works in many other editors, such as Notepad++

Install TwinCAT libraries from the project

When opening Beckhoff TwinCAT projects received from others, often the libraries are not installed on your PC. When this happens, install them from the project file. This works for both Beckhoff libraries and custom libraries, as long as they are in the project file*.

Install TwinCAT libraries

*It’s typically best practice to include complied libraries in the .gitignore file, so often when a project has been stored in source control, the libraries will not be in the TwinCAT project and this option will not be available.


Upload Changes from Beckhoff PLC

If the project running on a TwinCAT PLC has minor changes, it’s not necessary to open the entire TwinCAT project from target again. Instead, Update <project> from Target will pull minor online changes into the project on the programming PC.


Local Enumerations

Enumerations are a great way to keep code clean. Occasionally, it is useful to have a local enumeration for simple instances where adding an enumeration DUT to the entire project could cause clutter. This can be done with local enumerations.

TwinCAT Local Enumerations


Topology View

With some more intricate EtherCAT topologies, it’s not immediately apparent how things are laid out without digging into each card. In the example below, it looks like there is only one IO rack, but in reality, there are two racks and some EP blocks. In order to immediately see the entire layout, use the topology view.

TwinCAT Topology View Button

TwinCAT Topology View


IO Folder View

For complex IO layouts with I’s and Q’s defined in many locations, folder view is a cleaner way to view the Instance.

TwinCAT Enable Folder View

Once enabled, the Inputs and Outputs will be grouped by function block or GVL.

TwinCAT Folder View

 

Using Google to search Infosys

Beckhoff Infosys is the best place to find all TwinCAT information, but the built-in search can often return less-than-relevant results at the top. Instead, type “Beckhoff Infosys <topic>” into Google. This typically brings back more relevant results than Infosys’ built-in search.

Learn more about Maskine’s Beckhoff Programming Services.

Share this post

Leave A Comment

Let's work together to solve your automation problem

Call 480-900-2170