09-07-2011 12:18 PM
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.
09-07-2011 01:42 PM
I put this together last year. Let me know if you need anything.else.
Have you contacted Newport? they're usually pretty helpful.
09-07-2011 01:50 PM
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
09-07-2011 02:47 PM
Now this looks very, very promising. Let me go through this and see if it resolves my issues. thanks very much.
09-07-2011 02:48 PM
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.
09-07-2011 03:26 PM
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