LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

two threads in LabVIEW, both using the same serial port

I am doing a project wich there are two threads: an UI thread and a cyclic serial port reading, but the UI use also the  same serial port in order to send commands to device. Could somebody show me an example vi or how to do it?

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

Use a loop to continuously read the serial port. Analyze the result and pass commands-actions to every other vi or loop required.

The "write to port" sould be in one place, in your program, also. If you need to write to port from different places in your program, create a sub vi, called "write to port" and call it from wherever you need to.

 

There are examples in LabVIEW, for writing and reading the port.

Also you will find a few in this forum

0 Kudos
Message 2 of 3
(2,717 Views)
The problem is not going to be writing to the port from different places.  VISA Write will arbitrate that (assuming you share the open ref num between both instances), it is when you are doing writeson the port and expecting the responses back in a specific place.  Then you need to create a write then read serial coms VI.  Well at least that is one possible sollution depending on your application. 

Paul
0 Kudos
Message 3 of 3
(2,702 Views)