If you are struggling to read your own, as well as other substantial ladder diagrams, you are not alone. The truth is, even though ladder logic is a simple and accessible programming language designed for beginners, it can be pretty complicated and hard to understand and read.
That is why some companies or experts consider using Structured Text because they are a better Programmable Logic Controller programming language. Not only that, but people can also learn it a lot easier. In this article, we will take a closer look at the basics of the Structured Text programming language.
It is close to impossible to find the head and tail in a more significant Programmable Logic Controller program that is written in Ladder Logic (LL). That is why what might look like an easy-to-learn method (especially for electricians and technicians), is not always the suitable one to use.
Ladder diagrams that are easy to use for some people might not be that easy for you to use, and vice versa. How can you be sure about that? The answer is, you need to try it for yourself. Take a closer look at a certain LL and see how long it will take for you to understand every nook and cranny of the program. Luckily, there is a better solution for this problem, a better Programmable Controller programming language. It is called a Structured Text.
Visit this site to find out more about Ladder Logic.
Structured Text Programming
This language is text-based, not like the conventional Functional Block Diagram or graphics-based diagram. At first, it seems like a graphical language is the better choice for Programmable Logic Controller programming. But according to experts, it is only accurate for smaller programs.
By using text-based languages, applications will take up a smaller space, and the logic or flow will be a lot easier to understand and read. For instance, people can scale a PLC analog output or input with just one set of alarm or line of code for their Supervisory Control and Data Acquisition system solution.
Another benefit is that people can combine different languages. People can also have function blocks that contain different functions written in a Structured Text. In fact, this system is a standardized language that gives people the option to use different PLC brands using Structured Text. Siemens S7, one of the most common PLC can be programmed using a Structured Text, and people can now use Siemens S7-1200 Starter Kit. It is a great kit to get introduced to the company’s PLC environment.
High-level Computer Languages
If a person is already familiar with languages like Python, C, or PHP, Structured Text will look familiar to them. The syntax of this system is developed to look like the syntax of an excellent language with variables, operators, conditions, and loops.
On the other hand, if a person never saw high-level computer languages, this system can be an excellent introduction to the languages and syntaxes used. It can sometimes be an excellent idea to start with a more straightforward language to know how PLC and logic work. For instance, Siemens LOGO Starter kits are programmable relays with simple visual languages.
Structured Text flow
The first thing people need to know is the syntax or structure of this system. When we understand this structure, we need to see how the system’s flow works. The whole program starts with the PROGRAM, and it ends with END_PROGRAM. Every code in between is the Programmable Controller program.
PROGRAM and END_PROGRAM are the delimiting keywords of the program declarations. Do not be confused with the END_PROGRAM, since the system will not ultimately end here. When PLCs reaches the END_PROGRAM, the controller scans cycle will start from the top, and the system will repeat itself.
It is just like any other PLC language or ladder logic – the system will operate over and over again. If the technician is used to microcontrollers, the END_PROGRAM or PROGRAM will be similar to infinite loops in C language.
Another thing to remember is that, when technicians are using Structured Text, they will usually not used to END_PROGRAM or PROGRAM construct. It will be done by PLC software, and codes they have to write is what they need inside the construct. Flow controls of Programmable Logic Controller programs written in this system are the same as LL: it executes one line at a time.
For more information about this topic, check out websites like https://onlineplcsupport.com/structured-text-rslogix-5000-constructs for more details.
Starting with Structured Text syntax
The syntax of the programming language is usually the definition of how the program is written. To be precise, what symbols are used to give languages its meaning and form. STs are full of semicolons, colons, and other symbols. These symbols have meanings and are used to stand in for something.
These symbols are operators, and some of them are statements, variables, or functions. There are some rules and regulations for the syntax of this system that people need to know. You do not have to memorize every syntax rule if you are a beginner, as you go with your training, you will know these rules little by little.
When users upload the ST system to their Programmable Logic Controller, the software they use will compile their programs. It means that the system will translate codes machine codes that can be performed by the logic controller. The compiler uses the syntax of languages to know and understand the system that was used.
For instance, every time the compiler sees a colon or semicolon, the system will know that the conclusion of the statement is reached. These compilers will read every code until it reaches a colon or semicolon and execute that statement.
In textual languages, users will have the ability to write texts that do not get executed. The feature is used to make different comments in their code. These comments are good. As a beginner, they need to always comment on their codes. It makes it a lot easier to know or understand their codes later. In this system, they can either make one-line comments or make multiple lines.
Using different variables in Structured Texts
If you know other languages, there is a big chance that you know something about variables. Depending on what kind of data people want to store, there are types of data available. The different types of data are called Data Types (obviously!).
For instance, if users have variables where they want to store either FALSE or TRUE, they can declare it as BOOL types. These BOOL types are boolean data types, which means they can contain boolean values like FALSE or TRUE. Now that we know at least two things about variables, they have certain data types and can contain variables of data types.
But there is one more thing users can control their variables – its name. Be cautious that when you are using some systems with a Logic Controller software, some of them do not use END_VAR or VAR until it declares the variables. Instead, these variables use symbols or tags, and even though users are using Structured Texts, they can declare them visually or in function blocks.
Tags, Symbols, or Variables?
One last thing, variables are usually called tags in Programmable Logic Controller programming. With software like Studio 5000 Logix or RSLogix 5000 designed by Allen Bradley, variables are traditionally called tags. But if users are programming in older software, variables are often called symbols. In newer versions of STEP Seven, variables are called tags. But no matter what these are called, they will always have the same features and functions. Standard data types will always be available.