LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String Output

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

 

 

 

0 Kudos
Message 31 of 59
(1,677 Views)
We seem to have a different definition of "carriage return". A carriage return is a single character, of ASCII code 13, not a sequence of characters. In '\' code mode it is \r. Your previous Sample 2 and Sample 3 clearly indicates part of the string you're looking for as appearing on a new line. How did it get there? There had to have been a carriage return (the 'standard' definition) in the string.
0 Kudos
Message 32 of 59
(1,664 Views)

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

 

0 Kudos
Message 33 of 59
(1,649 Views)

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.

0 Kudos
Message 34 of 59
(1,638 Views)

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

0 Kudos
Message 35 of 59
(1,621 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 36 of 59
(1,615 Views)

*update* Your (OP's) 3 samples  works with the slight modification of the regular expression to "A[A-Z0-9@]+"

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 37 of 59
(1,611 Views)

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.

0 Kudos
Message 38 of 59
(1,596 Views)

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

 

 

0 Kudos
Message 39 of 59
(1,579 Views)

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:

  1. Post your VI.
  2. Get Portmon
  3. Launch Portmon.
  4. From the Portmon menu make sure that the Options -> Show Hex menu item has a checkmark. If not, select it. 
  5. Start the capture on Portmon (see the Portmon Help file).
  6. Run your VI. Wait for the data to come through. While this is happening Portmon will capture what's coming over the serial port.
  7. Save the portmon data to file (see the Portmon Help file).
  8. Upload the portmon log file.
0 Kudos
Message 40 of 59
(1,571 Views)