Could you folks explain to me what a NOP instruction is used for in Rockwell Software

Cydog

Member
Join Date
Feb 2018
Location
Maryland
Posts
313
Good evening ,

I was looking thru some Rockwell Automation programs , and took notice in some programs , UDT’s , AOI’s , etc. the NOP instruction .

Could you please explain what the purpose of a NOP instruction is , and why it would be used in a PLC program .

Thanks so much ,
 
It means No Operation. I use it as a placeholder for an output instruction. That allows you to put input instructions on a rung for example without an actual output instruction.
 
I use NOP as a rung comment holder as well, exclusively for commenting on sections of code, rather than a line or two of code.


*********************************
When this baby hits 88 rungs of code you're
going to see some serious stuff
*********************************
-------------------------------------------(NOP)

 
As well as for "header" comments, I also use it for I/O mapping on spare inputs.
Code:
|   Local:1:I.Data.0                                       |
|-------| |------------------------------------------[NOP]-|
Some people just put an OTE with a "spare input" tag, but then you get warnings for duplicate destructive bits, which I try to avoid. Others just put an OTE with the actual input, but I think it's bad practice to write to an input tag, even a spare one. NOP is exactly the right tool for the job, IMO.
 
Not RSL/Studio, but for DirectSoft lines with only a NOP are put in places by programmers for a place to put future rungs.



Easier to online edit a few NOP lines than to create new rungs later.
 
On the subject of curious OP codes, a memory from the dim and distant past comes to mind from the Motorola 6809 instruction set: BNE or "Branch Never". This is a real Op Code but I also recall a few fake ones from those days learning assembly code: BAA "Branch Again and Again" and CRASH "Continue Running After Stop or Halt"

Nick
 
NOPs are also great for a diagnostic type rung at the top to give you an immediate view on the top rung of your High/Low critical bits or settings bits.
 
Functionally, the NOP does nothing whatsoever. As it's name would imply. And the suggestions about using them for documentation and I/O Mapping are all excellent. But I would like to expand a little on jkerekes comment...

Let's say you've got five inputs that are being used to trigger different parts of a process. You want to be able to see the status of those five inputs at a glance. But you've got logic spread out into different routines, and they are wired to different input modules so you don't have an easy way to view those five inputs all at once. A pretty typical scenario.

Let's say we create a subroutine and call it MONITORING or something like that. We don't really need a JSR to call it, but we will add one just to avoid any warning messages. In that subroutine we add something like the example below. Where even though these inputs are used elsewhere to trigger the various steps in my process, here I can see at a glance which ones are active or not active. And while I am using five inputs here, they could actually be any tag.

This logic functionally does nothing, but it helps me see my process. And that, is something.

OG

No Op Example.png
 
A rung of code has to have an "output" type instruction, or it will not be accepted.

Any instruction that is "unconditional", i.e. is not evaluated, but causes an "action" is classed as unconditional.

The NOP instruction is quite simply the fastest (minimal execution time), and cheapest (no operands to act upon) way of "terminating" a rung.

Many many times I will use a NOP on the end of a rung where I have placed XICs of bits in my code that I want to monitor, all in one place. The green highlighting is much easier to interpret than the "Watch" view of a bunch of tags. EDIT : Nova5 and OG got there before me !
 

Similar Topics

Good Evening , We received some new machinery. The machinery has a CompactLogix PLC. I took notice that they have a lot of "Add-On...
Replies
5
Views
2,546
Good Evening , We had a Mettler Toledo Safeline Metal Detector acting unstable last week . We brought Mettler Toledo in to look at it ...
Replies
3
Views
833
Good Evening , I have been asked to do some teaching at a community college for industrial automation for some young adults. I'm thinking 2...
Replies
28
Views
10,872
Hey All, I've got a Sullair LS-16 (V160) compressor with the 3-line Supervisor controller (identical to this...
Replies
9
Views
2,466
Good Morning , I have a lot of projects going on and it seems more helpful to stay in the office and work on multiple things , than run to...
Replies
3
Views
1,481
Back
Top Bottom