Structured Text Programming

Andreik

Member
Join Date
Mar 2009
Location
Makati City
Posts
80
Good day to all,

I'm a proficient PLC Programmer in the Ladder format. Just recently I'm studying the Structured Text Programming and it's nature is really different. It's like I'm learning back to basics once again.

I already learned how to utilize the Conditional Statements (If, Else, Case, Of etc...) and also the Mathematical functions of ST. However, I'm still wondering how to use the "Timers, Counters, Shift Regs and Difu/Difd" in Structured Text.

Can anyone provide me a reference/manual on how to fully understand the Structured Text Programming? Any help will be appreciated. I'm by the way using Omron's CX-Programmer. Thank you very much,

Sincerely,
Andrei K.
 
Timer and Counter variables are not valid data types in OMRON's structured text programming.
You must create your own timer or counter using structured text statements. These both can use an incrementing method [a = a + 1] and comparison statement IF a = 60 THEN *********!

For a timer use one a structured text External Variables clock pulse bits to trigger your incrementer [ie P_1s will increment every second].

For DIFU/DIFD's and Shift Registers you will also have to construct your own version using ST.

In my experience Structured Text programming is best suited to complex math calculations and string manipulations.
Much easier to develop and understand than ladder.

For everything else I still prefer ladder.
Simpler for other using to comprehend, faster to develop and uses less PLC memory.
If you are intent on using ST then be sure to include clear and concise comments for other users.

o_O
 
Whoah, thank you there. I learned a lot from you. Another thing about "string manipulations" you have indicated. I want to learn a little bit about that. Can you give me an idea? Thanks so much.
 
Andreik, glad to help.

Attached is a very simple example of STRING usage within a Function block.
Note that STRING variables are NOT valid in CP series processors so the attached program is for a CJ1 series.

The program examines the string contained in DM100.
If one of three strings are matched then a unique bit is turned ON.

The first section 'LADDER METHOD' shows how to perform a string comparison in conventional ladder.
The Second section FUNCTION_BLOCK_METHOD performs the same comparison using a FB.
Note that a STRING variable can only be declared as an Internal Variable. To access external data it is necessary to use the AT(Specified Address) in the 'Advanced' setting of the internal variable. In the example the Internal Variable 'String_Data' has the AT set for D100.
Also note that DataType is STRING(10). In this case the program will evaluate a string up to 10 characters long contained in D100-D104.

This example demonstrates just how much easier it is to utilize structured text function blocks vs. conventional ladder when processing STRING data.

Hope this helps. Have fun!

CJ1M using CX Programmer V9.20
 
Oh yes, thank you. I've been wondering how to use these Strings especially with its application to HMI-to-PLC and vice versa. Now I understand how to use the ASCII codes. Thanks so much for the help.
 
Thank you TechEric, I've been compiling Structured Text Manuals to aid me on my studies and I already have manuals from different Brands. Yours will be helpful too. Thank you very much.
 
I find the code rather confusing.

What is wrong with the following code (for a DIFU):

OUT := IN AND NOT IN_PREV;
IN_PREV := IN;
 

Similar Topics

Hello everyone: I have been able to read and write data via canopen interface through ADS read and write functional blocks in Twincat PLC...
Replies
9
Views
4,270
hi, i think this is my first time to use structure text program in OMRON. i use it for make fuzzy logic to control voltage induction generator...
Replies
18
Views
5,759
This question is addressed to those who have ample experience with both LL and ST. I know only ladder logic. I find that many a time it takes...
Replies
32
Views
26,939
Hi all, I am trying to the GX IEC Developer and are trying the ST programming mode. But how do you make a Pulse --|P|-- ?? Does any of you have...
Replies
12
Views
12,528
Hi, I have been working with PLC systems for the past five years, up to now all of my programs have been written in ladder logic. Now I have...
Replies
3
Views
6,410
Back
Top Bottom