TCP Driver device field delimiter

Hi,

I am implemating a Bilanciai weighbridge serial 232 port using a Moxa Nport serial converter for TCP/IP.

The table bellow is the string that the divice send.

Column 1 Column 2 Column 3 Column 4
1st character $(24H) string start character
2nd – 10th character net weight with sign and decimal point (if present)
11th character (20H) space
12th – 20th character tare with sign and decimal point (if present)
21st character (20H) space
22nd – 23rd unit of measurement
24th character (20H) space
25th character scale status
26th character scale status
27th character scale status
28th character scale status
29th character (0DH)
30th character (0AH)

I have the "$" in the message delimiter and 4 field count. Now is just missing the field delimiter but look that i can´t insert a "space" in this field. Is it possible to sue a space as a field delimiter?

Regards

Consider using CRLF as your field message delimiter, and accept the entire string as the value. In an OPC tag linked to the message buffer, find the offset of the $ character, and use string slicing from there to extract the fields by position.

1 Like

Using \s for the field delimiter may work... you'll have to try it and see.

Is working with 20 fields and 0 kg. the data appears at field 8, 17, 18 and 19.
8 shows the net weight
17 show tare
18 unit of measurement
19 the 4 scale status
If the kg change the fields get broken.

Space delimiters won't work if the weight fields are padded with spaces.

Use my advice above.

2 Likes