05-30-2012 04:45 PM
I want to create a DLL that is called inside a c program. The DLL would show a GUI that is updated when the C program passes 5 values to it. The DLL would receive the values once every 0.1s and update accordingly. I wanted to use CVI, because from what I understand, I can create a GUI with CVI. Mainly, the GUI requires no user interactation. It is only displaying a map.
1. Does the machine that use the c program with the DLL needs any kind of run time engine or software installed? If so, is there another way to solve this problem? I don't want to install a bunch of stuff into a workstation before the DLL can be used. If the DLL is used, I will have to installed it on 60 test station, which is not desirable.
2. When the DLL is called (once every ~0.1s), it must occur in another thread, so that the main C program does not slow down in speed. Is that possible?
3. Is it even possible to udpate once every 0.1s or faster?
Solved! Go to Solution.
05-31-2012 01:27 AM
To be able to use any CVI binary (exe or dll) you need to install appropriate (beware of Windows 7 compatibility issues) run-time engine.
It is free and downloadable through NI website.
You can create threads within your CVI DLL. I have always found it easy and convenient to program threads in CVI.
Threads always slow down the system as a whole to some extent.
Making things multi-threaded does not mean that other threads will run as fast as before.
But they stay responsive (to user and programmatic events).
Every operation use the CPU at the lowest level and CPU operate the threads in series.
It depends on the computational load that your thread brings.
0.1 second is often an achievable rate in Windows.
05-31-2012 02:02 AM
Hi,
1)CVI application need its runtime, oficialy:runtime must be installed.
There is also "unoficial/unsupported" way to do. just create installer for your application from CVI IDE and select "install runtime to application directory". Then install this to any PC. You will get CVI (GUI) runtime library in this place. And (if your are lucky one - be sure that tis is unsupported action) you can simply copy this whole application folder to any PC.
2) i think "yes". CVI has good support for multithreading, Just spawn thread in and execute RunUserInterface() function, then you can use function like PostDefferedCall() or PostDefferedCallToThread(), you can also use something like "thread safe queue" (look to help for function CmtNewTSQ)
3)There is no problem with call function more frequently, specialy with TSQ(ThreadSafeQueue).
you can simply feed TSQ at very fast rate,because this do not force to redraw imediately.
Then in the GUI thread, you can get data from TSQ with indenpendent rate for drawing (0.1s or so) and process all incoming data as you need(plot graph or so). For beter reaction,You can setup callback to TSQ (CmtInstallTSQCallback) which will be called when there is some data in it(configurable).