LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

redraw speed while choosing menuitem

Hallo
In my programm one tread makes calculations and Plot the data in a loop
in a CVI panel. The user intreface process of this panel runs in another
tread. The redraw speed is the limitation of the loop.

But there is a very intresting effect: If I open a menu or a ringcontrol
the redraw speed is as about 5 times faster. If the menu is closed for
example by selecting an item, the redraw speed is as slow as before!

Is there any explanation for this effect and is there a posibility to
increase the redaw speed hole the time?

thanks, Babak
0 Kudos
Message 1 of 2
(3,014 Views)
The reason for increase in speed in the thread that is calculating and drawing data is because when you hold up the other thread (i.e. by pressing down on the mouse button over the listbox , the first thread gets all the processor time and therefore runs faster. The reason why the main thread waits is because of the ProcessSystemEvents() function. This will wait on the release of that mouse button and therefore hold up the entire thread. Basically, if you have a thread that is doing all the work (i.e. lots of calculations and sending data to a chart) then it should have a higher priority than other threads that may be only checking events from the user. In order to set a higher priority to another you can use the SetAttribute function found in the CVI Library>>Util
ity>>Multithreading>>
ThreadPool>>Advanced Functions>>Set Attribute. You can also effectively set the priority of a thread by putting the thread to sleep using SleepEx (windows function, check out MSDN) function or the SetSleepPolicy (CVI Function, look at CVI help).


Buddy Curtis
Applications Engineer
National Instruments
Joji
0 Kudos
Message 2 of 2
(3,013 Views)