RSLogix 500 - Reference Rung Number in Ladder Program?

Tharon

Member
Join Date
Jan 2007
Location
Other
Posts
1,430
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 rung number in a ladder, in the program using RSLogix 500? Rung 0 would have the value 0, Rung 1 = 1, etc.

I thought of using just doing a simple "+1" to an INT on each rung in this particular ladder. But if there was a register or something somewhere that already stored this information it would be simpler.

Just an idea I was toying with for alarm and message organization, and expansion. Not sure if it existed or not. Thanks.
 
Interesting suggestion but I don't think there's a direct answer.

You could assign a integer data file (say N99) for rung indexing. End each rung in your routine with a OTE bit referenced by N99/RungNumber. So rung 20 in your routine would end with an OTE of N99/20. Edit the comment/title and select Attach to Output Address. This will ensure that your comments don't get skewed, as can happen when they are tied to Rung Number.
 
It escapes me why you would want to do this , but keep in mind that Lad 2, Lad 3, Lad 4 etc. can all have rung 0 and so on.
 
It escapes me why you would want to do this , but keep in mind that Lad 2, Lad 3, Lad 4 etc. can all have rung 0 and so on.

The ladder issue wouldn't really matter, because at least from what I understand in RSLogix 500, only one ladder is being scanned at a time, and only one rung, etc.

As for why, it was just an idea I had been playing with to make expansion and modification of an HMI Alarm/Messaging ladder easier.

Basically I have anywhere from 1 to 200+ rungs in a Ladder that move a message number to a file. So under conditions, Rung 0 moves 0 to the INT. Rung 1 moves 1, etc. HMI displays a message based on the number in that file.

All my machines use this same setup for their HMI messages. And sometimes they change or modify a machine so I need to had a few dozen messages. And I like them organized (Statuses, Messages, Warnings, Faults, last one wins sort of thing), so I don't just want to tack them on to the end of the ladder, out of "order". I must go through and change the MOV instruction for each rung after where I insert the new rungs.

It was more just me toying with the idea of an autocorrecting message number move based on the current rung position in the scan. I know I could always increment an INT per rung and reset at the end, but thought if somehow I knew what rung number it was on already, it would be quicker for me to program.
 
Last edited:
It reminds me of my beginnings as a hobbiest programmer. Writing logic for my Atari BASIC module that was self modifying. I could make my program load and run and erase itself or part of itself, or edit itself to change parts of the code at runtime. I got the BSOD many times during my trials long before Windows came along.

I would have to understand the end game in order to propose a method to win.
 
In the end it's likely something that I'd never put in a running machine anyway, since it would likely be something pretty unique and not well know if it did exist. And even the incrementing idea will probably not go anywhere.

I guess I'll just call it me being curious.
 
The ladder issue wouldn't really matter, because at least from what I understand in RSLogix 500, only one ladder is being scanned at a time, and only one rung, etc.

As for why, it was just an idea I had been playing with to make expansion and modification of an HMI Alarm/Messaging ladder easier.

Basically I have anywhere from 1 to 200+ rungs in a Ladder that move a message number to a file. So under conditions, Rung 0 moves 0 to the INT. Rung 1 moves 1, etc. HMI displays a message based on the number in that file.

All my machines use this same setup for their HMI messages. And sometimes they change or modify a machine so I need to had a few dozen messages. And I like them organized (Statuses, Messages, Warnings, Faults, last one wins sort of thing), so I don't just want to tack them on to the end of the ladder, out of "order". I must go through and change the MOV instruction for each rung after where I insert the new rungs.

It was more just me toying with the idea of an autocorrecting message number move based on the current rung position in the scan.
I know I could always increment an INT per rung and reset at the end, but thought if somehow I knew what rung number it was on already, it would be quicker for me to program.

I believe, from what you have said (highlighted above), and of course I may be wrong, that you are expecting each rung of code to wait until it is true or satisfied, before the next rung is executed. PLCs don't work like that.

I can see no justification in trying to store the current rung number for display on a HMI.

Or have I missed what you are trying to achieve ???
 
I believe, from what you have said (highlighted above), and of course I may be wrong, that you are expecting each rung of code to wait until it is true or satisfied, before the next rung is executed. PLCs don't work like that.

I can see no justification in trying to store the current rung number for display on a HMI.

Or have I missed what you are trying to achieve ???

No, you misunderstand me. I understand fully how the PLC scan executes. I wasn't expecting the PLC to "wait".

My idea was to create a parallel branch on each rung that would basically run a second "rung" to just add one to an integer each time. Giving me the 0, 1, 2, 3, etc. sequential number for the MOV command to use, without having to actually go through and type 0, 1, 2, 3, etc. into each MOV.

Then, if I ever added a line, everything would automatically shift without me having to change all 200 lines.

The idea of being able to know the current rung automatically was just for me to get this incrementing 0, 1, 2, 3, number without having to add additional code for it.

So, like right now:

Rung 0 - XIC B3:0/1 MOV 0 N7:0
Rung 1 - XIC B3:0/2 MOV 1 N7:0
Rung 2 - XIC B3:0/3 MOV 2 N7:0
Repeated 200 times.

Pretend that the B3:X/X bits are any combination of conditions to display a message on an HMI using the N7:0 address.

Now, if I want to add a new message to my screen, or remove one, that happens to be in the middle or beginning, I have to either leave things completely out of order due to the number changing, or go through and modify all the numbers so they are sequential again. The former just bothers me because I would end up with a number sequence that is not sequential, the latter being time consuming. But, if that Constant in the MOV instruction on each rung was following the Rung number (either automatically, or through my incrementing branch) then I would not have to change anything but the rungs I am adding or deleting, and everything would shift correctly.

If I'm not explaining it well enough, I can post a snippet of code tomorrow showing what I currently do, and what I'm trying to accomplish. I don't have RSLogix 500 at home.
 

Similar Topics

is it possible to activate cross reference display in the Rslogix 5000 like in this picture?
Replies
3
Views
3,679
Hi Everyone, I am not proficient in RSLogix 500 so I have a question regarding the evaluation of N7:0 data as an input. So as I understand in...
Replies
1
Views
87
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
3
Views
170
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
83
Will someone please convert this logic to pdf?
Replies
2
Views
127
Back
Top Bottom