LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Read VI

I am doing serial communication to read data. My serial read VI is designed such that I am using a string concatenate function in while loop. As string concatenate increases memory in each iteration, is there any other function I can use to avoing memory allocation but concatenate string. The reason for using the string concatenate is to get all the data till end of character is found. Attached is the snapshot of the VI.
Thanks,
Rachana
0 Kudos
Message 1 of 4
(2,955 Views)
Preallocate a byte array (U8) and keep track of the end index and use replace array memory each time you get new string.

Anand
0 Kudos
Message 2 of 4
(2,944 Views)


The reason for using the string concatenate is to get all the data till end of character is found.

 
The VISA read routine will do all this for you if you just tell it what termination character it should expect.
Set the byte count high enough (100?) so that a normal-length message will be shorter than the allowed byte count.
Set the timeout long enough for the full message to arrive.
If everything works correctly, the VI will only return complete messages.
If things are not working correctly then a timeout is the usual response.
See below (if the picture does not have enough detail when viewed in your web browser, try downloading it and then viewing it with image display software)
 
 

Message Edited by Warren Massey on 02-15-2006 06:41 PM

0 Kudos
Message 3 of 4
(2,944 Views)

Thanks for all the suggestions:)

-Rachana

0 Kudos
Message 4 of 4
(2,925 Views)