RSLogix 5000 – Structured Text Programming Examples

Hi,

I am Shane Welcher and I have put together a few helpful videos to show anyone willing to learn how to program using structured text an easy way to get a base foundation of how things work. I have over 10 years working with Rockwell Automation software which I have seen many different processes of when Rockwell changes their control platform in which I have found that is important to understand the core features of programming to give you the cutting edge of any change that happens.

If you have never done any structured text programming before, maybe you have the base understanding of how the different methods work such as a For Do, While Do, If, Else, Then, Case, or calling a JSR from a structured text program or routine. Understanding this language of RSLogix 5000 is only one of the four ways of programming of what Rockwell Automation offers of their software. RSLogix 5000 structured text is not like standard RSLogix 5000 instruction sets such as ladder logic or function blocks but can be used with any of the other programming types to make a system work better.

Also, a good resource to go to for is from the software developers for Rockwell but I will add that it is a lot of reading just to get the value that I show here but here is the link to Rockwell Automation Structured Text programming.

To cut straight to the chase, let’s get to the videos that I have made for you about structured text programming.

 


RSLogix 5000 Structured Text Example for…If..Then…Else..

In the video below shows one of the five structured text programming, this will be the using the If, Else, Then construct to give the foundation of how to get a base understanding. At the end of the video, I will give you a detailed reason of why I showed the system the way I did and believe me when I say if you want to see more then I will be glad to show you a more advanced method but this video is designed to give a base foundation.

In this video, I show the system being written on a Rslogix 5000 software with an emulation of the process. I chose to use a simple state transition to limit the confusion of the logic theory vs the actual If, Then, Else process which is the major point of the video. When it comes to logical theory, the sky s the limit…..If you can think it logically then you can program it.

I show the use of the watch feature of structured text programming to give you a troubleshooting tool in which to see the tags updating in real time as you are programming it or even if you have an existing machine using structured text.

An Example of this is:

If zzzSubstitute_Me Then zzzInstance_of:= 0;

If zzzSubstitute_Me Then zzzInstance_of:= 1;

If zzzSubstitute_Me Then zzzInstance_of:= 2;

If zzzSubstitute_Me Then zzzInstance_of:= 3;

If zzzSubstitute_Me Then zzzInstance_of:= 4;

If zzzSubstitute_Me Then zzzInstance_of:= 5;

If zzzSubstitute_Me Then zzzInstance_of:= 6;

End_If;

In this example, whatever the value of the zzzSubstitute_Me tag is then the value of the zzzInstance_of tag will change to the corresponding value of the statement.This is again, a very basic example of how this works to give you a base understanding of how the If, Then, Else construct works.


RSLogix 5000 Structured Text Example for a Case Construct

In the video below shows the Case construct, the effort is to give a solid foundation of how to get a base understanding. At the end of the video, there will be a description of what the common uses of a Case construct are done and as always….any question or concerns then please let me know.

After watching the video I want to break down what are some of the common reasons for using a Case construct of a structured text programming in RSlogix 5000. The Case construct is most commonly used for a simple and quick transition between state machine logic functions so with that being said if you have a case of an instance then the routine will quickly shift to whatever the case function is indicating to.

An example of this is:

Case zzzSubstitute_Me of

0: zzzInstance_of:=0;

1: zzzInstance_of:=10;

2: zzzInstance_of:=20;

3: zzzInstance_of:=30;

4: zzzInstance_of:=40;

5: zzzInstance_of:=50;

6: zzzInstance_of:=60;

7: zzzInstance_of:=70;

End_Case;

In this example, if the zzzSubstitute_Me has a value of 2 then the zzzInstance_of would be 20 but at any given time the zzzSubstitute_Me tag changes then the value of the zzzInstance_of tag. This is again, a very basic logic example of how a Case constructs and is meant to give you a base without causing confusion by adding complex logic added to the Case Logic example.


RSLogix 5000 Structured Text – While…Do Function

In the video below shows, the While Do construct, the video breaks down the structure of how a While Do construct should be logically laid out from what is accepted for the RSLogix 5000 software. At the end of the video, there will be a description of what I used for this example of a While Do construct….any question or concerns then please let me know.