[RSLogix 5k] - How do I repeat a simple command?

RJC

Member
Join Date
Mar 2015
Location
US / Canada
Posts
4
Here is the rungs I have made for my school project:

2015_03_19_208_247ab705bbc26410f4cc_1.jpg


Basically I just press an associated Function Key (F1, F2, etc) on the PanelView to increase an Integer by 1 before sending it back to the PanelView's display screen.

All the tags are in order and go from 0 to 9
I would like to clean up the code if I could. . .

Is there a way to do this kind of functionality with less rungs?
I did some digging for a range or length option, but couldn't find anything

---
Other Info:
---

I may also have a follow up question as once an order is filled I need to keep a short history of previous orders

Ultimately I'm trying to avoid 50 separate move commands as I need to shift 9 Integers of data from one row to the next on the PanelView screen
I'd like to keep all the logic on the PLC if I could, but I am using an old Allen Bradley PanelView1000 Color /w Keypad if that comes into play

Talk between the two is being down via block transfer and an RIO card

Thanks ahead of time

-Ryan
 
Welcome to the forum Ryan.

First off, the CPT instruction has a considerable amount of processor overhead. I suggest you use the ADD instruction instead. The CPT instruction is intended for more complex operations where it becomes more efficient because it doesn't require intermediate result storage.

You could use some for/next loops and indirect addressing to loop through testing each button and incrementing the outputs, but it won't save your processor any work and it will add the overhead of looping, in the end it is still going to execute the instructions 50 times. Brute force is what I recommend for novice programmers. Its easy to understand, and maybe 50 rungs sounds like a lot, but it doesn't actually take that much time to cut/paste them in. You'll actually be done in far less time than constructing a for/next loop will take.

Once you enter industry you'll find that Otis on the midnight maintenance shift doesn't understand for/next loops anyways, but he has a good grasp of basic ladder and can use it to help him troubleshoot problems. Its when he doesn't understand what the programmer was doing that the programmer gets a 3:00 AM wake up call followed by a groggy drive to the plant and a day long headache the next day. Trust me, those get old.

If you do want to see how for/next loops are built, you can search the forum. There are many examples, I've posted quite a few myself. But I encourage you to develop the habit of using brute force for short tasks, and 50 rungs is squarely in the short task class.
 
Last edited:
I would like to clean up the code if I could. . .
One thing to consider is what happens if you press 10 times? Do your tags rollover to 0? If not, how does the operator correct mistakes or wrong entries? How do you decrease a number?

Is there a way to do this kind of functionality with less rungs?
You could use indirect addressing (on the input data bit, the ONS, and the Compute), so that you could do all 5 of the shown rungs with only 1 rung.
 
The brute force works, but if I need to make a small change I then need to change 50 rungs.

Do you have any examples of for loops / indirect addressing?
The machines at school were never loaded with the help files.

---

@Lancie1:
It needs to be within the range.
I do have a way of clearing everything in one press using COP since it has a length.

Do you have an example of indirect addressing? I've tried entering range like Bit1[0].[1-9], but it just faults the PLC even though the program verifies.
 
I've tried entering range like Bit1[0].[1-9], but it just faults the PLC even though the program verifies.
Where your [0] and [1-9] are, put in addresses instead. These addresses will be the locations of the numbers to be inserted at that point.

Then you have to set up some way to step through all the possible addresses (For-Next loop, or simply increment by 1 until done).

No, I do not have any examples of indirect addressing for RSLogix 5000.
 
Last edited:
That's fine. . . this is actually a big help to get me started

The book for the class has a big section on indirect addressing so I should be able to figure it out (still looking for loop functions though)

I did get a chance to speak to my instructor and since I put all my variables in order I can just use a blind copy [COP] to move everything at once in the same fashion I used it to return all the data back to defaults zeros.

Thanks again!

---
Edits:
---

CPT changed to ADD function. . . Thanks Tconnlley!
 
Last edited:
Here is a crude example of a loop & indirect addressing. (I only did 2 in this example but it's the same idea.)

Example Ind_Add.jpg
 
I had to increase your count to 3, but the example worked.

Only trouble is the One Shots [ONS] aren't functioning any longer so if I press the button on the PanelView it might add a hundred instead of just 1.

I'm out of time for the day, but when I come back Monday I can pick it up again and hopefully find a work around.

Thanks for the help!
 

Similar Topics

I have a little bit of experience with Allen-Bradley. I have a Micrologix 1500 (RSLogix 500) and a PanelView Plus 7 (FactoryTalk View Studio ME)...
Replies
2
Views
66
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
513
buen dia. tengo una falla al pasar los tags de mi plc SLC 5 0/4 a mi panel me aparece un error Problem writing value " " to item <tag name>...
Replies
1
Views
66
First off, I'm a hobbyist-level programmer, and this program isn't controlling anything anything that could even remotely be considered "life...
Replies
18
Views
502
Back
Top Bottom