LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial scan until \r\n

Solved!
Go to solution

I am trying to log the serial data showing up in a text box indicator to a plain text file. I have accomplished this task, but now I need to make sure that a partial string will never be printed to the file. I need a way to scan the data and print it to the text file without only printing a part of the string. I have tried scanning for the \r\n termination characters but still, no luck. I am fairly new to Labview so any help would be appreciated. I am sure that this is easier than I am making it out to be.

0 Kudos
Message 1 of 34
(5,158 Views)

I would check the string and search for a pattern (in your case, the End of Line Constant that can be found at the Programming >> String palette).
If the pattern is found, then you use the information. Otherwise, simply ignore it.

Take a look at the String functions inside the Programming Palette. Your journey starts there 😄

 

Regards

Mondoni
0 Kudos
Message 2 of 34
(5,149 Views)

That is what I thought I should do, however I'm not exactly sure how to do that. I have tried using case structures, but I am not exactly sure how to use them correctly. Can you tell me a little more about how I would go about doing this?

 

Thanks

0 Kudos
Message 3 of 34
(5,143 Views)

You can use the Search/Split String to locate the EOL characters.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 34
(5,134 Views)

So I don't need to use any case structures then?

0 Kudos
Message 5 of 34
(5,131 Views)

You will probably need a case structure for when the EOL was or was not found.  But the case structure should not be comparing any strings.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 34
(5,123 Views)

I'm sorry but as I said I am fairly new to Labview and don't have a firm understanding of how to wire the case structures to test for a condition. Can you tell me if I am on the right track? I uploaded a screenshot of my block diagram.

0 Kudos
Message 7 of 34
(5,118 Views)

Delete the string going to the case structure and wire the Offset Past Match indicator to the Case Structure to indicate anything after 0 --> (1...). You'll have to modify your case structure to handle the integers.

0 Kudos
Message 8 of 34
(5,079 Views)

Ok, so there are two conditions..

1: EOL has occurred 

2: EOL has not occurred 

Keeping printing to the file until EOL occurs

Do nothing if EOL occurs

How do you signify "do nothing" in Labview

0 Kudos
Message 9 of 34
(5,072 Views)

On the 0... (told you incorrectly before) case, just don't wire anything into it.

0 Kudos
Message 10 of 34
(5,064 Views)