Support Forums
AB Negative Integer Error

So trying to read values out of an INT table from a PLC5. The positive values all read fine but if we try to read a negative integer value we get the wrong data in VT, usually a value of 6553. To get around this we just did a MOV from INT to a FLT and it reads fine again.

What would be the limitation of reading negative integer values?

So trying to read values out of an INT table from a PLC5. The positive values all read fine but if we try to read a negative integer value we get the wrong data in VT, usually a value of 6553. To get around this we just did a MOV from INT to a FLT and it reads fine again. What would be the limitation of reading negative integer values?

Have you reviewed the options to interrupt the value ready by each tag by using a data suffix after the address? You can read about that in our help files here: https://www.vtscada.com/help/Content/D_Tags/Dev_DataSuffixesForTagIO.htm

Note that some drives get this automatically from the device but that is not the case for many common protocols such as Modbus.

Have you reviewed the options to interrupt the value ready by each tag by using a data suffix after the address? You can read about that in our help files here: https://www.vtscada.com/help/Content/D_Tags/Dev_DataSuffixesForTagIO.htm Note that some drives get this automatically from the device but that is not the case for many common protocols such as Modbus.

Trihedral Engineering Ltd.

Thanks Dave,

I should have been more specific in my original post. I am using the AB DF1 Driver. And I can pull N28:171 just fine (as it is a positive value) but when I try to read N28:169 it just garbage values (because it's a negative integer). I also didn't need to add /AB5Float to any float values in the application. The only data that doesn't work is a negative Nxx value.

Thanks Dave, I should have been more specific in my original post. I am using the AB DF1 Driver. And I can pull N28:171 just fine (as it is a positive value) but when I try to read N28:169 it just garbage values (because it's a negative integer). I also didn't need to add /AB5Float to any float values in the application. The only data that doesn't work is a negative Nxx value.

You've probably already looked at this, but you might want to check your scaling settings to ensure that you have set accommodations for the sign bit. IE: (0000 0000 0000 0000 a 16-bit integer where the MSB is the sign bit and the range is now -32767 to +32767 rather than0 to 65535)

In the case above, you'll want your unscaled value range to be -32767 to 32767 and the scaled range to be whatever should be represented by the values. See below for an example I just did for a positive and negative integer value from a Micro 850 PLC where my scaled values go from -100 to 100 (the tag output also is not an integer). Does this make sense?

60ba3c0869e44

You've probably already looked at this, but you might want to check your scaling settings to ensure that you have set accommodations for the sign bit. IE: (**0**000 0000 0000 0000 a 16-bit integer where the MSB is the sign bit and the range is now ````-32767 to +32767```` rather than````0 to 65535````) In the case above, you'll want your unscaled value range to be -32767 to 32767 and the scaled range to be whatever should be represented by the values. See below for an example I just did for a positive and negative integer value from a Micro 850 PLC where my scaled values go from -100 to 100 (the tag output also is not an integer). Does this make sense? ![60ba3c0869e44](serve/attachment&path=60ba3c0869e44)

Trihedral Engineering Ltd.

Yup, tried that exact setup. Which shouldn't even be needed because we aren't reading the raw analog input value, we're already reading the scaled value in the Nx table, but either way, it didn't work. We did get it working by moving the INT to a FLT and reading that, was just curious if there was a way where we didn't have to move any negative INTs to FLTs.

Thank you for the help though Dave!

Yup, tried that exact setup. Which shouldn't even be needed because we aren't reading the raw analog input value, we're already reading the scaled value in the Nx table, but either way, it didn't work. We did get it working by moving the INT to a FLT and reading that, was just curious if there was a way where we didn't have to move any negative INTs to FLTs. Thank you for the help though Dave!

Use '/SWord' as the address suffix. It let's VT know that bit 15 is a sign bit.

Use '/SWord' as the address suffix. It let's VT know that bit 15 is a sign bit.
87
5
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft