Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

how to detect wether a frontend is open?

Using the RT module to program a cRIO, is there a way to detect wether a programme is run as a deployed startup programme (and hence without an open frontend) or with a frontend open?
 
The purpose of this in my case would be that I can figure out wether to read a config file or wait for user input. If the VI is run with a PC connected to cRIO the user would make the settings via the frontend, if the cRIO runs independently (i.e. not connected to a network) it would have to use a config file.
0 Kudos
Message 1 of 7
(8,756 Views)

Typically if you have a deployed startup it will be run from an executable file. In this case you could use something similar to the attached code to determine if the VI is run from a EXE or from the development environment.

Message Edited by Christian L on 05-16-2007 11:32 AM

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 2 of 7
(8,756 Views)

Hello Jonemo,

One way to determine if a Front Panel of a certain VI is open is to use VI Server. You will need to implement something similar to the attachment. When using exectuables with VI server the .exe file should be treated like a library in that when you wish to target a VI that operates within that executable you should approach it as follows: c:/folder/exectuable.exe/thevi.vi. This KnowledgeBase article should explain this.

Hope this helps

Tom
NIUK

0 Kudos
Message 3 of 7
(8,740 Views)

Thanks very much. In Christian's solution I don't quite understand how the VI (which is then of course an exe) determines it's own path. But Tom's way is probably the way forward. I will just built my entire project and put it onto the RIO but write a separate startup VI which somehow tells the other one it's parameters. I haven't really done this before so I will spend a few hours on figuring out the tricks and traps of deploying etc...

Thanks for your input.

0 Kudos
Message 4 of 7
(8,735 Views)
Every VI inherently knows it own path (kind of like its own full name). The Path function is used to query the VI for its path. As Tom mentioned, if the VI is part of an executable, the executable file is treated like a VI library (LLB) and becomes part of the path name of the VI. This is how I determine if a VI is run from an executable of directly from the VI in the LabVIEW environment.
 
One issue with Tom's solution is that you need to know the VI path before you can open the reference to the VI itself. If you run the VI from an executsble and directly from the environment then the path will change between these two instances. So you may end up using the Path function to be able to open a reference to the VI to check if the FP is open.

Message Edited by Christian L on 05-17-2007 09:28 AM

authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 5 of 7
(8,729 Views)

Thanks Christian, your explanation was really helpful. I just tried this out and it's working just perfect. I did however stumble upon another problem with deploying my works...

Deployign and setting as startup my realtime code is quite straightforward but how do i "deploy" the fpga code so that my startup-RT-vi can reference to it?

0 Kudos
Message 6 of 7
(8,695 Views)
If you have the Open FPGA VI Reference in your LV RT code, then you do not need to separately deploy the LV FPGA. The FPGA VI bitstream is embedded in the deployed RT code and will be downloaded to the FPGA when the Open FPGA VI Reference function is executed.
 
However, if you do not want to wait until this function is called in the RT code and you want the FPGA VI to start immediately when the system is powered up, you can store the FPGA VI in flash memory that is part of the FPGA and set it to autostart on powerup. In your LabVIEW project, right click on the FPGA target and select RIO Device Setup... to see the options to download the bitstream and configure the FPGA for Autostart.
authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 7 of 7
(8,685 Views)