LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I run two different vi's in same project which are accessing same global variable with out effecting the speed of the execution of both the vi's

Hi
 
I have build an Labview project on CRIO target.  I have configured an FPGA VI and an host Vi to acquire data and logged the data to a file .stored the latest data in a global variable simultaneously. I have configured one more VI in the same project  to access the global variable.  I have build a dll to access both the VI's as functions in LabWindows/CVI code.  My task in CVI is to update configured GUI with latest data periodically and run the  host VI continuously for a long time and log the data to a file. GUI should update for every one second with latest data for this I am using the second VI in which I am accessing the global variable in which the latest data has been stored in host VI.
 
But when I run the cvi code in which the the two vi are executing in two different threads,the host vi which has to acquire data from fpga target for every 100microseconds is getting slow . Though I change the input to fpga channels, they are not getting updated with the latest values.
                    How can I handle this task?
 
Thanks,
Murali
 
             

Message Edited by mdontaraju on 05-10-2006 07:37 AM

Message Edited by mdontaraju on 05-10-2006 07:46 AM

Message Edited by mdontaraju on 05-10-2006 07:46 AM

0 Kudos
Message 1 of 2
(2,889 Views)

Hello Murali,

 

Thank you for your question.  It is a little unclear from your description what exactly you are trying to do.  It sounds to me like you have 3 VIs (FPGA, Host, and “one more VI in the same project”) which have been built into DLLs.  You are calling those DLLs in CVI and using the user interface in CVI, and the problem is that one of your DLL functions is running slow.

 

How do you think the threading affects the program?  It sounds like you have scheduled the function calls to the FPGA dll in a different thread than the functions calling the other DLLs.  I’m not exactly sure why this would affect things except that 100micro sec is a really small time interval.  I think it might take more than 100 micros seconds to perform a threadswap, and even then since threading is all timed in software there’s no guarantee that the switch will happen when you want it to.  You should also consider upping the thread priority for the FPGA functions.  To do this, in CVI use the Schedule Function Advanced and set the priority parameter.  This will force the thread scheduler to give priority to the thread you want to run the most.

 

You should also consider removing the global variables.  I’m not exactly sure what you are using the global variable for, but if you are doing multithreaded applications you might consider using a “functional global” variable instead.

 

Hopefully these suggestions will help, please let me know if you have any other question or if you can further clarify the problem you are encountering.

Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 2 of 2
(2,845 Views)