Siemens Driver, Byte Tag, "Error_TypeConversion"

Hi All.

I am working with an S7-300 Siemens PLC and am getting the following error listed in the quality field of my OPC tag of datatype ‘BYTE’

Error_TypeConversion(“Value 144 can not be coerced to byte due to overflow”)

Pretty sure a byte can be 0-255 :slight_smile: and I don’t see any option to make the tag unsigned byte (if that is such a thing)

Ignition 8.1.12 (b2021111810)
Java Version 11.0.11+9LTS
Siemens Driver 6.1.12 (b2021111810)

Any help greatly appreciated

Try using a char (C instead of B) for the address?

Sorry I’m mistaken. Char is signed, byte should be unsigned, what does your OPC item path look like?

Not when signed. A byte array has a min of -128 and a max of 127, each.
You need Short/Short Array instead (-32,768 to 32,767).

In my experience all numeric types available in Ignition are signed.

tag path is [topic]DBxxx.B72

I need all 8 bits in an unsigned format. If I make the datatype a short wont it read garbage into the remaining 8 bits (in my tag example there is other data in DBxxx.B73) ?!

This is legacy PLC code written by others that I cannot modify, the byte contains a count (0 - 255).

Thanks for the input.

Well, obviously is not garbage. The OPC still reading 8 bits. The tag instance is converting those 8 bits with 8 more to make it signed.
Feel free to use short.

1 Like


Ill give it a go. Still think its crazy that java treats byte as signed.

Maybe there should be a note added into the ignition help file that you cant read a byte into a byte opc tag if bit 7 is set.

Thanks for all the help