Structured Text programming has been developed as a more modern PLC programming language.
It is quite similar to languages such as BASIC.
A simple example is shown in Figure.
Figure: An Example of a Structured Text Program
This example uses a PLC memory location i. This memory location is for an integer, as will be explained later in the book.
The first line of the program sets the value to 0. The next line begins a loop, and will be where the loop returns to.
The next line recalls the value in location i, adds 1 to it and returns it to the same location. The next line checks to see if the loop should quit.
If i is greater than or equal to 10, then the loop will quit, otherwise the computer will go back up to the REPEAT statement continue from there.
Each time the program goes through this loop i will increase by 1 until the value reaches 10.