LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid multithreading.

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. 

0 Kudos
Message 1 of 4
(3,652 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,643 Views)

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).
0 Kudos
Message 3 of 4
(3,619 Views)
Hey Moon-Sun,

Have a look at this great DevZone article on Multithreading in LabWindows/CVI. This KnowledgeBase article details the differences in multithreading between LabWindows/CVI and LabVIEW. Why do you wish to prevent multithreading? Unless it is critical in your application, it’s probably best to let Windows and LabVIEW allocate memory and processing power automatically as needed.

If your loop iteration rates must contain little-no jitter, consider upgrading to a LabVIEW Real-Time operating system. This article talks about how multithreading is used in a deterministic Real-Time operating system.

I hope this helps! 🙂
David G
Sales Engineer - SE Michigan & N Ohio
National Instruments
0 Kudos
Message 4 of 4
(3,599 Views)