09-09-2009 10:46 AM
Hi Smercurio,
There is no any insertion of 'carriage return' on middle of the required string. This is common for all my outputs taken sofar. I used 'write to text file.vi' for checking the string pattern of the output from 'serial port.vi'. From that I observed the chopping of the required string in to multiple lines in some instances and also as a whole single line (no chopping) at some instant. Is it right to conclude the pattern of string output from text file read out? So far in my previous posts I have been quoting the string pattern from output stored on text file only.
With this reply, I attached the snapshot of serial port output on indicator for better understanding. But I doubt when we drag the indicator window size the pattern of string will be changed. So without idea of real pattern of string how to proceed?
Reply to your additional questions:
1. This particular VI is reading serial port for every 500 milli secs and whatever string read out need to be processed for seperation of required line string if it is available. Still I got my required string line the serial VI continue reading responses from machine.
2.As I said above, no insertion of carriage return on middle of chopped lines.
3. Yes the required string line ends up with characters like 'x' 'O' 'S' 'L' and also with symbols like '@ ' 'lambda' and semicolon, sometime left empty (i.e no character at end)
Note: In attached snapshot, red marked string is the required one. You can also observe series of unwanted carriage returns '{\sA<\r' both at start and end of string output.
Thanks
Senthil
09-09-2009 12:51 PM
09-09-2009 02:07 PM
Hi Smercurio,
I got your point that my required line string in sample 1 and sample 2 divided in to two lines without a carriage return '\r'. But this what the output I observed via text file. So when I use a match expression.vi for the case of sample 2 and sample 3 with your suggeted 'regular expressions' say '{ [A-Z0-9]<', it output the match string as only first part of my required string. i.e. A1294542442952374410500044 (for sample 2) and leave the remaining part (120799500000000010000043240000453000004410000043L). This doubts me whether 'match expression.vi' searches for the 'string' as in text file output pattern.
In my last post you could check the indicator display of 'serial port.vi'. In that carriage return '\r' is found fine at end of each character '{ A<' as well as on end of line strings. Still we find a breakup on line string when read thru text file.
How could I remove all unwanted characters "{ A<" out of raw string read thru serial port.vi?
Thanks
Senthil
09-09-2009 03:32 PM
851624047 wrote:Hi Smercurio,
with your suggeted 'regular expressions' say '{ [A-Z0-9]<',
That wasn't the regular expression I gave you.
OK. Forget the text file. I don't care about the text file, and frankly, you're just confusing things by always bringing it into the picture. You are reading data from the serial port. That's all that I, you, or anybody else should care about. All that I want to know is this: Do you ever see a "\r" character in the middle of the string as you receive it over the serial port? In other words, in the highlighted string that you showed in the image in post 31, which is the concatenated string that you're reading from the serial port, is there EVER a "\r" character in the middle of the red box? Don't mention anything about text files. Forget about the "{ A", or whatever string of characters. This is a simple question. It's either yes or no.
09-10-2009 03:40 AM
Hi Smercurio,
No. There is no '\r' character in the middle of the string (red highlighted in post 31) read from 'serial port.vi' at any instant. Sorry for the confusion.
Thanks
Senthil
09-10-2009 04:42 AM
Smercurio: Yes the line starts with "{ A" but since i dont want to bring the "{ " I start searching for a string that starts with "A" 🙂
I'll check with the latest posted ones.
/Y
09-10-2009 04:54 AM
*update* Your (OP's) 3 samples works with the slight modification of the regular expression to "A[A-Z0-9@]+"
/Y
09-10-2009 09:24 AM
851624047 wrote:Hi Smercurio,
No. There is no '\r' character in the middle of the string (red highlighted in post 31) read from 'serial port.vi' at any instant. Sorry for the confusion.
Then if the string you posted in the picture is the string you are wiring to the Match Regular Expression function there is no reason why any of the proposed solutions wouldn't work. The regex pattern that I gave you works on a specific string length. The regex pattern that Yamaeda provided does not. If the string length does not vary you can use either one. If the string length varies, use Yamaeda's.
09-10-2009 11:25 AM
Hi Semrcurio and Yameda,
I tried with all possible match regX suggested by you '{ A[A-Z0-9]{75}' '{ A[A-Z0-9]+[^<]$' '{ A[A-Z0-9@]+[^<]$'. But could not able to get the required string line output. Apart from characters (A-Z) and numericals (0-9) I could not able to guess the symbols present in it. As per Smercurio point of view, string length need to be constant. Eventhough it did not work. I also tried changing sting length too. Is anyway to index the signal read from 'serial port read.vi'?
Thanks
Senthil
09-10-2009 12:47 PM
OK, we're going to settle this once and for all. I want to see exactly what's coming over the serial port. Here's what I want you to do: