RSLogix 500, Ladder Logic Structure, etc

tim_callinan

Member
Join Date
Apr 2012
Location
Annapolis
Posts
59
Hi All,
I have a couple of questions and would appreciate any help from you guys. I've included my rslogix code and a youtube video of our PLC trainer. Im going to be teaching a class with some PLCs in it this fall and am trying to study up on PLCs as much as possible.
My first question is on PLC structure or programming style. I wrote the ladder logic in a very sequential way - each rung has a progress or completion bit that gets latched once the line has completed.- and then it moves onto the next line. (If you have a look in the code it should make sense.) Is this the best way or method to program the system in the video??
http://www.youtube.com/watch?v=Ds1nYcDOR18

My second question is the entire sequence starts once the 'start button' is pressed. I need this system to start and then cycle unless the stop button is pressed.

Hopefully I've made some sense. Any help would be appreciated.
Thanks,
Tim
 
Is this the best way or method to program the system in the video??
There are MANY ways to program this, and everyone has their own preference, so 'best' is a relative term... ;)

I will say that it is VERY easy to follow your logic, so that's a big plus!

One thing I'll mention is the way you have implemented the stop button. Having it just kill everything is probably not the 'best' approach. Try pushing it as the arm is rotating out towards the release position and you'll see what I mean. The part will probably fly off!... :ROFLMAO:

I need this system to start and then cycle unless the stop button is pressed.
Try using the start and stop buttons to seal-in an 'automatic cycle' bit, use THAT bit in place of your 'Start Button' in rung 0, and eliminate the last rung. Since the 'automatic cycle' bit will remain ON until stop is pressed, your cycle will repeat.

🍻

-Eric
 
Thanks for that Eric. Thats a big help. I will try that tomorrow for sure. I feel like i need a method to unlatch all the outputs and the binary memory locations. I learnt that the hard way after many hours of wondering why the binary bit were set at the start of the program. Appreciate the help.
Tim
 
I feel like i need a method to unlatch all the outputs and the binary memory locations.
Well, you don't necessarily have to use OTL and OTU (especially on physical outputs). If you search for 'sequencer' on the forum, you will find many other methods... :site:

🍻

-ERic
 
You can program a sequence that way. What I like to do is have each "step" in the sequence look at an index register to be a certain value. And when that step completes have it increment the register to the next step. The advantage is if the sequence gets stuck somewhere, no matter where I am in the program just about I can see what step it's stuck on and go right to that part of the program. For a simple application like yours, it's probably not really enough logic to warrant that, but in larger applications where there are dozens of steps, it really helps.
 
That is quite true; it can be programmed in many ways. I have a simple one
1. Use a flip-flop circuit, whose starting input shall be your start button and the cylinder position on read swich-1.
2. By using the initial condition of read switch and start button set a bit for auto cycle.
3. This auto cycle bit will set/activate output-1, with a delay(if required) and move the cylinder to read switch-2
4. As it reaches to Switch-2, this will reset the initial/ previous condition and reset output-1 and set next condition(bit)
5. You can use a timer here for a pause(OTL)
6. Use this condition to set output-2, this will move the cylinder to opposite direction back to read switch-1. Now reset output -2 and bit and initiate back the previous condition.
7. To stop the process reset the auto bit by stop button. However, remember with every stop sequence the cylinder must retract back to read switch -1, followed by auto bit reset sequence. This will help you to start every time from the initial condition.
8. For safety include some monitoring time as the cylinder moves in either direction, in case it fails to reach any of the switches it shall terminate the sequence and reset all the conditions.
 
Last edited:
As an example of a "Sequencer" type control, take a look at the file I made from yours.... again, this is just one way of skinning this cat....

Notice how I have segregated the "sequence" or "Procedural Control" from the "Equipment Control". This is good practice, especially as it makes the sequencer easier to follow.

One big advantage of this type of control is that it is much easier to see how it relates to the functional specification.

In my example I have let the sequencer run to the end of its "one-piece" cycle if the stop button is pressed, but you could easily modify it to just stop the sequencer where it is, so that a subsequent re-start will continue from where it left off.

In the real-world, and in a more complex machine, it would be worth considering a sequencer for each action - i.e. in this example one for the eject cylinder, and one for the pick and place arm, although I do not see it being needed here as the swinging arm is so slow in comparison to the ejector.

Providing separate sequencers would allow the next part to be ready in place for the swing arm to just keep going without waiting for the ejector to do its job. If you did decide this was a valid route to go, you interface the sequencers simply by their step numbers.

The sequence control logic is a separate piece of code, so that it can be copied/pasted for other sequences.
 
In your original file, rung 0004 you have an unlatch O:0.1, and then you move 0 into O:0.0 which does the same thing.

It's Deja Vu all over again.
Yogi Berra
 
In your original file, rung 0004 you have an unlatch O:0.1, and then you move 0 into O:0.0 which does the same thing.
Just to clarify, the O:0.1 above should read O:0/1 (or O:0.0/1), meaning the bit, not the word.

I'm guessing the unlatch was used at first, and the MOV was added later on, once Tim realized that he needed to reset all the bits.

🍻

-Eric
 
Thank you for all your replies. I've been spending the last few days trying to figure out your advice.
Daba - Thank you for putting that program together. I've been studying it, there is alot going on for me but I'll keep at it. I dont think im ready to program a sequencer just yet.

I've been spending alot of time time trying to get the Seal-in circuit working. It works fine, just pressing start and it does each line by line but when you try and loop it - it goes a little crazy and different rungs start fighting one another. This is why i included alot of Unlatch position commands.

Anyhow I basically need some way to figure how to get from line 6 back to line 1. I'm pulling my hair with this one.
Thank you again for all your help.
Tim
 
Thank you for all your replies. I've been spending the last few days trying to figure out your advice.
Daba - Thank you for putting that program together. I've been studying it, there is alot going on for me but I'll keep at it. I dont think im ready to program a sequencer just yet.

I've been spending alot of time time trying to get the Seal-in circuit working. It works fine, just pressing start and it does each line by line but when you try and loop it - it goes a little crazy and different rungs start fighting one another. This is why i included alot of Unlatch position commands.

Anyhow I basically need some way to figure how to get from line 6 back to line 1. I'm pulling my hair with this one.
Thank you again for all your help.
Tim

IMHO the numerical sequencer is much much easier to program, monitor, debug, modify etc. Once you have got the sequencer control logic sorted (stepping on, step timer, start/stop control, it's a fit it and forget it piece of code, and you can concentrate on the actual sequence steps, (which are just
checking off what the functional spec says is supposed to happen). The outputs control logic makes things happen dependant on step numbers.

I'm totally convinced that you will have far greater success in your project and your teachings, (not to mention keeping your hair!), if you were to spend the time analysing and implementing a numerical sequencer, along the lines of the simple one I posted back to you.

One of the greatest features of the numerical sequencer is that it can only ever be on one step at a time, whereas a wayward bit left on in the logic you have can cause havoc. As the programs get larger, and start to include jumps and diversions, you will be writing a lot of OTU's just to kill the bits you don't want. Since an integer data-table location can only hold one integer, using it as a "step-number" or "step-index" completely automates the process of "being on only one step at a time".

Anyway, in your latest code you have used a lot of "nested" branches... meaning that you are starting another branch on an existing branch. While this is acceptable, and will work, it is untidy, uses more instructions, wastes memory, and executes slower. Consider the ASCII mnemonics for rung 3, it contains 19 instructions....

XIC B3:0/1 XIC I:0.0/1 BST OTL O:0.0/3 NXB BST OTL O:0.0/1 NXB BST OTU O:0.0/4 NXB BST OTL B3:0/2 NXB OTU B3:0/1 BND BND BND BND

Now, if you were to use the "Extend Branch Down" facility, the rung reduces to...

XIC B3:0/1 XIC I:0.0/1 BST OTL O:0.0/3 NXB OTL O:0.0/1 NXB OTU O:0.0/4 NXB OTL B3:0/2 NXB OTU B3:0/1 BND

...which removes 6 BST and BND instructions from the code, quite a considerable saving..
 
Last edited:
Just wanted to thank you Daba - I got my initial program cycling. I understand the difference between nested and extended branches now.
I'm still working on your sequencing program but thanks again.
 

Similar Topics

So I very much new to doing ladder coding I have a pump with a Stop float switch that stops the pump when a sump is low. I want my manual run mode...
Replies
13
Views
1,393
How can I achieve the same functionality in Studio 5000? Image 001.png for the old RSLogix500 program Image 002.png for conversion to Studio...
Replies
6
Views
2,524
I had an idea to improve some of my standard programs, and make them easier to modify/expand in the future. Is there a way to address the current...
Replies
9
Views
3,677
Hello all, I have been in the maintenance field for about six years now, and I work around many machines running with the SLC 5/03 and 5/04. We...
Replies
35
Views
9,036
Hello, I am having some problems and I am wondering if I can get some guidance. I will explain the process I am trying to achieve. I am trying to...
Replies
4
Views
4,107
Back
Top Bottom