Copy a Integer to a floating point PLC5

o_O
I disagree daba.

If the original data is a IEEE 754 floating point number, passed as a bit for bit copy into two consecutive integers "from somewhere else in controller land", and you use a MOV, you will destroy the data. You need the byte for byte, bit for bit, "image" of that float back, and the destination of the COP provides this handy dandy feature.

One of us misunderstood the OP's question...

Yes, you are right, you can use this technique to "reconstruct" an IEEE float passed into a machine via INTs or DINTs, but I didn't see any reference to another machine being involved.

I just attempted to point out that the internal representation in memory bits is interpreted locally.

Receiving data from another machine requires that you fully understand the formatting of the data structure, in the same way that you must understand how each machine stores data of different data types.
 
I assumed. ; )
since he saw this in working code, that a bit for bit copy was the intended action, which led (lead?) me to again assume
:cough:
that it must be useful as a float, so I jumped to the conclusion that it was probably originated as one.
 
Good call, and I made assumptions too (cough)

OP didn't actually say that COP had been used to copy the data....

Perhaps it was a MOV and then some other code is changing the value, so many things could be going on....

Part of the job, steering people's thoughts.
It is all too easy to make assumptions without seeing the actual code.:p

You would have thought that documentation would have been given to help in the understanding of what appears to be "nonsensical" code....
 

Similar Topics

Productivity3000. I have a 32 bit integer, 1d array that i need converted to a string. The string to array seems to work with the same time type...
Replies
0
Views
2,173
I have a micrologix 1100 and I need to extract characters from a string data type and store the ascii values for each character in an integer type...
Replies
7
Views
13,231
I have 2 7cp476 plcs. How can I copy one of them and install it somewhere else?
Replies
0
Views
74
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
140
Hi everyone I'm in a bit of a conundrum, I've been trying to get this HMI on our machine and I am unable to retrieve it. Device Delta Model...
Replies
10
Views
897
Back
Top Bottom