In this post I’ll discuss the operators ‘AND_THEN’ and ‘OR_ELSE’. Operators which I find really useful from time to time.
Tag: Object Orientated Programming
Instance variables with VAR_INST

Instance variables are available for funtion block methods. Unlike ‘normal’ variable their values are preserved between method calls.
STweep – The formatter for Structured Text

STweep is a formatter for Structured Text integrated in Codesys and TwinCAT. STweep assists in enforcing a consisting code style!
Communicating between Beckhoff controllers part 2: ADS

In part 2 of the series: “Communication between Beckhoff controllers” we discuss the protocol Automation Device Specification or ADS.
Tips and Tricks: Arrays are value types!

In TwinCAT arrays are treated as value types. In this post I show an example of this behavior as well as some alternatives.
Fluent interface in Structured Text

A popular programming design in high level languages as C# is the so-called ‘fluent code’ or ‘fluent interface’. But what is a fluent interface and how can we implement this in Structured Text? In this post I briefly explain what a fluent interface is and give an example of a fluent interface in Structured Text.
The ABSTRACT keyword

It was already available in CODESYS, but with the release of TwinCAT 4024 it’s now available in TwinCAT as well: the ABSTRACT keyword. Abstraction and the use of the abstract keyword is common practice in OOP and many higher level languages as C# support this. It’s often considered as the fourth pillar of OOP. In this post i’ll explain how to use the ABSTRACT keyword in TwinCAT with some practical examples.
The three pillars of OOP – Inheritance

With the object orientated options we’ve got available with IEC 61131-3 last years the time has come to talk about design patterns and best practices in the world of PLC programming. In this series of three posts ‘The three pillars of OOP’ I will explain the concepts of: Encapsulation, Inheritance and Polymorphism with some examples in TwinCAT. This post is about the second pillar ‘Inheritance’.
The three pillars of OOP – Encapsulation

With the object orientated options we’ve got available with IEC 61131-3 last years the time has come to talk about design patterns and best practices in the world of PLC programming. In this series of three posts ‘The three pillars of OOP’ I will explain the concepts of: Encapsulation, Inheritance and Polymorphism with some examples in TwinCAT. This post is about the first pillar ‘Encapsulation’.