LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

bytes to read function? is it slow?

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

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 21 of 24
(1,165 Views)

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

 

Message Edited by TCPlomp on 12-05-2010 08:59 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 22 of 24
(1,158 Views)

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

 

Mensaje editado por Luis Bertel
0 Kudos
Message 23 of 24
(1,140 Views)
Tested at 100ms 4 Devices Up and Running
0 Kudos
Message 24 of 24
(1,128 Views)