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.