NOP instruction

Any chance the program was wrote in on the other side of the pond? I saw a German program like that before
Wish I could say that it wasn't the controls department for the company I work at here in the Chicago area! I am not in that department but have some programming experience from years ago...just trying to see if they know what they are talking about.🍻
 
Any chance the program was wrote in on the other side of the pond? I saw a German program like that before
Wish I could say that it wasn't the controls department for the company I work at here in the Chicago area! I am not in that department but have some programming experience from years ago...just trying to see if they know what they are talking about.🍻
 
NOP Instruction Execution Time - Is It Worth The Time?

If the No Operation (NOP) instruction has no operation, then why does it have an execution time?

Can its execution really impact upon the scan time in any meaningful way?

Some insight...

The execution time of a standard instruction is made up of a couple of actions:

1. If the preceding rung logic is true, the rung-condition-in is set true - this is time interval 1.

2. Next, the instruction itself is evaluated - this time interval 2.

3. Then, the rung-condition-out is set true - this is time interval 3.

The sum of the 3 time intervals gives you the overall instruction execution time.

For the No Operation (NOP) instruction, as there is no operation, there is no evaluation time for the instruction itself. The execution time listed for the NOP refers only to its rung-condition-in and rung-condition-out being set when the preceding rung condition is true, as is the case for a rung with only a NOP instruction.

Each instructions listed execution time includes the rung-condition-in and rung-condition-out portion of the entire execution of that instruction.

The speed of setting the rung-condition-in and -out is dependant on the processor and its firmware version. In some cases, which version of RSLogix 5000 is used can vary the speed because the version of software determines the version of firmware used in the processor. So, and while negligible for the NOP, it can vary from processor family to processor family, or processor to processor within a family, as can many of the instructions execution times.

AustralIan said:
...In a 1756-L73 it is listed as 0.01uS...

...

jtteresinski said:
...Per NOP rung?...

...

jtteresinski said:
AB CompactLogix...

The execution time for a NOP instruction in a ControlLogix 1756-L73 is indeed 0.01uS for all recent firmware versions up to v21, as it is for all of the newer 5370 CompactLogix processors. However, it can vary from 0.01uS to 0.04uS for the older CompactLogix, depending on which processor and which version of firmware i.e. RSLogix 5000.

jtteresinski said:
...Does the NOP instruction add to scan time? Looking at a program that has several hundred NOP instructions on their own rung.

Even though the rung-condition setting is extremely fast, it does have a bearing on each instructions execution time, and hence, a cumulative affect on the overall execution time of the program i.e. scan time. This is why there is a listed execution time for the NOP instruction. Using many of them in a program does affect the scan time, but, could they have a detrimental affect?

Let's get some perspective here while assuming the 0.01uS execution time for a NOP...

uS = microsecond
mS = millisecond

1uS = 0.001mS

Or...

1,000uS = 1mS

0.01uS = 0.00001mS

Or...

100,000 x 0.01uS = 1mS

Or...

100,000 x NOP = 1mS on scan time

50,000 x NOP = 0.5mS on scan time

25,000 x NOP = 0.25mS on scan time

2,500 x NOP = 0.025mS on scan time

1,000 x NOP = 0.01mS on scan time

So, if your "several hundred NOP instructions" add up to 1,000, you will be impacting on the scan time in the order of a hundredth of a millisecond.

I am not saying this is, or is not, a detrimental affect on the scan time. I'll let you decide that for your self.

Regards,
George
 
I've had customers ask me for a single rung that showed various permissives all in one place. So we used the NOP as the output and had seven or eight conditions lined up as the inputs. When one permissive wasn't true they could cross reference it and jump directly to that section of code. Worked great. The rung didn't actually do anything. In fact, it could even be located in a subroutine that was never called so it wouldn't affect scan time. We didn't do that, but we could have.

In some instances I view the NOP as temporary (placeholder). It's there until I replace it later with actual code. It's not actually ever meant to be in a running program.

But, on the other hand, it could be used as I described or as previously mentioned, it is a great way to just break up the logic with a otherwise empty rung that can have documentation attached to it. Which of course, would be in the final program.

OG
 
If the No Operation (NOP) instruction has no operation, then why does it have an execution time?

Because it is an instruction that is included in most processors (for good reason). You see them quite often as a way of creating a known delay so that your CPU doesn't overrun other events.

Now, why Rockwell includes it in their compiled code to the CPU instead of stripping it out beforehand, is an entirely different question. I'm not sure what the benefit would be to us.

From the Wiki:

Some computer instruction sets include an instruction whose explicit purpose is to not change the state of any of the programmer-accessible registers, status flags, or memory and which may require a specific number of clock cycles to execute. In other instruction sets, a NOP has to be simulated by executing an instruction having operands that cause the same effect (e.g., on the SPARC processor, the instruction sethi 0, %g0 is the recommended solution).

A NOP is most commonly used for timing purposes, to force memory alignment, to prevent hazards, to occupy a branch delay slot, or as a place-holder to be replaced by active instructions later on in program development (or to replace removed instructions when refactoring would be problematic or time-consuming). In some cases, a NOP can have minor side effects; for example, on the Motorola 68000 series of processors, the NOP opcode causes a synchronization of the pipeline.[1]

http://en.wikipedia.org/wiki/NOP
 
If the No Operation (NOP) instruction has no operation, then why does it have an execution time?

Can its execution really impact upon the scan time in any meaningful way?

............

I am not saying this is, or is not, a detrimental affect on the scan time. I'll let you decide that for your self.

Regards,
George

You cannot get away from the fact that having NOP instructions in the code must have a detrimental effect on the scan time. It certainly can't be improved by putting them in.

Having said that, the instructions execution time must be the fastest (at 0.01uS) in the whole instruction set, so having them in a project, if they aid readability, or allow the attachment of documentation, may well outweigh the disadvantage of the slight scan time increase.

Also be aware that putting a NOP on a branch to short a conditional will also add BST (Branch Start) and BND (Branch End) instructions, and the execution times of those need to be taken into account.
 
daba said:
You cannot get away from the fact that having NOP instructions in the code must have a detrimental effect on the scan time. It certainly can't be improved by putting them in...

daba,

Consider the weight of the word detrimental. I chose it for a reason...

The NOP indeed has an inevitable effect on the scan time, but so what? Does it matter? Is it detrimental to the running system or not? Only the person designing or editing a system can decide that.

Detrimental implies a bad, adverse, undesirable or counterproductive effect. If you add anything to a program that increases the scan time, it has an effect, yes, but it does not necessarily make it a detrimental effect. An adverse effect that will impact on the running machine or process to the point where it may be considered undesirable or unjustifiable to leave in. The scan time is increased for every instruction or rung of logic you add as you program. Do you think as you go, hmm this programming is detrimentally effecting my program? In most cases, you would not. Instead you are aware it is having an effect. At what point adding to your program becomes detrimental to the scan time, and hence the process, you will decide, depending on a specification you may be working to, or a calculated maximum scan time, etc. A program may have oodles of scan time to play with. Adding a NOP, or anything else here is not necessarily detrimental.

daba said:
...Having said that, the instructions execution time must be the fastest (at 0.01uS) in the whole instruction set, so having them in a project, if they aid readability, or allow the attachment of documentation, may well outweigh the disadvantage of the slight scan time increase...

If a slight scan time increase from using NOPs is not having a detrimental effect, then of course, NOP away.

More simply put - It is not detrimental until it is creating a problem.

I was not being smart at the end of my first post when I said I'd let the OP decide for themselves. I don't know their application. The NOPs could be creating a tipping point. Probably unlikely, but still, not for me to say.

Regards,
George
 
...The NOPs could be creating a tipping point. Probably unlikely, but still, not for me to say.

What is interesting to me, even with the incredible speed of the modern processor, Rockwell can only execute 100,000 of these instructions per second. Really, really, slow. I wonder what else is going on?
 
rootboy said:
...Rockwell can only execute 100,000 of these instructions per second. Really, really, slow...

rootboy,

Perhaps you've misread the figures?

Geospark said:
uS = microsecond
mS = millisecond

1uS = 0.001mS

Or...

1,000uS = 1mS

0.01uS = 0.00001mS

Or...

100,000 x 0.01uS = 1mS

Or...

100,000 x NOP = 1mS on scan time

50,000 x NOP = 0.5mS on scan time

25,000 x NOP = 0.25mS on scan time

2,500 x NOP = 0.025mS on scan time

1,000 x NOP = 0.01mS on scan time

The Logix processors execute 100,000 NOP per millisecond, not second. As a millisecond is one thousandth of a second, they can execute...

100,000 x 1,000 = 100,000,000 NOP per second.

That's one hundred million NOP per second.

You might still think this is slow, I don't know? I'm just pointing out that you are off by quite a bit with your numbers, and so perhaps your thinking?

Regards,
George
 
NOP = No Operation. It's a means of inserting a rung of code with no output instruction (OTE, MOV, COP, et al). As mentioned, it's usually used to break up a section of code, usually with a rung comment attached to it. Can also be used as a placeholder for future code. And lastly, it's good practice if you have an empty subroutine to at least have a rung with a NOP. RS has a bit of a 'feature/bug' that when you create a new routine, it'll compile unless you open the routine. Then it creates an empty rung that won't compile. You can delete the empty rung and compile, but next time you open the routine again, it will recreate the empty rung. For that purpose, it's usually wise to put a single rung with NOP in an empty routine. Of course if you can, don't leave empty routines, but often it's practical to create routines for future code/features.

they are also a great way to have a diagnostic status rung for critical bits you want to see at a glance, or settings bits.
 

Similar Topics

Is there an equivalent Rockwell PLC NOP instruction that is available for the M340 M580 Schneider PLC? Thanks,
Replies
10
Views
2,724
Good evening , I was looking thru some Rockwell Automation programs , and took notice in some programs , UDT’s , AOI’s , etc. the NOP...
Replies
13
Views
3,185
Hi guys! I was wondering why I've seen some guys put a lot of NOP in their STL code. For example: CALL FC4 NOP 0 What is the purpose of this...
Replies
12
Views
3,649
I have read the Instruction help on this. I am still not clear or sure on why this would even be used. I see this a lot on Rung 0 inside of the...
Replies
5
Views
4,496
Anyone know if there is an equivalent to the NOP instruction in Logix 500? I like to use them in my Logix 5000 for program organization and...
Replies
3
Views
4,441
Back
Top Bottom