# Manipulate Hex values?

**URL:** <https://forum.inductiveautomation.com/t/manipulate-hex-values/2310>\
**Category:** Ignition\
**Created:** [November 1, 2010, 10:18am UTC](https://forum.inductiveautomation.com/t/manipulate-hex-values/2310 "2010-11-01T10:18:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertkjonesjr](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@robertkjonesjr](https://forum.inductiveautomation.com/u/robertkjonesjr)\
**Post date:** [November 1, 2010, 10:18am UTC](https://forum.inductiveautomation.com/t/manipulate-hex-values/2310/1 "2010-11-01T10:18:22Z")

</div>

I would like to manipulate hex values - my PLC times are coming in as Hex.

The int field shows as 2048 (dec) -\> 800 (hex)

where the 800 is meant to represent 08:00 (8am). I would like to directly read and edit the tag as hex. Can anyone point me in the right direction? I need to provide start/stop times so I want to make these times editable.

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [November 1, 2010, 9:42pm UTC](https://forum.inductiveautomation.com/t/manipulate-hex-values/2310/2 "2010-11-01T21:42:04Z")

</div>

Python already has tools to convert between hex and decimal. You could make a function in the script module and call it from anywhere. ie:[code]def toHex(decVal):  
#returns a string  
return hex(decVal)[2:]

def toDec(hexVal):  
#returns an int  
return int(str(hexVal), 16)[/code]And call it with[code]  
runScript("app.hex.toHex(2048)")

> > returns '800'

runScript("app.hex.toDec('800')")

> > returns 2048[/code]The only problem there is that you will never have a truly bidirectional binding. You best bet will be to do your writing in property change events or on a button press.

---

<div class="post-metadata">

**Author:** ![robertkjonesjr](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@robertkjonesjr](https://forum.inductiveautomation.com/u/robertkjonesjr)\
**Post date:** [November 2, 2010, 9:36am UTC](https://forum.inductiveautomation.com/t/manipulate-hex-values/2310/3 "2010-11-02T09:36:56Z")

</div>

Thanks - this gives me a good place to start.
