TwinCAT3

Dear existing & future PLC software developers, I have published part 11 of my free PLC programming using TwinCAT 3 tutorial.

When you start to develop PLC software and you’ve worked for a few projects, you will come to a point where you will notice that certain parts of the software, like function blocks, will be copied between the projects. You’ll either do it by simple rewriting the same functions or function blocks again, or you will simply copy and paste it from one project to another. Also, once a project gets big enough, you will want to utilize something called libraries. With this we can achieve code re-use.

Read more

If you want to write TwinCAT 3 software and run it, it’s not obvious how to get TwinCAT 3 to run on your desktop machine, be it directly on the machine or inside a virtual machine. The primary reason for this is because TwinCAT 3 is running in something called kernel space. While I was bored recently on a late afternoon, I discovered that Beckhoff had quietly added some files in the TwinCAT 3 folder in one of the newer releases of TwinCAT 3, that might change all of this.

How you may wonder? Let’s find out!

Read more

Dear existing & future PLC software developers, I have published part 10 of my free PLC programming using TwinCAT 3 tutorial.

When designing and building a control system you will eventually want the control system to actuate something, be it a relay, a motor, a pneumatic system or maybe a complete 6-axis robot. To get feedback of the actuation, sensors are needed. In this part we will cover how we communicate with the environment using inputs and outputs.

Read more

One of the things that have annoyed me ever since I started using TwinCAT is the fact that if you create an enumeration, it will automatically have a global scope. It will be accessible from all functions and function blocks. What’s even worse is that if you create a library project with an enumeration and include that library in another project, the enumeration will be visible there, too. This pollutes the namespace by creating unnecessary types. But no more.

Read more

Dear existing & future PLC software developers, I have published part 9 of my free PLC programming using TwinCAT 3 tutorial.
In this part we’ll learn how to use one of the most used Beckhoff libraries for various purposes. We’ll learn how to measure execution time of PLC code, how to use a FIFO buffer and how to combine the power of using a TwinCAT real-time program with an application running in user-space (Windows).

Read more

Dear existing & future PLC software developers, I have published part 8 of my free PLC programming using TwinCAT 3 tutorial.

As TwinCAT 3 conforms to the IEC61131-3 standard, there are certain things it has to be able to do. The Tc2_Standard library has many of the standard IEC functions such as timers and triggers, which we will look into in this part of the tutorial.

Read more

Dear existing & future PLC software developers, I have published part 7 of my free PLC programming using TwinCAT 3 tutorial.

In this part we will go back to basics of IEC 61131-3 and structured text and look into instructions. This will cover IF/ELSE, CASE-switches and FOR/WHILE-loops. We will utilize our knowledge to write a CSV (comma separate value) event logger by using a state machine.

Read more

Dear existing & future PLC software developers, I have published part 6b of my free PLC programming using TwinCAT 3 tutorial.

In this part we will continue our journey of the object oriented features of IEC 61131-3 and look into something called interfaces. Interfaces provide a layer of abstraction so that you can write code that is ignorant of unnecessary details. Interfaces aid you in designing more modular and robust software. With interfaces it’s possible to decouple direct dependencies between objects in your software.

Read more

Dear existing & future PLC software developers, I have published part 6a of my free PLC programming using TwinCAT 3 tutorial.

In this part we will start to look into the object oriented programming parts of structured text and IEC 61131-3 called function blocks, and I think it’s here things are really starting to get fun! For those that are Java, C, C++ or just “traditional” programmers, going into the realm of function blocks is like going from C-style structures and functions, and into classes in C++. With function blocks we can go from working in a procedural style programming into objected oriented style programming.

Read more

Dear existing & future PLC software developers, I have published the 5th part of my free PLC programming using TwinCAT 3 tutorial.

Arrays allow us to define types of variables that can hold several data items of the same kind. In this part of the tutorial we will look at a data unit type that allows us to hold several data items of different kind. We will also look at one of the basis of modularization and re-use in software development called functions. We will look at how we can get data in and out of functions, and we will also look at the difference between passing parameters by value and by reference. We will finish this part by writing our very first function!

Read more