Warren Posted August 12, 2009 Report Share Posted August 12, 2009 Hello, I was hoping to get some clarification on if/how this is possible: I want to have labview run two processes "simultaneously." I have been working on a program that will control a motor via GPIB and also display movements of the motor using a USB webcam. Origionally, I had both happening in a single loop (bad idea) and I found that with all this happening, the loop iterated too slowly and the motor controls became "choppy" and inconsistant. I want the camera to be streaming video constantly, but the motor only move if directed via a controller. I have the code to do this, but I can't get them to happen at the same time without the program lagging. Through reading other threads, I understand that it may be possible to do this using Event structures?, but I was under the inpression events could only be executed one at a time, and I fail to see how this would solve the problem?? If anyone could explain how this problem could be solved, it would be greatly appreciated. Regards, - Warren. Quote Link to comment
Gary Rubin Posted August 12, 2009 Report Share Posted August 12, 2009 GPIB can be pretty slow. Is it fast enough for your control loop? Quote Link to comment
Warren Posted August 12, 2009 Author Report Share Posted August 12, 2009 Ya, I have two linear stages (the motors) that I control using the arrow keys from the keyboard. I had the loop set up for a fast and slow stepping mode and I used a timer (with different constants for fast/slow) that got the stages to step nicely so that if you held the keys downs, they would move continuously without any noticeable lagging. The resolution is 0.25 mm which is more than I need. I also have the code for the camera working well, but I'm having problem when I combine them. But to answer your question, I haven't had any problems with the GPIB communication. - Warren. Quote Link to comment
Mark Yedinak Posted August 12, 2009 Report Share Posted August 12, 2009 My first suggestion would be to split your processing into two parallel loops. Place all of the motion control in one loop and place the camera control in the other. If you do require some form of synchronization use a queue. Alternatively you could place one of the processes into an event structure (within a while loop) and use user generated events. Quote Link to comment
nhollenback Posted August 14, 2009 Report Share Posted August 14, 2009 Mark is correct. Your first step is to fully understand the Producer/Consumer with Events design pattern that is in the templates browser. (Select File>>New... ). I highly recommend the Basics 1 &2 and Intermediate 1 courses from NI - no I don't work for them . These issues are addressed in the B2 and I1 courses. I hope this helps! Best, N Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.