LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to write to an ascii string to a file

I want to ingest a data stream thru a com port and write it to a file. Right now I can't get around the byte count function. The VISA READ function wont pass the data until the byte count is reached. My data lines are of vaying length. I need the function recognize the end of the line and pass the data after the entire line has come in. Situation is this: Data stream from a number of radios sends the data back to a base radio modem. The modem passes the data to a computer and labview wites the data to different files based on an identifier at the beginning of the line. Line length varies from location to location. Thanks in advance for the help.

ssmith
0 Kudos
Message 1 of 2
(2,584 Views)
If your message has a terminator such as a CR or LF at the end, then with the VISA Configure Serial Port, set Enable Termination Char to true ans specify the termination character in hex. You can then set the bytes to read to some arbitrary high number. The VISA Read will automatically terminate when the termination character is detected. If there is no exact termination character, use the VISA Bytes at Serial Port to determine how many bytes are available and wire that output to the VISA Read. You may use a small delay before using the VISA Bytes at Serial Port to make sure that everything has been sent. You could wait until the available bytes is greater than 0 in one loop and then in the next loop, keep reading as long as available bytes is not 0. There have been numerous examples posted on serial communication as well as the shipping examples.
0 Kudos
Message 2 of 2
(2,582 Views)