We are trying to send floats from the PLC (REAL in the PLC) to the UR over TCP. The connection works, and we can send data between the two.
The trouble arises with socket_read_ascii_float() on the UR, because it expects (float,float,float) (including parenthesis and commas) whereas the PLC only sends the exact 32 bits for each float.
How would we go about appending parentheses and comma’s between the floats in the PLC?
Converting the floats to a string would bring with it the problem that the sequence of numbers in a string does not have the same bits as the floats, so the output on the UR side would be scrambled. We suspect therefore that we to send, in order:
“(” “float” “,” “float” “,” “float” “)”
Based on the fact that ascii is mentioned explictly in the command, this would probably mean sending:
“40” “32bitFloat” “44” “32bitFloat” “44” “32bitFloat” “41”
What would be the best way to go about that, given that the PLC does not allow arrays of mixed types (and does not seem to support a list-type structure that does and can be fed into the TSEND_C block’s DATA parameter.)
We ran into a similar problem sending integers between the two, which we worked around by using socket_read_byte_list() on the UR, and only taking the 2nd byte received (this, of course, will run into problems when sending integers larger than one byte, but for now, we can work around this limitation).