LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read block of data from hardware via Serial port every 20 second and process

1. Read many lines of string character from serial port until no more new data

2. Process data

3. wait for the data available at comport to read

0 Kudos
Message 1 of 6
(2,394 Views)

Its good to have two loops-Producer & Consumer Loop - (One for acquiring data and one for Processing the data).

In the Acquiring loop , Read number of bytes at port, once your number of bytes at port is greater than 0 then start reading then data from serial port.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 6
(2,384 Views)

I think it is what you are looking forSerial port read.png

Benoit 

 

 

0 Kudos
Message 3 of 6
(2,375 Views)

Of course this is not your main VI but it will read all data available on the serial port.

Now add a loop for every 20sec... a GUI...

Benoit

0 Kudos
Message 4 of 6
(2,373 Views)

Thanks for the help. I red the data insist while loop and no data at port then exit that while loop and pass the multistring into different while loop until empty string to exit the second while loop

0 Kudos
Message 5 of 6
(2,330 Views)

You should not rely on the bytes at port for reading data. Your protocol should use a termination character, fixed data size or have a packet header that indicates how many bytes to read. Using bytes at port will eventually cause you problems as you will read the wrong amount of data at some point and your data will not be synchronized after that.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 6
(2,326 Views)