RS Logix & SLC 5/03 PROGRAMMING

G

Thread Starter

G. Fry

If I have 2 words of data in the input data area that represents a 32 bit floating value from a different system like a fieldbus network, How do I perform the logic in RS Logix to get the 2 16bit words back into a 32 bit floating point value?
 
I believe if you use the cop command it will work Source is the N file Destination is the Float File and I believe the length is the number of N word you want to copy
 
Greg,

>> If I have 2 words of data in the input data area that represents a 32 bit
>> floating value from a different system like a fieldbus network, How do I
>> perform the logic in RS Logix to get the 2 16bit words back into a 32 bit
>> floating point value?

The simple answer is to use a COP command from the Input file into which your fieldbus module deposited the data, to a Floating Point data file.

For example: COP
Copy File
Source #I:1.10
Dest #F8:0
Length 1

The length is 1 because the destination is one floating-point element; both I:1.10 and I:1.11 will be placed in there. If you're going the other way, the Length is 2.

You want to use a COP instead of a MOV because the COP treats your data like a bit array (which is what you want) and the MOV treats it like an integer number (which could be bad because it might round in some cases).

The sequence your fieldbus receives the 4 bytes that make up this 32-bit Floating Point element (or the sequence it places them in I/O memory) might not be the same as they are stored in the SLC-500 Floating Point data file. I have seen this with some DeviceNet 32-bit floating point data values. The solution in that case was to COPy the Input table to a storage location, perform a byte swap (SWP) instruction on both words, then COPy that result to the Floating Point register you desire. Your fieldbus interface may swap the bytes, or swap the words as well; I couldn't say.

There are a pair of good Knowledgebase documents on AB.COM that might be appropriate to your application; # 11328 addresses byte swapping, and # 13016 addresses the difference between PLC and Logix floating-point representation.

And if you want to review computer science 101 (or your fieldbus does something wierder), here's a tutorial on IEEE 754 single-precision math.

http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
Good luck,

Ken Roach
A-B Seattle
[email protected]
 
HI,

>The simple answer is to use a COP command from the Input file into which your fieldbus module deposited the data, to a Floating Point data file.
>
> For example: COP
> Copy File
> Source #I:1.10
> Dest #F8:0
> Length 1
>
> The length is 1 because the destination is one floating-point element; both I:1.10 and I:1.11 will be placed in there. If you're going the other way, the Length is 2. <

I've no other comment to the last reply before mine...entirely correct...

We use the same method to transfer PLC5 data table values to GMC tables with BXFER and vice versa...and it WORKS !

good luck

REDREV
 
HI,

I've no other comment to the last reply before mine...entirely correct...

We use the same method to transfer PLC5 data table values to GMC tables with BXFER and vice versa...and it WORKS !

good luck

REDREV
 
Top