# Converting PLC int1 (ASCII) value to Char

**URL:** <https://forum.inductiveautomation.com/t/converting-plc-int1-ascii-value-to-char/11793>\
**Category:** Ignition\
**Created:** [June 8, 2016, 7:33pm UTC](https://forum.inductiveautomation.com/t/converting-plc-int1-ascii-value-to-char/11793 "2016-06-08T19:33:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![csmeaton](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@csmeaton](https://forum.inductiveautomation.com/u/csmeaton)\
**Post date:** [June 8, 2016, 7:33pm UTC](https://forum.inductiveautomation.com/t/converting-plc-int1-ascii-value-to-char/11793/1 "2016-06-08T19:33:59Z")

</div>

I am attempting to write a single ASCII character to a SQL database. When I added the PLC tag (AB-Compactlogix PLC) it came into Ignition as an “int1” data type and has a value of 79 (“O” in ASCII). I cannot write this tag to a SQL database because it is considering it an integer and the database column is of type “varchar(1)”.

I attempted to create an expression tag that would convert the “int1” type to “char” type but I am failing to find the correct programming to do so.

Below is the script I am testing out in the console, I am getting an error “chr(): 1st arg can’t be coerced to int” even though the tag “PLC/PF/Tightening\_Sts” is of type “int1”

`character = chr("PLC/PF/Tightening_Sts")
print character`

Is there another way to get the Ignition tag to be read as an ASCII character or do I need to just change the data type in my PLC to be a STRING instead of a single character?

Thanks,

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [June 8, 2016, 8:20pm UTC](https://forum.inductiveautomation.com/t/converting-plc-int1-ascii-value-to-char/11793/2 "2016-06-08T20:20:57Z")

</div>

If you’re making a script then you have to read the value of the tag first before you can do the chr() function.

```auto
tagValue = system.tag.read("PLC/PF/Tightening_Sts").value
character = chr(tagValue)
print character
```
