LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XControl: Automatic Refresh

Solved!
Go to solution

Hello,

 

Is there an easy way to tell LabView to periodically call the event-structure of an XControl? In my scenario the XControl should poll data (for example every 250ms) and update its display. In a normal VI with an event structure I would do this polling in the timeout-case, but this won't work in a XControl.

A complicated way to achieve this automatic refresh would be an additional VI which periodically calls a function of the XControl to force an Update - but I would prefer an XControl which works without such a helper VI.

 

Best regards.

 

0 Kudos
Message 1 of 8
(4,779 Views)
Solution
Accepted by topic author soranito
My experience with XControls is limited, so I don't have a direct answer, but you can at least hide the problem from the user of the control by asynchronously launching the VI yourself from inside the XControl when initializing it and calling to stop it when uniniting. I'm not sure how this would work in development time if you delete the XControl from the FP. If it doesn't call the uninit method when you delete it, you will end up with some rouge VIs, but how many times do you delete the XControl?

___________________
Try to take over the world!
Message 2 of 8
(4,760 Views)

Deleting an XControl will call the uninit ability.

This XControl has an example of continious updates.

 

Ton

 

 

Message Edited by TCPlomp on 05-11-2009 09:12 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 3 of 8
(4,758 Views)

Hi tst,

 

this is exactly the way I've done it. To activate the event-loop, I placed a hidden control on the fassade of the XControl and write signaling to it within the additional "timer-vi". I was just hoping that there was a standard built-in LabView feature to achieve this. Since I consider re-programming built-in stuff bad style, I needed reassurance, that there isn't. Your suggestion and TCPlomp's example suggest that there isn't.

 

Thanks alot.
0 Kudos
Message 4 of 8
(4,739 Views)

Instead of using a hidden control I would use a User event.

 

However there are some things to keep in mind:

-Create the user event in the init ability

 

-Pass the user event to the 'timer.vi'

-Pass the User Event Refnum with the state data

-In the Facade ability you should register when the execution state changes to running and unregister when the state changes to non-running

-Destroy the user event in the UnInit ability

 

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 8
(4,722 Views)

Hi TCPlomp,

 

I tried UserEvents first but there is a problem: The User-Events are stored in the event-queue but the facade-vi isn't called by LabView when the user event is fired and therefore the user-event isn't processed. The stored user-events are only processed when the facade-vi is called due to another event, for example a valuechange in an element.

In my first approach was only one slight difference to your suggestion: I did the event-registration already in the init ability and passed the whole event-registration in the state data. This event-registration was then wired to the event-structure in the facade ability. I don't know if this would make any difference.

 

Best regards

 

 

Message Edited by soranito on 11-05-2009 02:25 PM
0 Kudos
Message 6 of 8
(4,717 Views)

I have seen similar things, and am not sure if this has improved in newer versions of LabVEIW

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 7 of 8
(4,707 Views)
It appears not. I just tried to do the same in LV2009 with no success.
Jarrod S.
National Instruments
0 Kudos
Message 8 of 8
(4,539 Views)