From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

First Time Parsing RS232 Sensor Data

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.

 

 

0 Kudos
Message 1 of 2
(3,505 Views)

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

 

 

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 2
(3,495 Views)