Hi,
how do I have to declare strings on WinCC OA to fit the string format on S7-PLCc?
S7-strings are like 1st byte total length, 2nd byte current length, + n characters), WinCC OA strings are #0-terminated which doesn't fit.
What I did is a string declaration in WinCC OA and gave it an address like SPS_NAME.DB5.DBX2:20 (actual string on S7 starts at Byte 0, and has length 21)
As long as I do not alter the string length everything is OK, because the driver does not change the length byte on S7. But that's not a solution!
I cannot really believe that I have to convert e.g. a char-array into S7-string type on the PLC. I Hope I'm doing something wrong and anoyone can help me!
thanks in advance.
best regards
Strings and Simatic S7 driver
- Ladrone
- Posts:14
- Joined: Thu Sep 24, 2015 2:09 pm
Re: Strings and Simatic S7 driver
is there a solution?
- fmulder
- Posts:330
- Joined: Wed Feb 03, 2010 9:46 am
Re: Strings and Simatic S7 driver
I believe we ran into the same thing. The 'luck' that you have is that the first 2 bytes will never be a 0. We simply read the entire string and then cut of the first 2 characters in Wincc OA. So, our string in WinCC Oa actuyally starts with 2 funny characters.
good luck
Frenk
good luck
Frenk
- haslinger
- Posts:2
- Joined: Tue Dec 14, 2010 9:03 am
Re: Strings and Simatic S7 driver
Hi Frenk,
to avoid those "funny characters" I defined the "string" as an array_of_char in the plc with the same arraylength as I defined the string in WinCC OA. If you actually need a string-type in the plc and not a char-array, you just convert the array to a string and that's it.
If you need further assistance on plc side, just let me know.
Thomas
PS: @ETM: will there be something like a "S7-string"-Tranformation Type for the S7-driver in future ???
to avoid those "funny characters" I defined the "string" as an array_of_char in the plc with the same arraylength as I defined the string in WinCC OA. If you actually need a string-type in the plc and not a char-array, you just convert the array to a string and that's it.
If you need further assistance on plc side, just let me know.
Thomas
PS: @ETM: will there be something like a "S7-string"-Tranformation Type for the S7-driver in future ???
- fmulder
- Posts:330
- Joined: Wed Feb 03, 2010 9:46 am
Re: Strings and Simatic S7 driver
Thanks. We will try