10-04-2005 03:05 PM
10-04-2005 04:50 PM - edited 10-04-2005 04:50 PM
Parallel threads are easy in Labview. You just create two loops where the output of either loop is not connected to the input of the other. Without this data dependency, the two loops run in parallel. See the attached vi, my producer-consumer template. Replace the random number generator in the top loop with your serial port code. Put your other processing code in the bottom loop. Use the queue to pass info from one loop to the other. You can signal the lower loop when the serial port receiving is done by putting something on the queue that signifies the completion (like a "done" string). Your lower loop will constantly check the queue, looking for the "done" string. You can use a boolean if you remove the string wires and replace them with boolean types.
Bytes at Port will look at the serial port buffer and report the number of bytes sitting there waiting to be read. Call it before you read, and pass the number from bytes at port to the read function. Search the LV examples for serial port and you will see how bytes at port is used.
Message Edited by tbob on 10-04-2005 03:51 PM
10-04-2005 06:52 PM
Hi Runner!
You wrote
"
10-05-2005 07:46 AM
Thanks to both of you.
This brings me a big leap forward.
How will this look like if I put the loops in two different (sub-)VI's ?
RunnerBoy
10-05-2005 10:51 AM
10-05-2005 02:29 PM
10-05-2005 02:42 PM