Structured Text (ST) Programming – Getting Started
IEC Programming consists out of various language flavours. Apart from the convention LD (Ladder Diagrams) and FB (Function Blocks), there is also the Structured Text (ST) Programming language.
The Following is just a short description of to get started with this line of programming.
Step 1 – Create ST Program section in the Main Project.
After a new project has been created – go to the Navigation pane (on the left) of the GX Works 3 window. Under Program (section) > Scan (execution type program area) > Main (item), right click and select “Add new data”.
Step 2 – Setting up the details of the new data programming section.
Step 3 – Access and preparing the programming window.
The Programming window will open.(If the Programming window does not open automatically, then simply double-click on the Program item under the Main item in the navigator pane, as shown.
Step 4 – The coding process commences and concludes.
In the resultant programming window (ST Mode) – the required lines of programming can now be added for the user-desired predefined logical outcome.
During the typing process – selection windows will appear continuously and progressively. These can be used to make selections such as the variables labels.
Note also that it is imperative he that semi-colons are to be added at the end of each line. (To avoid programming compilation errors.)
Step 5 – Compilation of the ST Program written.
For the finalization of the coding process, the program needs to the converted (compiled) prior to the loading into the PLC. This is done via “Shift+Alt+F4.
Additionally, the compilation process can also be initiated by going the to the Convert Menu and Selecting Rebuild All.
Compilation success is indicated by the programming window changing from grey to white. In the case of error detection in the ST programming code – the errors will be pointed out in the Output Window. It is a requirement the all errors are to be addressed and corrected – prior to continuation of PLC programming (downloading).
Step 6 – Download the ST PLC program to the PLC and test the results.
The uploading and downloading procedure of PLC programs is being discussed on another article in detail.
If the PLC programming response is not acceptable or alterations to the programming code is required to be executed – the above procedure can be used.