Training
Do you need personal training for PLC software development in Beckhoff’s TwinCAT 3? We offer courses/training for everything related to TwinCAT 3 (PLC, HMI, Motion, Vision, Safety etc.). For more information, please contact us.
Don’t want to pay for learning PLC-programming? We got you covered. We offer the world’s most popular PLC-programming course entirely for free. No registration. No giving away personal details. No country limitations. Just watch & learn. A total of 13 hours spanning over 20 videos of free training. Click on the images below to get to the equivalent episode.
PLC programming using TwinCAT 3 - Introduction (Part 1/18) Link to heading
Welcome to the PLC programming using TwinCAT 3 course!
This course will give you an introduction to the world of TwinCAT 3 software development. The content of this course will be what I consider the most important parts to know about PLC development in general and TwinCAT development in particular, with a focus on the software development aspects of TwinCAT 3.
Link to heading
PLC programming using TwinCAT 3 - Basics & installation (Part 2/18) Link to heading
Here I will give some background information to PLCs and TwinCAT 3, and describe on a high level how it is working.
We will also download the TwinCAT 3 development environment (XAE) so that we have everything up and set for our first program.
Link to heading
PLC programming using TwinCAT 3 - Tasks, programs & “Hello world” (Part 3/18) Link to heading
In this part we will go through some basics regarding why a standard operating system is not suitable for many of the industrial automation tasks, and why you need something like TwinCAT for certain applications. We will look into how TwinCAT is co-existing next to the operating system and how they co-operate. Next, we will create our first TwinCAT 3 solution and learn how to configure the real-time properties of our project. In order to run any TwinCAT software, we will also need to enable virtualization in the BIOS of the computer, which will be shown. We will briefly look at how licensing works in TwinCAT 3, and after that we will create the classical “Hello world” program, although it will probably be different compared to the conventional programming languages you might have worked with previously.
Link to heading
PLC programming using TwinCAT 3 - Data types & arrays (Part 4/18) Link to heading
In this part we will dive deeper into the various data types that are available in the IEC 61131-3 standard that TwinCAT implements. We’ll also look at pointers and references, and why we would want to use them. After that we will take a look at how to declare and use arrays. We will finish this part by looking at one example of how we can convert one datatype to another.
Link to heading
PLC programming using TwinCAT 3 - Structures & functions (Part 5/18) Link to heading
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!
Link to heading
PLC programming using TwinCAT 3 - Function blocks & interfaces (Part 6a/18) Link to heading
In this part we will start to look into the object oriented programming parts of structured text and IEC 61131-3 called function blocks. 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. In this part we will create our very first function block and add a few methods to it.
Link to heading
PLC programming using TwinCAT 3 - Function blocks & interfaces (Part 6b/18) Link to heading
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.
Link to heading
PLC programming using TwinCAT 3 - Instructions (Part 7/18) Link to heading
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.
Link to heading
PLC programming using TwinCAT 3 - Tc2_Standard (Part 8/18) Link to heading
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.
Link to heading
PLC programming using TwinCAT 3 - TwinCAT utilities (Part 9/18) Link to heading
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).
Link to heading
PLC programming using TwinCAT 3 - IO (Part 10/18) Link to heading
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.
Link to heading
PLC programming using TwinCAT 3 - Libraries (Part 11/18) Link to heading
Once the complexity of your software gets to a certain level it might be a good idea to start to think about splitting the software into different libraries for code re-use. This part will go through how this is accomplished and what you need to think of.
Link to heading
PLC programming using TwinCAT 3 - TwinCAT functions (Part 12/18) Link to heading
When installing the TwinCAT development environment and runtime you get access the core functionality, but sometimes you might want to extend this with additional functionality as for example adding an SQL database connection. In this chapter we will investigate some TwinCAT functions that can be added.
Link to heading
PLC programming using TwinCAT 3 - Version control (Part 13/18) Link to heading
Proper version control is traditionally not done in the world of automation, which is a big shame. The question should not be whether version control should be used or not. The question should instead be what version control system should be used. In this part we will get an introduction to version control in general, and Git in particular. We will start with an introduction to some basic concepts of version control and then show you how you can put your automation projects under version control using Git, using free and open-source tools that are traditionally used in the software industry. You’ll learn how to do proper 100% free and Git-based version control using TwinCAT 3! Let’s start demanding more from our automation vendors and demand that the tooling for version control should be included by default, and get out of the dark ages!
Link to heading
PLC programming using TwinCAT 3 - Handling of different TwinCAT versions (Part 14/18) Link to heading
After working for a few months and years, you’ll will be in a situation where you have to manage several PLCs and machines, and they will all be running different versions of TwinCAT. But we’ve so far only installed one version of TwinCAT on our development machine. What if we want to work with a machine that runs an older or newer version of TwinCAT? This part will go through how this is done.
Link to heading
PLC programming using TwinCAT 3 - ADS (Part 15/18) Link to heading
The Automation Device Specification is Beckhoffs middleware to communicate with Beckhoff PLCs. It’s used for all kinds of use cases, as software deployment, reading/writing of variables and for internal communication of software modules. In this part we’ll go through the theory and also write some C# software to communicate with a PLC. We’ll also do a simple C++ program running under Linux that talks to the PLC!
Link to heading
PLC programming using TwinCAT 3 - TwinCAT automation interface (Part 16/18) Link to heading
Ever wondered what challenges you face if you want to develop PLC software for the worlds largest optical telescope? In this episode we are going to talk about the TwinCAT automation interface, which you can use if you want to automate the configuration, development and deployment process of your PLC software. Simply stated: automate the automation!
Link to heading
PLC programming using TwinCAT 3 - Test driven development (Part 17a/18) Link to heading
TDD is the practice of writing tests before writing the implementation code. Writing software using the practice of TDD is something that has been around in the traditional software development industry for a while, but only recently has gained attention in industrial automation. In this series of videos, we will look at the theory of TDD, and then see how it’s done in practice.
Link to heading
PLC programming using TwinCAT 3 - Test driven development (Part 17b/18) Link to heading
TDD is the practice of writing tests before writing the implementation code. Writing software using the practice of TDD is something that has been around in the traditional software development industry for a while, but only recently has gained attention in industrial automation. In this series of videos, we will look at the theory of TDD, and then see how it’s done in practice.
Link to heading
PLC programming using TwinCAT 3 - Final thoughts (Part 18/18) Link to heading
So we’ve come to an end. For the last two years all my weekends, holidays, summer/winter vacations and basically every free-moment I’ve had, went into the creation of the free “PLC programming using TwinCAT 3” course on YouTube. It’s been the biggest hobby-project I’ve ever commited myself to, and I together with my wife would like to finish by saying a few words.