LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Buffer Searhcing

Solved!
Go to solution

Hi all,

 

I have a simple buffer that I am using to hold data being read from a serial port, I scan the data in the buffer for a certain string which is specified by the user, If the string is there the loop is stopped, the data written to a file and the next step in the proccess is performed, if it is not there it continues to read from the serial port. If the data in the buffer exceeds 10,000 bytes without finding the string. The buffer is emptied into a file, as the user wants to see the data after the tests have run. This continues untill the string is found. I can often end up with files greater than 200Kb.

 

The problem I currently have is that I sometimes 'miss' the string, this seems to be happening because the first bit of the string ends up in the file and the second bit then enters the buffer but because the string is not complete the program obviousy ignores it and thinks it did not occur. I know that the string is deffinatly being found becuase once the program times out the complete string can be found in the file.

 

Any ideas to stop this happening will be greatly appreciated 

0 Kudos
Message 1 of 3
(2,409 Views)
Solution
Accepted by topic author Dowden1

Hi,

 

One solution could be that you keep a suitable number of recently read characters in the buffer so that you don't lose the start of the string you are searching for.

 

- Matti  

0 Kudos
Message 2 of 3
(2,399 Views)

Hi,

 

Seems so simple once you said it.

 

Thanks

0 Kudos
Message 3 of 3
(2,373 Views)