LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with CVI blocking UART Callback

Hi,

 

I have been using LabWindows CVI 9.0 since a few years now and I have seen a problem that didn't blocked me until now.

 

My LabWindows Software freezes, the code is no longer executed, when I hold a click on the interface, on a string for example.

 

The problem is that I use a device that emits data continuously on a COM port. When I decide to drag the software window or simply hold a left click on the interace the software stop acquiring data from the COM callback and my software misses data.

 

Do you have a solution for this problem ?

 

Thank you

0 Kudos
Message 1 of 6
(3,655 Views)

I never observed this clicking on controls, but dragging a window or even simply keeping the muse clicked on its title bar is the typical user action that can block a single-threaded program.

The only solution I know in this case it so split the program in multiple threads, moving the relevant part (in your case all COM stuff) in threads other than the main one, tipically dedicated to handle the GUI.

 

See the documentation on multithreading that is installed on your system; alternatively, you may want to look at the asynchronous timers. Documentation on both can be foun on this site also.



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?
Message 2 of 6
(3,650 Views)

HI Penou,

 

In fact it is a good idea using multiple Threads to  avoid this kind of behavior.

 

Maybe you are using ProcessSystemEvents to handle events,  on the same main thread. 

If it is the case, when ProcessSystemEvents handles an event that starts a tracking loop, such as the user pulling down a menu, ProcessSystemEvents does not return until the tracking loop completes. In the case of pulling down a menu, the tracking loop does not complete until the user dismisses the menu. 

 

You have several inforrmations about ProcessSystemEvents here.

 

Regards,

 

 

0 Kudos
Message 3 of 6
(3,632 Views)

Hello Remi,

just out of curiosity, does this applies also to GetUserEvent? I have observed sometimes sudden program freezees in some applications of mine but was never able to narrow them down to a specific condition: I wonder if this can be a possible reason for them (I am sometimes using this method in case of small option panels I need to handle user action on, e.g. parameters to select some data to print and so on).



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 4 of 6
(3,623 Views)

Hi RobertoBozzolo,

 

The same apply with the GetUserEvent.

From the LabWindows/CVI Help (GetUserEvent), you can get this information.

 

Bye,

0 Kudos
Message 5 of 6
(3,619 Views)

Thanks, that explains something.

Which actions exactly start a tracking loop? I mean, in my application I have no menu (or at least the I am handling a panel without menu shown with InstallPopup) so which other action / event / something can issue a tracking loop? I see a few seconds program freeze immediately after opening or closing the panel. A separate thread continues running.



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 6 of 6
(3,613 Views)