ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading in Serial Data String

I have a serial data string coming in over RS-232 at a rate of one data block every 1-2 seconds. does anyone have any sample code or suggestions that can help me with my data.
The data is read in over the serial port. It begins with a $ and ends with a carraige return. I have been trying to figure out a way to basically read in the string as my test item outputs it, and then store the data until I have a complete data block ($xxxxxxxCR), so after I have a complete block, i can then send it to a parsing function for display.

Hopefully I've explained myself enough for someone to help this desperate programmer.

thank you
0 Kudos
Message 1 of 4
(2,888 Views)
Have you tried to use the Advanced Serial Write and Read vi, shipped with LabVIEW (Examples/instr/SimpleSerl.llb/Advanced Serial Write and Read.vi). You only have to set the termination char to $0D, and try to read a number of chars larger than your actual char number.

CC
Chilly Charly    (aka CC)
Message 2 of 4
(2,883 Views)
Thanks for the help. I was making things harder than they should have been!
0 Kudos
Message 3 of 4
(2,872 Views)
On top of that...

If you have a fixed length for the return bytes, you might wanna try this...

..\LabVIEW 7.0\examples\instr\smplserl.llb\Serial Read with Timeout.vi


This VI checks if Bytes at Serial Port (byte count) => Set length in no. of byte before performs the serial read.


Cheers!
ian
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 4 of 4
(2,859 Views)