Sending strings over TCP



  • 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.


  • administrators

    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


Log in to reply