LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Integration problems with CVI and RoseRT

I am trying to open up a CVI gui from inside a RoseRT model.

1) I created a CVI static library and linked it into RoseRT

2) I am not using a UIR file - I performed a TOOLS (menu): UI-to-Code-converter

3) My gui code is still written in CVI-C, but will eventually be converted to MSVC++ so I can link the RoseRT model calls.

4) I traced my RoseRT model up to the RunUserInterface() call, where it stopped, and performed all the callbacks fine, but it never continued the RoseRT model - it just stopped at the RunUserInterface() call.
- I tried to separate the RunUserInterface() into another thread, and the thread ran, but the CVI GUI would not refresh -- so I could not press any of the buttons - (however the RoseRT model w
as running fine in a background thread).

5) I tried changing the RunUserInterface() thread into using the ProcessSystemEvents() call so I can control the thread, but it had no impact (still did not refresh, and callbacks were not working).

while( WaitForSingleObject(done,10)==WAIT_TIMEOUT )
{
ProcessSystemEvents();
}

Questions:
a) is the RunUserInterface() thread running at all?
b) why won't the display refresh so I can press buttons
c) when buttons get displayed (after a looooooong wait), why won't the callbacks execute?
0 Kudos
Message 1 of 7
(3,727 Views)
RunUserInterface sits in a loop processing the windows messages and passing the GUI events back to your functions. Your application remains in RunUserInterface untill you quit the program.

I'm not familiar with RoseRT but if you could try and explain what you try to achieve and why your CVI app needs to run inside the Model I might be able to propose some solution.
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
Message 2 of 7
(3,727 Views)
Another quick thing to mention is that you will always need to process events for a panel in the same thread in which the panel was loaded. So if you call LoadPanel in one thread and RunUserInterface ( or ProcessSystemEvents ) in another, that UI is not going to do anything.

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 3 of 7
(3,727 Views)
Perfect! I moved creation of the panel into the same thread as ProcessSystemEvents() and it worked!

Thank you!

From:
newThread()
{
while(!done) ProcessSystemEvents();
}
mainThread()
{
InitCVIRTE();
panelHandle = BuildPANEL();
CreateThread( newThread );
}

Into:
newThread()
{
InitCVIRTE();
panelHandle = BuildPANEL();
while(!done) ProcessSystemEvents();
}
mainThread()
{
CreateThread( newThread );
}
0 Kudos
Message 4 of 7
(3,727 Views)
RoseRT is an IBM/Rational (Rose Real-Time) application.
- It is an executable-UML modeling-tool that executes RTOS applications under multiple TargetOS, like VxWorks, Windows, Solaris, etc.
- I am using RoseRT to control a CVI GUI that triggers events in a VxWorks platform, and waits for responses back, all under one tool (RoseRT).
- My application has to run under the RoseRT model in order for the multiple OS to communicate with each other.

The fact that RunUserInterface() stops processing was the reason I used a loop with ProcessSystemEvents() so I could control how/when/where my application exitted, instead of relying on DLL-to-EXE communication using CreateEvents().
- another reason I could not use RunUserInterace() was that the RoseRT model h
ad to keep running, so I could stop the model at any time, so that RoseRT can stop CVI running in the background/another-thread.
0 Kudos
Message 5 of 7
(3,727 Views)
Hey CviUser2003,

I'm interested in hearing more about your application. Why do you need a real-time OS? What is the real-time component of your system doing? What hardware is involved? What exactly is CVI displaying? Would you be interested in submitting a customer solution that we could publish on ni.com and advertise your company? Thanks for your time!

Nate D'Anna
0 Kudos
Message 6 of 7
(3,727 Views)
I am working on a real-time system for embedded Built-In-Test (BIT) software. I am controlling the BIT software via a CVI front end, and will be replacing TCPIP with a wireless solution.
- the tactical software is running under VxWorks and my portion of BIT is piggy-backing off their embedded systems board-support-package (BSP).
- CVI front-end is displaying the BIT results, BIT commands, connectivity to tactical software.
0 Kudos
Message 7 of 7
(3,727 Views)