MOV to same register

omniint

Member
Join Date
Apr 2012
Location
San Dimas, CA
Posts
2
A vendor sent an RSLogix 5000 program and it has several MOV commands where the source and destination are exactly the same. Any idea why they would do that?
 
Some thoughts:

  • inline documentation - perhaps to display a value generated in some other part of the program
  • condition math flags - I don't know if CLX does this with a MOV
 
Some thoughts:

  • inline documentation - perhaps to display a value generated in some other part of the program
  • condition math flags - I don't know if CLX does this with a MOV

Those are some proper reasons to do it, I guess the more likely reason is that it was a place holder. Originally that value would have been transferred from one place to another but in the end the programmer didn't need them but forgot to delete them. I know I've just discovered one of those in my own code 15 min ago. Its been there for about 4 years and no one has noticed it!
 
Some thoughts:

  • inline documentation - perhaps to display a value generated in some other part of the program

This was my first thought; I know I've done it just to see a value while online. The other ideas are also perfectly possible.
 
I have run across some high level software that does this. I forgot the name of it but you design your control scheme in that and it will generate code for many different PLC's ie Siemens, Rockwell, ect..
It creates all kinds of strange things like that, I was told it does it because on some processors that is how you publish the data to the outside world.
I worked on one machine that had more of that kind of thing than actual control code.
This was used by a huge multinational equipment manufacturer that waned one control scheme across the globe and product line. So you ended up with massive overkill to turn on one pump. But it made (some) sense if you were controlling an entire mine site.
 
I do that with spare analog inputs - so that if I want to hook a new sensor up, I can see at a glance if it's working without having to drill into the controller tags.

I've also done it on occasion where I just want to be able to see the value of that tag on a particular rung for ease of troubleshooting. An example might be a high level alarm - let's say that somewhere else in the code you have a bit set that warns of a high level. That bit is then used to turn on a siren. It might be helpful to someone looking at the code to be able to see not only that the siren is being turned on because of a high level, but also what that level actually is. So, MOV the level value into itself, and it's visible right there.

Of course, there's the point that this information should be displayed clearly on a HMI or SCADA system - and that's true, but for the purposes of an example it gives you the idea of why it might be done.
 
I use them in setup/configuration routines, so I can see at a glance what all the setup values are.

I've also used them as placeholders to keep them out of the unused tags list....I'm anal about an empty unused tags search. I can't stand seeing someones program with dozens of unused tags.
 
I've also used them as placeholders to keep them out of the unused tags list....I'm anal about an empty unused tags search. I can't stand seeing someones program with dozens of unused tags.

Sounds like you and I would get along :ROFLMAO:
 
I will do that to reserve a files I am going to use later.
Like MOV B100:10 B100:10.
Also keeps the (AB anyway) 'Delete unused Memory' function from deleting it.
 
I usually do that on the first rung to see at a glance the values of some variables, whilst also looking at the code I need to see.
 

Similar Topics

Hello experts. Anyone has any idea how to make BLKMOV execute only once? I have tried with R_TRIG and (P) but it wont write to my location.
Replies
3
Views
179
I've used AOI and User Defined Data Types, but I haven't created one yet. I have a lot of repetitive MOV commands to take a select number of...
Replies
4
Views
363
I'm having to make an AOI to use with a generic ethernet device because the manufacturer does not provide an AOP. I just want to do a sanity check...
Replies
13
Views
1,152
Hello, I'm trying to copy the entire value of a UDT base tag to an element of an array of another UDT containing an element of the first UDT...
Replies
7
Views
1,636
Hi, I would like to move a word to display wind direction. For example: NW, or SE, or ESE in RSLogix 5000, not panelview. I have a wind speed...
Replies
18
Views
5,516
Back
Top Bottom