What to do when PLC’s are returning negative values (garbage values)?
This troubleshooting guide describes how to solve the problem when a PLC data tags return negative values
When extracting data from a PLC, e.g., a Mitsubishi, it can happen that the extraction program assumes the value from the PLC is signed, when it is actually unsigned. This can result in a difference of 127 or 32768. If the difference is something else it can be caused by using different endianness.
To verify this, you should compare the given value from the PLC with the display on the HMI.
Solution #1: signed/unsigned
- You need to either change the extraction program to use the correct method signed or unsigned. Convert between unsigned and signed - Online Tools
- Alternatively, you can correct it by adding 127 or 32768
Solution #2: endianness
- You need to either change the extraction program to do a different method (big-endian, little-endian). Endianness It basically means in which order the bytes of a multi-byte value like an integer should be interpreted. #