Menu

Write/read string data to PLC 300

Help
Evgen
2024-06-17
2024-06-20
  • Evgen

    Evgen - 2024-06-17

    Hello.
    I use NetToPLCSim v 1-2-4-0 for communication between WinCC advanced V18 and plc317-2 pn/dp. Everything works. But string type variables are not written to the data block. I tried both the script and the built-in commands WinCC. Nothing just happens. String variables contain 254 bits.
    Tell me, is the problem on the NetToPLCSim side or can this be solved?

     
  • Thomas Wiens

    Thomas Wiens - 2024-06-17

    In classic Step7 V5.x you cannot view the online values of strings in the datablock view.
    You have to do this for example in variable table.
    If your string starts at DB100.DBX100.0 for example, then you add DB100.DBB100 with view type HEX (this is the maximum stringlength e.g. 16#FE for 254 length), then DB100.DBB101 also in HEX (this is the acutal length of the string), and then DB100.DBD102 to whatever you need with view type CHAR. This are the actual chars in the string, but valid chars are the number given in the actual length.

     
  • Evgen

    Evgen - 2024-06-20

    Hello.
    Thanks for the tips.
    Everything works for me.
    Yes, as you wrote, the first byte is responsible for the total length of the line, the second byte is responsible for the actual length of the line. In order to view the downloaded text, you need to decompose the ring variable into bytes in the Siemens viewing table; I added a photo to the attachment.
    However, the address of the symbolic variable to which the tag must be assigned in the TIA is the starting address in the controller.
    Those. When writing text to the starting address in the controller, the second byte automatically takes on the value of the actual text length in characters. The text itself is automatically written starting from the third byte. Thanks again.

     
    👍
    1

    Last edit: Evgen 2024-06-20

Log in to post a comment.