# Reading unsigned OPC values

**URL:** <https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [January 29, 2021, 11:00pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776 "2021-01-29T23:00:50Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 29, 2021, 11:00pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/1 "2021-01-29T23:00:50Z")

</div>

I have a 2 word unsigned integer in my PLC that has a value 0xAAAA00A8. But is being reported as a large negative number. Is there anyway to at least get this reported as an unsigned value, and also display the value as a hex number in the tag browser?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 29, 2021, 11:01pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/2 "2021-01-29T23:01:13Z")

</div>

What driver are you using? What’s the tag type in Ignition?

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 29, 2021, 11:03pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/3 "2021-01-29T23:03:48Z")

</div>

Using the standard OPC UA driver, and the type is currently set to Integer

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 29, 2021, 11:04pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/4 "2021-01-29T23:04:33Z")

</div>

> [@peter](#):
>
> standard OPC UA driver

There isn't a "standard OPC UA driver". What kind of PLC is it? Or are you connected to another OPC UA server and not the built in one?

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 29, 2021, 11:05pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/5 "2021-01-29T23:05:41Z")

</div>

It’s a standard OPC tag type collecting data from the OPC UA server exposed in an Emerson RX3i PLC

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 29, 2021, 11:07pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/6 "2021-01-29T23:07:55Z")

</div>

Okay, you can try changing the Ignition tag type to a Long / Int8 value, but it’s really up to the server to use the correct datatype if it’s not already using an unsigned type.

You may need to use an expression tag and force it to be unsigned yourself by doing `value & 0xFFFFFFFF` or something. And then you might also need to use an expression to turn it to a hex value for display.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 29, 2021, 11:17pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/7 "2021-01-29T23:17:39Z")

</div>

You mentioning the server using the correct data type made me realize where the issue might be. My PLC data choices are DINT or DWORD. I had it at DINT. Changing to DWORD and going to Long fixed the negative issue (which is face palm on my end - they have INT and UINT, but DINT and DWORD)

Is there a format string for Hex values?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 29, 2021, 11:20pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/8 "2021-01-29T23:20:01Z")

</div>

An expression something like this would work: `stringFormat("%08X", {[~]SomeTag} & 0xFFFFFFFF)`.

I can’t figure out how to get the Format String tag property to do hex formatting 😕

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 29, 2021, 11:21pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/9 "2021-01-29T23:21:14Z")

</div>

Well this is for tag browsing and not visualization, so its the Format String property of course!

---

<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:** [January 29, 2021, 11:25pm UTC](https://forum.inductiveautomation.com/t/reading-unsigned-opc-values/42776/10 "2021-01-29T23:25:05Z")

</div>

> [@Kevin.Herron](#):
>
> I can’t figure out

I don't think its you. /:
