# Unsigned data in tag

**URL:** <https://forum.inductiveautomation.com/t/unsigned-data-in-tag/11857>\
**Category:** Ignition\
**Created:** [June 24, 2016, 7:35am UTC](https://forum.inductiveautomation.com/t/unsigned-data-in-tag/11857 "2016-06-24T07:35:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyudes](https://avatars.discourse-cdn.com/v4/letter/e/9fc29f/32.png) [@eyudes](https://forum.inductiveautomation.com/u/eyudes)\
**Post date:** [June 24, 2016, 7:35am UTC](https://forum.inductiveautomation.com/t/unsigned-data-in-tag/11857/1 "2016-06-24T07:35:15Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 24, 2016, 12:32pm UTC](https://forum.inductiveautomation.com/t/unsigned-data-in-tag/11857/2 "2016-06-24T12:32:57Z")

</div>

[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.

---

<div class="post-metadata">

**Author:** ![eyudes](https://avatars.discourse-cdn.com/v4/letter/e/9fc29f/32.png) [@eyudes](https://forum.inductiveautomation.com/u/eyudes)\
**Post date:** [June 27, 2016, 6:09am UTC](https://forum.inductiveautomation.com/t/unsigned-data-in-tag/11857/3 "2016-06-27T06:09:57Z")

</div>

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!
