LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to acquire data from multiple dataports at the same time

Hi,

I studied the multithreading section of Labview, but still have no idea
how to make it work. Let me briefly explain my situation. I need to
develop a program that can control and acquire data from 4 serial
ports. I have 4 buttons to control starting or stopping acquisation
from the corresponding port. Every acquisation process is a while loop.
How can I start a new acquisation loop (eg. from COM2) while the loop
for COM1 is still running? In other words, I wish the 4 loops running
independently, and are controlled by their corresponding buttons only.

Thanks for any suggestion.

Jin

0 Kudos
Message 1 of 3
(2,291 Views)

Hi Anonymous,

      If I were you, I'd create one VI (call it Port.vi) to listen to one port - then make it reentrant.  Drop 4 copies of Port.vi on your Main diagram.  Port.vi inputs could include a VISA reference, a "Start/Stop" notifier and maybe a "Quit" occurance.  Wire to each copy of Port.vi a unique VISA reference and a unique "Start/Stop" [boolean] notifier - let all the copies share the same Quit Occurance.

In Main, have one event case for each of your stop buttons.  When a button is pressed, send the appropriate Start/Stop notifier!

... of course you could accomplish the same thing with four identical loops right in your main diagram, but the more complex the port-handling gets, the easier it will be to manage in one place instead of four. Smiley Wink

Cheers!

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 2 of 3
(2,289 Views)

I prefer the sub-vi approach and making them re-entrant.

JLV

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