12-07-2011 11:36 AM
Hi,
I have been struggling to figure out the measurement data format strings to split out the following into seperate channels:
<CR>
07/12/11;10:44:21;1;<CR><LF>
CO2 ; 0.25;% ; ;0;<CR><LF>
;;<CR><LF>
67.8;29.9; 61.8; 2.17;291808;560656; 1; 1; 1; 1;<CR><LF>
5319;<CR><LF>
<CR><LF>
The instrument I am connecting too will spit out these 7 lines every 10 seconds. It does not require a data request command to output data.
I have tried 'Fixed and Flexible Format' strings for passing data but it does not seem to behave as expected. I trawled through many of the forum posts but it does not seem to treat foward slashes, colons, etc as ASCII and parse them with an 'a' string.
Can anyone assist me in where I am going wrong?
Thanks in advance,
Tom
12-13-2011 09:32 AM
Hello Thom,
The string you are recieving, is it a fixed length every time or do the values change such that the length of each line can be different?
Please can you attach your code for me to have a look at.
Thanks
12-19-2011 02:15 AM
Hi Jack,
The length of each line will be different, each parameter shouldn't be more than 6 characters long and always delimited with a semi-colon. Unfortunately I don't have any code to really give you, if I try a/r the RS232 monitor view gives me this:
I assume the initial <CR> is my first problem.
12-19-2011 05:45 AM
Hello Thom,
If the length of your data is changeable then Flexible is the one you need. Have a look at the following post "Parsing variable length data measurementt format for Newport THP/N"
Searching the word "Parse" in the DASYLab Forum I found more examples similar to this that may be of help to you too
Hope this helps,
Jack
01-17-2012 08:46 AM
<CR>
07/12/11;10:44:21;1;<CR><LF>
CO2 ; 0.25;% ; ;0;<CR><LF>
;;<CR><LF>
67.8;29.9; 61.8; 2.17;291808;560656; 1; 1; 1; 1;<CR><LF>
5319;<CR><LF>
<CR><LF>
With 1x you can skip one character of the string in the module's puffer.
Format-String in chan 0 of Rs232-Input module:
1x $1 \x3b --> This skips the leading <CR>, and puts everything until the first semicolon (hex-code 3b) into DASYLab's global String 1 (so, the Date is in glob-string 1).
Format-String in chan 1 of Rs232-Input module:
$2 \x3b --> puts the time into glob-string 2.
Format-String in chan 2 of Rs232-Input module:
a \x3b --> outputs the 1 via output of chan 2
Format-String in chan 3 of Rs232-Input module:
2x $3 \x3b --> skips the <CR><LF>, and puts CO2 into glob-string 3
Format-String in chan 4 of Rs232-Input module:
a \x3b --> outputs the 0.25 via output of chan 4
Format-String in chan 5 of Rs232-Input module:
$4 \x3b --> puts % into glob-string 4
etc pp.