05-12-2010 01:38 AM
Allright, but what is the current state of your code. Does it work as expected.
Be aware that you need to search for 7E, the instrument just sends out a constant stream of data.
Ton
05-12-2010 01:57 AM - edited 05-12-2010 01:59 AM
Luis Bertel wrote:Hi Ton,
Since i need to read a complete string always, 7E is the only constant data and it will always mark when a new string begins so i check second byte so i recover first string and cut it from buffer that way i will read all strings at buffer but the last will not be readed.
Hi Luis,
I read your comment inside the code:
Search for 7E after the first char, and cut the string previous the match, always be a full chain, so full string is guarantee.
I don't think you understand the meaning of offset in the 'search split/string' function, it only tells LabVIEW at which point to start looking for the search string, it plainly ignores anything before 'offset' in the string. You cannot use that as a relative marker like you want.
Also your last posted code (read to shift register modificationes 2) you only check once the number of bytes in the serial buffer, and then you go read the serial port numerous times untill you find a string that does not have a 7E past the first character.
So if at the start of the inner while loop you have 50 characters in the systems serial buffer you will read 50 characters at every run, unless it times out (10 seconds without sufficient data). (I made the same error in my snippet, you shoul move the property node reading the number of bytes at the port into the inner while loop).
Ton
05-12-2010 01:55 PM - edited 05-12-2010 01:56 PM
Hi,
I finally manage to do a "bullet proof" 99.9% safe serial reading buffer, using portmon i realize that serial port buffer/split data into substring 14bytes long, u can check that using "portmon" i check with several programs running included LV, so i its not necesary to use delays at reading, tested with consecutive chains (strings) with 24-26-28 bytes long received every 500ms, the trick at least for me its never close port, so far i can read, buffer and find matchs in the string.
Today i feel good 😃
first Vi is a single reading with buffer
second one is using a match pattern (using a 10ms delay)
Thanks Lynn, Thanks Ton
05-12-2010 02:24 PM