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

I’m currently doing a YouTube tutorial called “PLC programming using TwinCAT 3“, which is one of the biggest hobby projects I’ve ever committed myself to. When I started with the tutorial I had a gut-feeling that it would probably take a huge amount of time to pull this one off. Initially, I guessed I would have to spend around five minutes of work for every minute of produced movie (ratio of 5:1). Now that I’ve done a couple of videos and actually clocked the time it takes all I can say is that ….boy, was I completely off with that guess! Lately I have been receiving many e-mails and messages with the question “When is the next part of the tutorial coming out?”. Instead of just providing the boring and generic answer “When it’s finished” I have decided that I will instead try to explain what it takes to do a YouTube video, and why I am not releasing a video every week.

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

I have reached 1000 subscribers on YouTube! I never thought I’d get anywhere close to this huge amount of subscribers, especially not this fast! Since I published the first episodes of the “PLC programming using TwinCAT 3 tutorial” in the beginning of March on YouTube, the channel has received over 30.000 views. It seems free PLC programming tutorials are appreciated. It’s time to celebrate and answer some questions that I’ve got from you viewers!

 

Read more

The user base for TcUnit, the free open-source PLC/TwinCAT unit testing framework, has grown enormously. Current estimates are that there are over 100 installations of TcUnit worldwide. Running an open-source project has for some moments taken all my spare-time to maintain the framework, and answer all the questions from the users (I’ve added an FAQ since). The most asked-for functionality of TcUnit that was missing was the possibility to run unit tests in a sequence/in order. Up to now, all tests defined in TcUnit were running in parallel, while in many use cases it was desirable to run the tests in sequence. Thanks to several fantastic contributors from the TcUnit community on GitHub, this is now available in TcUnit starting from version 1.2.

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

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

In this video we will look into the various data types that are available in the IEC 61131-3 standard, pointers & references and how to work with arrays. We will cover why pointers can be dangerous and why you generally want to prefer to use references instead. Then we will finish the tutorial by looking at how we can convert between different data types. Also, what is the relationship between the amount of stars in the universe and TwinCAT? Watch the video to learn!

Read more

When I started out with TwinCAT programming some time ago, I had basically not heard about PLCs. My background was not even close to automation, mostly doing C/C++ on various Linux-based systems. I had two friends which previously were doing a little automation, and both of them said “Don’t start working with PLCs. It’s boring“. Now that I’ve dabbled in “traditional IT” software development and industrial automation software development, I definitely don’t agree with the latter being boring. Industrial automation using PC-based control is insanely fun! At my first job where they used “this thing called TwinCAT” (which was unknown to me at that time), I did what I usually do: I started googling stuff like “free TwinCAT tutorial, how to program with TwinCAT, free TwinCAT course, TwinCAT open source” and so forth. I didn’t find much on Google or in any other of the places I usually used to learn a new programming language (forums, stack overflow, open source projects, etc). The amount of free resources was very limited. After having my TwinCAT blog for a few years, I even got an (anonymous) message via the contact form on my blog from someone saying that I’m an idiot that shares information and knowledge for free, and that nothing should be done for free and that I should basically stop writing my blog. For these reasons, I decided to do a free TwinCAT 3 tutorial.

Read more