LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

UIR slowing down my program

I have created a LabWindows program using an API library for our
MIL-STD 1553 cards. The code can use interrupts generated by the card
or can poll the cards memory for new data and reads 16-bit data words.
When I implement a UIR interface I get an overflow on my hardware
stack because the software does not run fast enough to call the
dequeue function. If I don't have a UIR with code buit in MS Visual
C++ 6.0 it works fine even when it is compiled and linked in
LabWindows/CVI.

I am running LabWindows/CVI version 6.0
Why does my code run slower with a UIR interface?
0 Kudos
Message 1 of 3
(2,623 Views)
Hello

When you add a UI to an application, CVI's run-time has to be able to
detect and process any messages the UI might be recieving ( user
clicks, paint messages etc..) So basically, if you are trying to do
everything in one thread ( device aquisition, UI processing), i
would'nt be surprised at any overflows happeneing.
A couple of things you could do.
Replaced your call to RunUserInterface() with a while loop with some
delays and ProcessSystemEvents(). This way, you can slow down how
often the UI messages are being processed.
Another thing you could do is split up the task between multiple
threads. Have the data aqusition occur in a thread seperate from UI
thread. CVI has numerous multithreading functions. Use the thread pool
functions to make the task simpler. T
his way, none of the UI
processing would interfere with your aquisition task.

I hope this helps

Bilal Durrani
NI
0 Kudos
Message 2 of 3
(2,623 Views)
This link discusses the problem of a CVI UI using a lot of CPU time and
suggests a similar remedy to first suggestion that Bilal made of using
ProcessSystemEvents() instead of RunUserInterface(). However, it disagrees
with Bilal's other suggestion - it states that making a CVI app
multi-threaded instead of single threaded will have negligible effect on CPU
usage.

http://digital.ni.com/express.nsf/express?openagent&code=esup100316
0 Kudos
Message 3 of 3
(2,623 Views)