String data type (Siemens)

Hi, I'm having trouble getting a string tag from my S7-1200 PLC. I'm using the syntax "[PCL4_Maquina]DB8,STRING10.0" in the OPC Item Path, but the tag is showing as BAD. What would be the correct syntax, or what am I doing wrong?

Try [PCL4_Maquina]DB8,STRING10
I also know that sometimes Siemens strings don’t contain the correct string length byte, so you have to do some tricks.

I already tried that, and the tag still appears in BAD.

[PCL4_Maquina]DB8,STRING10.7
[PCL4_Maquina]DB8,STRING11

Try these and see what you get

There it worked for me with the syntax [PCL4_Maquina]DB8,STRING10.7, thank you very much.
Can you explain why the syntax has to be written that way?

Strings are always offset by whole bytes, so it doesn’t use a bit position, in this driver, 7 is the string length

1 Like

David is correct, the syntax for String is STRING{OFFSET}.{LENGTH}. If you don't specify the length, the driver defaults to using 210(I think) for the length. You don't have 210 bytes in this data block, so that results in an invalid request.