Access Level: TechConnect Date Created: 09/20/2000 10:09 AM Last Updated: 02/18/2013 11:14 PM
How do I convert floating-point or REAL datatypes into integers and then back again with PLC5, SLC, ControlLogix, FlexLogix and CompactLogix?
I. Subject
IEEE single precision floating point specification for the PLC5, SLC, ControlLogix, FlexLogix, and CompactLogix platforms and the important differences when manipulating this data type. (F8:0 and REAL datatypes).
The PLC5 or SLC will take the 32-bits and place the raw bit pattern into two consecutive integers. In the above rung, the data arrives in N9:0 and N9:1. N9:0 contains the sign bit. Note: The first word has the sign bit. Conversely, if we use the following rung:
The PLC5 or SLC will reassemble the raw bit pattern back into a floating point element for use. The PLC5 and SLC both perform this function in the same manner. For example, you can convert to integers, send these integers to the SLC, then convert them back in the SLC and get the correct starting value. This is NOT true when sending this data to devices based on the ControlLogix platform.
then everything is swapped and no extra action is required). Note: The second word has the sign bit.
V. Possible Issues
Based on item IV above, one can run into problems when exchanging the Raw data between a PLC5-SLC system, and the ControlLogix-based products. For normal operations, just exchange floating point data and REAL data directly and do not convert into the Raw data first. The problem may arise for those products that only provide this Raw data back to the processor. This includes, but is not limited to some motion products, PowerMonitors, and all Remote I/O PanelViews sending float data. The PowerMonitors provide Raw data formatted for PLC-SLCs.
VI. Solutions
When using a device such as a PowerMonitor in a ControlLogix, FlexLogix or CompactLogix system, it is necessary to swap the two integers for each parameter before executing the the data back into a REAL data type.