LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in synchronizing two executions

One execution (not in loop structure) is to run vi-A to move a motor by certain distance. Another execution is a loop struction, and in each loop execution vi-B inside it acquires current motor position.
 
I hope to synchronize this two executions so that when the motor just begin to move, the vi-B simultaneously begin to acquire position. However, I always failed to synchronize them. In the position ~ time plot, there are always a short beginning period where position is zero.
 
Any suggestion on solving this problem? Thanks a lot.
 
Dejun  
0 Kudos
Message 1 of 4
(2,698 Views)

My first thought is why make it into two separate threads?  It may be easier to have it move then read position in a loop.  This would simplify the problem and make things easier.

If you need to use threads I have two thoughts.  Use LabVIEW 8.0 Shared Variable to share information between the two threads.  You can also FIFO commands using the Shared Variable.  Second thought is that you may be overrunning one of the threads.  You can probably read faster that you can move so put loop count indicators on the front panel to see how many iterating each thread has run.  You may be surprised by what you see.

Let me know if this is any help.  If not, fire me back a specific question and I will try to help,

Matt

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 2 of 4
(2,685 Views)

Have a look at Rendezvous with SubVIs.vi in the examples shipped with labview. This sounds like what you want to do.

Hope this helps

David

Message 3 of 4
(2,675 Views)
I'd also choos the method Matt suggested, but I would read first and then move. So that you start off a known position.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 4 of 4
(2,673 Views)