LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Collect data from USB and Serial port simultaneously

I have two VIs. One collect data from a USB and the other collect data from a Serial port. Both work fine seperately. What is the easiest way to couple both and work  simultaneously to collect data.

Download All
0 Kudos
Message 1 of 4
(3,707 Views)

Short answer: Use them as sub-VI's in a single program...

 

Long answer: You need to break these down into steps. Consider a State Machine architecture and have a step to configure your serial port and DAQ, a step to take the DAQ reading and serial port data, a step to graph and save the data, a step to wait for a timer to expire and take the data...

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 4
(3,697 Views)

Is there a specific reason you cannot just run them both in separate loops in one VI? How do you want to "couple" them? You can have a producer consumer architecture where you can run your two VI's in separate "producer" loops and have one consumer loop which will grap the data from your producer loops from a buffer and run some operation on them.

0 Kudos
Message 3 of 4
(3,694 Views)

I would lean toward a producer/comsumer design pattern with one producer and two consumers. The two consumers will handle the data collection with one on th eserial port and the other on the USB. The producer would handle all the UI stuff. To give updates to the UI the consumers can user user events to notifiy the producer something needs to be updated.



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 4 of 4
(3,677 Views)