DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

Advice on parsing variable length input strings from Newport z-series

I'm trying to parse the response from a number of Newport z-series sensors. Some are temp only, some are temp and humidity. In one case I have five sensors on one controller but in the other cases they are all presently single sensors.

 

Data Response is: ID Seq, Type, Temp and Unit of Measurement (F in this case)

 

0 165 1 75.2 F <CR><LF>
<CR><LF>

 

I have been having trouble finding documentation on how to parse this out so I can extract the one item I need, the temp value.

0 Kudos
Message 1 of 6
(6,046 Views)

I put this together last year. Let me know if you need anything.else.

 

Have you contacted Newport? they're usually pretty helpful.

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 6
(6,045 Views)

More specifically, you want to configure the module to skip the characters that you don't want.

 

DASYLab won't use the sequence or type, unless you really want them. 

 

 

0 165 1 75.2 F <CR><LF>

<CR><LF>

 

Use 

 

7x to skip the 0 165 1

 

then

 

a \r\n to interpret the rest of the line. 

 

and then we need 2x to skip the extra cr lf

 

so, 

 

7x a\r\n 2x

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 3 of 6
(6,044 Views)

Now this looks very, very promising. Let me go through this and see if it resolves my issues. thanks very much.

0 Kudos
Message 4 of 6
(6,042 Views)

Ouch! I failed to mention the Seq number changes and ranges from one to four characters so a simple 7x won't do it. Let me work through the pdf and I'll see if I can figure it out.

0 Kudos
Message 5 of 6
(6,041 Views)

0 165 1 75.2 F <CR><LF>

 

So we have to treat all values as data, and use the delimiter to find them. 

 

For the string above, there are four sets of numbers. You'll need two channels since we can safely skip the first and the third.

 

Ch 0: 2x a\x20

Ch 1: 2x a\r\n 2x

 

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 6 of 6
(6,039 Views)