10-09-2008 02:22 PM
I know that multithreading is good. But at this point, I am not familiar with it.
My problem is following:
1. I have a camera (frame rate 30 fps). I need this campera keep running and take pictures, display them.
2. I have another hardware (QPD). When user click "Go", it will collect data.
This is easy to do in Labview. I just need 2 while loops (or timed loops), one controls the camera while the other control QPD. How can I do this in Labwindows without using multithreading?
Thank you.
10-09-2008 03:20 PM
Fisrt of all, multithreading is not so difficult to obtain in CVI: there are several application notes and some examples that can help you in designing your application.
Second option, you could try using asyncronous timers to execute the slower of your activities: the asyncronous timer is one of the instrument drivers shipped with CVI; they are based on windows multimedia timers so are quite reliable and are executed in a different thread than the user interface one. Basically every function that can be structured using a regular CVI timer can then be ported to multimeda timers, paying attention to variables shared among the timer thread and the main thread.
10-10-2008 05:50 AM
i don't know which type of acquisition you are using, but the camera acquisition library from NI lets you use an asynchronous acquisition where you are notified of image arrival in a callback function (internally, the callback is called from another thread). this is like having a multithread, without having to write it yourself. additionally, i would absolutely recommend using the asynchronous grab, because it allows to grab at a fixed frame rate without being disturbed by other tasks.
i don't know what a QPD is. if the data acquisition from your QPD needs to be synchronized with the image acquisition, then you can build a state machine (and optionally implement it in an asynchronous timer, as Roberto already suggested it).
10-10-2008 01:32 PM