LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ESP301 control with Labview/ running 2 labview programs simultaneously

Hi All,

I am using 2 separate labview programs to:

1) move a motor back and forth from 3mm to -3mm at 0.3mm/s continuosly

2) collect spectra, save to a file, move another motor a set distance after several spectra are collected.

The vi's work perfectly when they are run separately but when i try to run them at the same time, the first vi (1), stops randomly at max position before resuming motion. I need it to move continuosly for my experiment t work. I assumed it was because both motor are controlled by the same ESP301 controller which is causing some lag as both vi communicate with the controller. Is there a way to ensure these do not interfere with each other?

- vi (1) is attached

Thank you for your time.

0 Kudos
Message 1 of 2
(2,810 Views)

I am not able to view your VI, away from proper laptop, but here is a thought.  The problem likely stems from one VI locking the resource while it is communicating with the ESP301.

 

I recommend that you transition to a producer/consumer architecture in a single LabVIEW VI.  Use one consumer for your spectra collection, file save etc, and use ANOTHER consumer for the motor commands (yes you can have multiple consumers running in parallel).  Have it access the "motor 2 position" via a global variable (which is set by the main consumer).  While the motor 2 position is unchanged, the command will still be sent, but it won't move so it's ok.  there is probably an elegant solution to minimize the commands, but it probably doesn't matter much for this application.

0 Kudos
Message 2 of 2
(2,780 Views)