RSLogix Instruction Enquiry

IdealDan

Member
Join Date
May 2017
Location
MA
Posts
480
Hi Friends,

1. What does NOP (no operation) Instruction really do in a rung?
2. What does an AFI (Always False) Instruction placed before an XIC Instruction do?
3. What real life Programming senerio would require a bit shift Instruction?

Thanks in advance.
Regards
 
Yes bro, you're absolute correct but for NOP for instance, help info says both when enabled and desabled, the instruction performs no operation, I really want to know why Programmers usually put NOP on the first Rung in a subroutine?
I also want to know why SBR, RET, input Par is used when a JSR with routine name can solve this.
Please I will appreciate your inputs
Regards.
 
Why I have a NOP in the first rung.
In the old Logix 5 program, you had a choice, insert new ladder, or append new ladder. So if you were on rung 1 and insert would be the new rung 1. With the new software it is always appended, you don't have any options. It make's it difficult to configure a new rung-1. With the first rung doing nothing, I can add a new rung just underneath, and it is now the first rung with logic.

Some folks put a NOP rung as a separator between similar objects. If you had a routine for "valves", you might put a NOP rung with description between the valves logic groups.
 
Last edited:
Interesting,
For AFI (Always False) coming first in a rung then followed by an XIC that triggers an OTE for alarm output, (all in one rung).
What could the AFI be doing on this rung please?
 
AFI's "Always False Instruction" prevents a rung from evaluating. In your example, the AFI prevents that alarm bit from ever being evaluated as true. The programmer has essentially turned of that alarm.
 
AFI's "Always False Instruction" prevents a rung from evaluating. In your example, the AFI prevents that alarm bit from ever being evaluated as true. The programmer has essentially turned of that alarm.

That is incorrect, an AFI does not ".. prevent a rung from evaluating" at all.

The rung after the AFI is still "evaluated", but the "Rung Logic Continuity" is now set to "False", so instructions that follow are "evaluated" with their "Enable-In" false.

A lot of people have the misconception that an AFI stops the rest of the rung being scanned, that is simply not the case.

Put an AFI in front of a Timer-On (TON), for example, and the timer will get reset, because its "Enable-In" is false.

Put an AFI in front of a Timer-Off (TOF), and you will start it timing !!
 
Awesome explanations, thanks.
One more thing please, why do we have to use SBR/RET/Input Par, when a simple JSR with just the Routine name can handle a Call up?
 
Awesome explanations, thanks.
One more thing please, why do we have to use SBR/RET/Input Par, when a simple JSR with just the Routine name can handle a Call up?

You don’t have to use any of those extras. I suspect they appear by default so people know they’re there. You can click on the parameter options and remove them, simply leaving only a JSR.
 
AFI's and NOP's can also be effectively used during troubleshooting and evaluating portions of a program being tested.

An AFI in front of a MOV block would allow the programmer to see the values in the source tag and destination tag without actually executing the MOV.

if you're looking at the status of multiple bits, you can add a rung, fill it with XIC's of the bits you want to monitor, then put a NOP at the end to satisfy the compiler without actually doing anything.

If you have a rung that you want to temporarily disable, (but don't want to remove) you can add an AFI in series, then when you want to reenable it, simply delete the AFI.
 
AFI's and NOP's can also be effectively used during troubleshooting and evaluating portions of a program being tested.

An AFI in front of a MOV block would allow the programmer to see the values in the source tag and destination tag without actually executing the MOV.

if you're looking at the status of multiple bits, you can add a rung, fill it with XIC's of the bits you want to monitor, then put a NOP at the end to satisfy the compiler without actually doing anything.

If you have a rung that you want to temporarily disable, (but don't want to remove) you can add an AFI in series, then when you want to reenable it, simply delete the AFI.
Nice explanations.
Thanks.
 
IdealDan > One more thing please, why do we have to use SBR/RET/Input Par, when a simple JSR with just the Routine name can handle a Call up?


Not too sure about PLC's . . .
But as I recall in the programming world a 'JSR - Jump to Subroutine' is where
the program leaves where it is and goes to execute a different block of code -
perhaps a function or a subroutine. When the function or subroutine finishes
it ends with a 'RET' or 'return' which automatically sends the program counter
back to where it started.

If one 'hard-codes' a JSR at the end of the subroutine then it will only return to
the place the JSR sends it. But, a 'nice function' might be called from several
different places and it needs to go back to where it came from. Hence the 'RET'
which I assume means 'Return' - to the code that sent it.

Poet.
 
IdealDan > One more thing please, why do we have to use SBR/RET/Input Par, when a simple JSR with just the Routine name can handle a Call up?


Not too sure about PLC's . . .
But as I recall in the programming world a 'JSR - Jump to Subroutine' is where
the program leaves where it is and goes to execute a different block of code -
perhaps a function or a subroutine. When the function or subroutine finishes
it ends with a 'RET' or 'return' which automatically sends the program counter
back to where it started.

If one 'hard-codes' a JSR at the end of the subroutine then it will only return to
the place the JSR sends it. But, a 'nice function' might be called from several
different places and it needs to go back to where it came from. Hence the 'RET'
which I assume means 'Return' - to the code that sent it.

Poet.
Interesting Bro,
If a JSR call a subroutin from the MAIN without using a RET at the end of that particular subroutine.
Won't the execution return to the next JSR called subroutine at the Main Routine?
 

Similar Topics

I'm trying to fix a mess of code on an older machine that's running a Micrologix 1400 and an RS232 ASCII barcode scanner. The previous guy had...
Replies
3
Views
306
Hey guys, thanks for taking the time to look into my question. I'm building a system to monitor several other systems for faults and one of the...
Replies
17
Views
4,606
I"m trying to average an array of DINT's called FIFO_ARRAY. It has 1000 elements in it. Here is what I have entered into the AVE instruction...
Replies
11
Views
4,641
Hello Please Help, I want to use a FSC instruction that will scan 20 DINT arrays. If the arrays are greater than 1000 display the value. How do I...
Replies
4
Views
1,706
Hi There, When i did FRD instruction in SLC 500 its working, when i try to simulate in RSLogix 5000 same way as i did in SLC 500 which is not...
Replies
14
Views
2,650
Back
Top Bottom