11-15-2016 11:41 AM
Hi,
I am new to using DASYLab. Previously I just needed to open and run existing layouts to collect data. Recently we got a new RS232 sensor that outputs 12 data channels delimited by a comma. I know I need to use the RS232 input to break the data string into the individual channels but am having a hard time wrapping my head around the ASCII code to properly parse my data. I have read a few threads on other people’s problems with data parsing but the solutions are very specific and I don’t understand the theory behind it to apply the solutions to my case.
If anyone could give me a hand or point me in the right direction to figure it out I would greatly appreciate it. I have attached a screen grab of the data on the RS232 monitor.
11-15-2016 11:52 AM
12 channels.
Set up the RS232 module with 12 channels. If you need a data request command, only put it into channel 0. All other channels should be blank.
For the data format, you need to look at the entire string.
$VNYMR,+148.940,-002.072,+123.694,-00.1789, ...*xx<CR<LF>
To parse
Channel 0: "$VNYMR," a \x2c
Channel 1: a\x2c
Channel 2,3,4,5,6,7,8,9,10: a\x2c
Channel 11: a 3x\r\n
The Channel0 quoted string will anchor on the line.
\x2c is hex for the comma
a says to find all characters to the delimiter and interpret as numbers.
Channel 11 has the checksum, and we don't need to check it, just skip over it with the 3x.
Alternate Channel 11: a \x2a