Jump to content

Running Processes Simultaneously


Recommended Posts

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.

Link to comment

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.

Link to comment

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.

Link to comment

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.