LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

First line from serial port, partial or junk data

I'm trying to receive the following protocol which works, except I have to insert the equipment while the serial port is sending data.  So sometimes the first line is partial data and that causes errors down the line.    My thought was to wait to receive data until I receive the &&\r\n0108.  Any suggestion or code to implement that would be great. 

 

Here is a couple of sample packets:

 

&&\r\n
0108136.19\r\n
0110146.19\r\n
01130.35\r\n
012350.00\r\n
!!\r\n

 

&&\r\n
2350155.19\r\n
!!\r\n

 

  

TIA,

 

Jerry

Download All
0 Kudos
Message 1 of 3
(2,579 Views)

Hey Raptor50,

 

I would recommend using a queue to take in the data and then build an array and then trigger some event to start off of the &&/r/n0108 after this line is found you can proceed normally withou any lose of data. 🙂

 

These may help:

http://decibel.ni.com/content/docs/DOC-15453

http://decibel.ni.com/content/docs/DOC-8653

Sam S
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(2,558 Views)

Sam,

 

Thanks.  I'll give that a shot.

 

Jerry

0 Kudos
Message 3 of 3
(2,539 Views)