By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

How to Fix Negative Values (Garbage Values) Returned by PLC Data Tags

In this troubleshooting guide, you will learn how to solve the problem of negative values (garbage values) returned by PLC data tags. This issue can occur when extracting data from a PLC, such as a Mitsubishi, and the extraction program assumes the value is signed when it is actually unsigned.

How to Fix Negative Values (Garbage Values) Returned by PLC Data Tags

When extracting data from a PLC, you may encounter negative values (garbage values) when the extraction program assumes the value is signed, when it is actually unsigned. This issue can cause problems with your application and prevent it from functioning properly. In this guide, we will provide step-by-step instructions on how to fix negative values (garbage values) returned by PLC data tags.

Instructions

  1. Verify the issue by comparing the given value from the PLC with the display on the HMI.

Option 1: Signed/Unsigned

Option a) Change the extraction program to use the correct method signed or unsigned. You can use online tools to convert between unsigned and signed values.

Option b) Alternatively, correct it by adding 127 or 32768 to the value.

Option 2: Endianness

  • Change the extraction program to use a different method, such as big-endian or little-endian. Endianness refers to the order in which the bytes of a multi-byte value like an integer should be interpreted.
  • To solve this, google for your programming language and "convert big-endian to little-endian" or a similar query.

Read next

Share, Engage, and Contribute!

Discover how you can share your ideas, contribute to our blog, and connect with us on other platforms.