12-07-2020 10:12 AM
Hello there,
I have issues to create the good data format mask to extract the data received from an RS-232 device.
The communication is working fine :
But I didn't manage to set up a good format mask.
Here is the answer, in hex :
01 04 02 00 1B F9 3B
I want to keep only the bytes 4 and 5 (in bold in this example). The first 3 ones are header, the two last are CRC, so I can skip them.
I tried this :
6x 4ah 4x
But doesn't works. Maybe because this syntax works only with ascii characters ?
I tried to find a suitable sample in the help, but I didn't find anything.
Is there a way to skip bytes ?
Thanks in advance !
Solved! Go to Solution.
12-08-2020 01:39 AM
Ok I tried to use
"\x01\x04\x02"2ah
as data format mask. Regarding the RS232 monitor my data is correctly detected :
So my data (in red) is 0x00 0x1B , which is correct. But why the output is still 0 ??
0x00 0x1B should be 27 in decimal...???
12-14-2020 07:38 AM - edited 12-14-2020 07:40 AM
You need to read the last two bytes, too, to complete analysing the entire message.
Instead of '2ah' try 'i' (for signed short int) oder 'w' (word -- unsigned short), or 'iy' / 'wy' (Big-Endian versions).
Add another channel, read one 'i' (two byte), but do not connect the output, just read the bytes and ignore the output of the message's last two bytes.
12-14-2020 08:04 AM
Many thanks !
So I created a second channel, with only "i" as a measurement data format.
Going into the RS232 monitor, I now have a value : 😀
But I don't see why the data value is 0.15353E05. My incoming data is "00 1B" in hex so I should have 27 in decimal...?
12-14-2020 09:34 AM - edited 12-14-2020 09:54 AM
Because '2ah' ist not correct, use i, w, iy, or wy instead, please.
One uses 'ah' as format string if a device sends hex numbers as ASCII text, e.g. 'F1<CR>' (= 241dec).
That would be "46 31 0D" as hex. (ASCII table 'F' = 46h, '1' = 31h, '<CR>'=0Dh).
But that is not the case for your example, you can interpret the bytes... "directly".
12-14-2020 10:00 AM
Ok I got it !
So finally I used
"\x01\x04\x02"iy2x
And it works directly, even if I don't have anymore the color highlighting :
The output value is now ok ! And thanks to the last "2x" in the mask I didn't need a second channel to finish reading the data ! 😀
Thanks a lot for your help !