• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Sending strings over TCP

    Mervis
    2
    2
    64
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      HPC last edited by

      Hi all,

      I have problems in sending strings over TCP in Mervis. The string here is a command which need to be sent to a TCP to RS232 converter and from there to a Microturbine.
      I have generated the String in Mervis (as the output of a function block) but not sure how to transfer it.
      I also think there might be an issue with my TCP channel created in Mervis either in Channel properties, Group definition, or data point parameters setting. In particular I want to know:
      1- Is it possible to send the string directly to a TCP variable defined as data point? How?
      2- If it is not possible to directly send a string to a variable, how we can send it as bytes? I tried using String-To-Bytes but it says "can't implicitly case from Bytearray to byte".

      Any help is appreciated.

      Martin Kudláček 1 Reply Last reply Reply Quote 0
      • Martin Kudláček
        Martin Kudláček administrators @HPC last edited by

        Hello @HPC,
        since Modbus doesn't know anything about data types, it is up to both the master and slave to come up with an exchange format. The registers are 16bit, but the ASCII is only 8bit. The data has to be aligned somehow, or maybe two consecutive characters can be stored into one register?
        Either way, the goal will be to iterate through the string and convert every item of the string array to byte.

        Best regards,
        Martin

        1 Reply Last reply Reply Quote 0
        • First post
          Last post