Converting PLC int1 (ASCII) value to Char

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?


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

tagValue ="PLC/PF/Tightening_Sts").value
character = chr(tagValue)
print character