Converting 16 bit unsigned integers to a Floating Point Number For Allen-Bradley SLC500 PLC
![]() |
BACKGROUND
Since the SLC-500 logic platform only stores integers in the 2's complement binary data type, the highest order bit in the data word is reserved to determine the sign of the integer, limiting the maximum read number to 32,767. If data values greater than 32767 are desired a floating point format must be used. Any number with a value between 32768 and 65535 are negative numbers. When they are converted to floating point format they convert as negative numbers. The following
rung of logic will convert a 16 Bit value between 32768 and 65535 to a float.
NOTE: This logic is not supported in the SLC-5/02 or below.
APPLICATION
This application note should be read in conjunction with both the user manual and DF1 Example final application note. These documents provide reference to the implementation of the MSG command if the SLC500 provides is an initiator.
Unlike a MicroLogix, the SLC-500 PLC will not support Long integer data files. The SLC500 integer registers are 16 bit signed (32767 to -32768), the 905U-G-MD1 I/O registers are 16 bit unsigned (0-65535). The 905U-1/905S-1 provides two 4 – 20mA DC analogue inputs, the 905U-2/905S-2 provides six 0 – 20mA DC analogue inputs. As the Elpro analogue scale for 4 – 20mA is 13384 – 49152 (4000h to C000h) and for 0 - 20mA is 8192 – 49152 (2000h to C000h), PLC programming conversion from an unsigned integers to a Floating point number is required within the SLC-500 for the data to be purposeful.
