# ascII code and another question

**URL:** <https://forum.inductiveautomation.com/t/ascii-code-and-another-question/3122>\
**Category:** Ignition\
**Created:** [July 22, 2011, 9:54am UTC](https://forum.inductiveautomation.com/t/ascii-code-and-another-question/3122 "2011-07-22T09:54:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![weng](https://avatars.discourse-cdn.com/v4/letter/w/bbce88/32.png) [@weng](https://forum.inductiveautomation.com/u/weng)\
**Post date:** [July 22, 2011, 9:54am UTC](https://forum.inductiveautomation.com/t/ascii-code-and-another-question/3122/1 "2011-07-22T09:54:04Z")

</div>

How can I return the charactor’s ascII code,and vice versa，for example ,retrun 65 from ‘a’,and ‘a’ from 65  
by the way ,another question:  
How can I only read a OPC tag 's value only once at any time?

```
 Thank you
```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 22, 2011, 11:28am UTC](https://forum.inductiveautomation.com/t/ascii-code-and-another-question/3122/2 "2011-07-22T11:28:37Z")

</div>

You would have to use a script using the ord() and chr() functions. There is no way to do it in an expression.

As for your tag issue, perhaps if you can give a few details as to what you are trying to do…

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 22, 2011, 12:16pm UTC](https://forum.inductiveautomation.com/t/ascii-code-and-another-question/3122/3 "2011-07-22T12:16:28Z")

</div>

Okay, not strictly true. There is a way to do it but it’s rather more complex.  
I created a script module called ascii. withing the module I created functions duplicating the original python functions.  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/457996ae456530aa928c818fbcf07c0d10d83524.png)

You can call the scripts from an expression using the runScript() function. Examples:

runScript(concat([color=#0000FF]“app.ascii.chr(”[/color],[color=#FF0000]{Root Container.Numeric Text Field.intValue}[/color],[color=#0000FF]")"[/color]))

runScript(concat([color=#0000FF]‘app.ascii.ord("’[/color],[color=#FF0000]{Root Container.Text Field.text}[/color],[color=#0000FF]’")’[/color]))

---

<div class="post-metadata">

**Author:** ![weng](https://avatars.discourse-cdn.com/v4/letter/w/bbce88/32.png) [@weng](https://forum.inductiveautomation.com/u/weng)\
**Post date:** [July 22, 2011, 2:37pm UTC](https://forum.inductiveautomation.com/t/ascii-code-and-another-question/3122/4 "2011-07-22T14:37:18Z")

</div>

Thanks, I want to l read a opc-tag value only once because when it was read a time,the devise state changed,when it was read again ,the devise state changed again,so I do not want it was read by scan-class because it read again and again.

---

<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:** [July 22, 2011, 3:31pm UTC](https://forum.inductiveautomation.com/t/ascii-code-and-another-question/3122/5 "2011-07-22T15:31:26Z")

</div>

Answered [here.](http://inductiveautomation.com/forum/viewtopic.php?f=70&t=6705)
