Unsigned data in tag

Hello!

I have some 2bytes unsigned OPC items, I have tried some posibilities in order to represent them in Ignition but I could not get it because when bit 16 is 1 the tag shows a negative value.

Is there any option to obtain unsigned values from the OPC?

Thanks!

[quote=“eyudes”]Hello!

I have some 2bytes unsigned OPC items, I have tried some posibilities in order to represent them in Ignition but I could not get it because when bit 16 is 1 the tag shows a negative value.

Is there any option to obtain unsigned values from the OPC?

Thanks![/quote]Can you reconfigure your data source? When the OPC server reports them as unsigned, Ignition will automatically upgrade the register width on its side to accommodate the unsigned value. If that isn’t possible, just add 2^16 to your value when the high bit is on. An expression tag can do that.if({tag}<0, {tag}+65536, {tag})There are more efficient expressions, but that is the easiest to read.

Thank you pturmel for your reply.

I cannot modify the source but to resolve the problem I have done something similar to your recommendation using mask in python (int & 0xffff). It solves the problem.

Thanks!