This document shows several programming examples in Structured Text ST language using CODESYS.
As one of the IEC-61131 PLC programming languages, Structured Text or simply ST is based on and resembles traditional programming languages such as Pascal or Java
Like all programming languages, Structured Text has advantages and disadvantages, but if we focus on the advantages here are some:
No prior PLC programming knowledge is needed
As Structured Text is similar to traditional high-level programming languages, it can be quite easy for many people who have no prior PLC programming knowledge but do have experience in traditional coding to learn and develop PLC projects.
Some programming software (including CODESY) allows programming in Ladder Language (LD) and Block Integration Language (ST)
ST is a lightweight programming language
Since Structured Text is by definition text-based, it means that it does not have a memory-hungry graphical interface, which allows for smaller processor memory and therefore lower costs.
ST is text-based
In most cases, you can also develop your structured text PLC programming project without using PLC programming software. Since it is text-based, you can write your project in a simple text file and copy and paste it into your PLC project when you are ready.
Examples shown are AND/OR, IF conditions, CASE, comparison elements, calculations, WHILE loop, REPEAT loop, , FOR loop, inserting TON timers
As a final example, it is shown how to perform a traffic light control using Structured Text Language (ST) in CODESYS