Knowledge Base / Legacy Products / Rockwell In-chassis / SLC / 3150 Series

How do I deal with an unsigned integer in an SLC, PLC5, or MicroLogix processor?

Search KB

Catégories

Scenario: A device that uses an INT value to represent a range of 0 to 65535, but in the processor the INT tag has a range of -32768 to 32767.

Since the A/B processor does not have an unsigned Integer data type, you will need to convert this value to represent the full range. Simply take your data value and do a masked move (MVM) into a float tag. Your mask will be 16#7FFF. This will move the least significant 15 bits into the Float tag. Then if bit 15 is set within your original INT tag, add 32768 to the Float tag. This will allow the value to display with a range of 0 to 65535.