I am getting some data through A Modbus/TCP connection. The data that is coming through is a decimal number. I need to be able to take this decimal number convert it to hex, swap the order convert it to an ASCII hex value and save the resulting string.
Any ideas on the best way to take the decimal and convert it to the ASCII value?
Below is what I received from the manufacturer as to the conversion process. The numbers are the actual data I am receiving
This is my actual data
Did you try to edit the Gateway | Config | OPC UA | Device Connections | Modbus TCP connection | Advanced | Reverse Word Order?
yeah had no effect because the data is a decimal which needs to be converted to hex before swapping
You can use a simple expression to do the conversion for you.
char({Value} & 0xFF) + char(({Value} & 0xFF00) >> 8)
For the value 19523
this expression would return CL
. You could of course extend this to include all of the potential registers. I would probably recommend using expression tags however.
4 Likes
HOT DANG!!!! That works like a charm!! TY!!!!!!
If @lrose's solution worked, then IA's native conversion HRS
should work, too, without the funky expressions, and with write support. (With byte swapping, perhaps.)