RSLogix MOV and COP

MOV will do an implicit type conversion, and can move any numeric type into any other :

MOV F8:1 N7:0

COP will copy a "Number" of source elements, byte for byte, to as many destination elements as necessary.

COP for example can be used to convert floating point, received from a device that sends data in integer format, into an actual float in an SLC/PLC/CLX:

COP N7:0 F8:0 2 Which would do a byte for byte (well, word for word) copy of two N7 elements into a single F8 element.
 
Besides the being able to copy more than a single data point...

(From Instruction Set help [MOV])
Note: If you wish to move one word of data without affecting the math flags, use a Copy (COP) instruction with a length of 1 word instead of the MOV instruction.
Rockwell Software 2005
 
MOV moves value to a register

COP moves bit pattern from one register to another.
Example: COP DINT SINT[0] 4 will distribute bit pattern from 32 bit DINT tag to 4 separate bytes SINT[0]...SINT[3]
 
LOL, clear as mud.

I do not mean to be sarcastic etc. Recently I have been spitting out code like I knew what I was doing. In some situations I choose MOV, in others I use COP.

I am not sure why I use either instruction. I think I take the terms literally to use them but not sure.
 
Last edited:
Peter Nachtwey said:
COP doesn't convert anything. It just copies. We used COP to copy floats into bits.
rdrast possibly didn't use the right words to explain what he was referring to.

For example, the AGA gas flow CAR's (custom application routine) on the PLC5 return all their data into integer data files. Some of the data is floating point. The floating point data, in 32-bit IEEE format, is transferred to two 16-bit words in the integer data file. To view and use the data as a floating point number, you use COP to copy the two 16-bit words into a floating point data file.
 
It is strange, I am aware there are differences but I get lost on the differences.

Its ok though, I will figure it out.
 
First, Ignore the fact that COP lets you manipulate groups of words not just one word to another. This is indeed a difference, but not the important difference. People tend to see this obvious difference and think it is the only difference.

Copy moves the word or words bit by bit into it's destination(s). It will look at all the ones and zeros and bit by bit move them into the destination word. If you copy a REAL into a DINT you do not get the same result as if you moved it. The bits in a REAL are not used the same as in a DINT. Copy simply lays the bits in the order it finds them.

Copy can be used to do some interesting things. You can copy a DINT to a SINT data type and all your bits from that one DINT word get filled into the 4 SINT words 1 bit at a time. The destination always determines the length of a COP instruction. Like Contr Con stated the length would be 4 in this case. I think I have even copied a DINT into a BOOL array before and or vice versa. Copy can do some handy stuff.

Move will do a math conversion and give you the same value in the destination. Move does some backround math you never see. Move operates at the "word level", it moves the words value to it's destination. It will alter the individual bits if needed to maintain the word's value.

Eventually if you are chosing between COP and MOV based only on how many words need manipulated you WILL get in trouble. Unless you are always copying or moving to and from the same data type in which case it does not matter.

Hope that helps a little.

RSL
 
Last edited:
Clear as mud.

I guess I should have stated RSLOGIX500.

I reckon I have to just use them as I have in the past, nothing that was said made any sense.
 
Last edited:
OK - just one more

MOV an Integer (N) to a Float (F) - the PLC would pick up the numeric value as stored in the integer, convert it to be the same number but in the float representation then store it in the float location.

COP an Integer to a Float - the PLC would pick up the literal series of bits which make up the Integer and place them in exactly the same order into the float location without any effot to make sure that they represent the same number when seen as a float.

In a great Science-Fiction novel "A Canticle For Leibowitz" future monks, after a major world war, are preserving the writings of a person they consider to be a Saint. He was an engineer and some of his writing were blueprints. The monks copy them painstakingly drawing the blue background leaving the white lines and even reproducing a coffee mug stain. They are copying the physical representation without any knowledge as to the meaning of the content of the blueprint.

MOV would be if they had understood the thing drawn and transfer its description to another medium. COP is exactly what they are doing, reproducing the exact bit structure without any regard to meaning.
 
I'm just going to repackage stuff that's already been said. I hope it helps.

The single most important difference between MOV and COP is that MOV performs data type conversion and COP does not. This applies to the SLC, PLC5, MicroLogix and ControlLogix equally. The functionality is the same.

As an example, we will use MOV to move F8:0 to N7:0. F8:0 has a value of 5.2. N7:0 will end up with a value of 5. The processor took the floating point value and moved it to the integer data location while converting it from a floating point number (32-bit value with a 24-bit mantissa and an 8-bit exponent) to an integer (16-bit number) and enforcing it's specific rounding rules. If the number wouldn't fit in the integer (like a value of 100,000), the processor will put a specific value in the integer location (I believe in this case it would be 32,767) and set specific status file flags to indicate the value was too big as part of the range checking that comes along with the MOV instruction. MOV works very well if you are either moving values between the same type of data element (integer to integer, float to float, etc) or if you are moving a float that you know will be in a certain range into an integer, for example to display on an HMI.

COP doesn't perform type conversion. So if you always copy source data to like destination data (integer to integer, float to float, etc) then COP is nothing more than a multiple word MOV as far as you are concerned. However, the wild power of COP is when it operates on dissimilar data types. It just takes the byte pattern from the source and copies it into the destination. So after a copy, while source may have made sense before, the destination value may not make sense. Keep in mind that a floating point number is not just an integer with pre-specified formatting. It is a completely different way of representing numbers. So a bit pattern that defines a specific integer will NOT give you the same floating point number but with a moved decimal point.

Data transfers via DeviceNet are a good example of this. As far as DeviceNet is concerned you can only transfer integers. The data just come in in a big block and you need to sort them out. However, some devices, motion controllers for example, may need to transfer floating point data. How does the motion controller transfer the floating point value and how you get this value back on the plc side? The COP command is the easiest way. For example, assume a floating point number is coming into the PLC in the first two integers of a DeviceNet transfer. Keep in mind that the first two integers contain the total bit pattern for the one floating point value you are transferring (16 bits per integer versus 32 bits per float). We will further specify that the DeviceNet data block starts at N7:0 and we want the float to appear in F8:0. If you try to MOV N7:0 to F8:0, all you will get is the integer value in N7:0 as a float in F8:0. We know this can't be right because we know that the true float, being 32 bits, is contained in both N7:0 AND N7:1. So we use COP:

COP(#N7:1, #F8:0, 1)

This will take the byte pattern from N7:0 and N7:1 and copy them directly into the byte locations for F8:0. No type conversion. No range checking. Just a raw byte-for-byte transfer. Most importantly for us we now have the desired byte pattern correctly displayed in a data type we can use.

Like I said, this is just repackaged info from before. If you are not using dissimilar data types in your COP instructions none of this will matter. However, if you are mixing data types you need to know this stuff.

Keith
 
COPY 2 ints to 1 float

I have been trying to do the same thing as this topic discuss. I have 1 floating point from a modbus device that through a redlion data station I am able to get into a PLC5. The floating point is stored in 2 integer files. I need to convert these 2-16 bit int into 1 float. I know I need to copy these into F8:0 but I don't know how to get it to copy 2 int to 1 float. I can only copy it into two seperate floats which then requires a lot of code to offset and convert. Any ideas or examples?

thanks

PS I've also tried to enter what your example discuss

COP (N7:1, F8:0,1) This format doesn't make sense. How do I enter it. Are you trying to say use a
copy statement from N7:1->F8:0 length 1?

That won't work if so & I assume therefore that I am reading it wrong.
thanks again
 
Last edited:

Similar Topics

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,541
Hi All, This topic it is really interesting indeed. Hi have a doubt that is inside this kind of questions: RSLogix 5k V28, 1756-L73CPU value...
Replies
11
Views
2,585
I've done a few AB projects, but have not seen either of the following in a MOV instruction (I can't figure how to take a "snippet" and insert). I...
Replies
9
Views
3,269
Hello All, New kid on block with AB 5000 platform. Using the MOV ( move ) command. I can't get the logic to shift the value of source to...
Replies
11
Views
7,849
Attached is an image of rung 43 on LAD10 of our digester program. In the MOV instruction at the end of the rung, the source address is something...
Replies
13
Views
3,103
Back
Top Bottom