LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run all VIs in a project by running a main VI

I am working with NI Crio and Arduino. I have sensors connected to Arduino, this Arduino is connected to Crio, and it sends data serially to Crio.

My Labview project for this includes 3 VIs: one VI on Windows, one VI under the Crio RT target, and the third VI under Crio FPGA target. 

The FPGA vi controls some thrusters, the Crio RT vi has the code for fetching data from Arduino, and the VI on Windows merges all the data together and I've also made the GUI on it. This third VI has some shared variables too since there are certain commands which the user can input through the GUI. Those commands have to go to the other 2 VIs.

 

I want that when I open the Labview windows VI, all other VIs in the project start running automatically. 

Right now, I have to open all the 3 VIs and run them separately, otherwise, the shared variables wouldn't work. 

 

I thought of converting the VIs under the crio RT and FPGA targets to subvi and including it in the Labview windows, but that wouldn't work would it? because the targets are different.

 

How can I do this?

0 Kudos
Message 1 of 7
(1,112 Views)

Leaving aside the Arduino, you have a LabVIEW Real-Time Project here.  If you are not familiar with LabVIEW programming, then you really aren't ready to undertake a LabVIEW RT Project, as this involves running LabVIEW on two (or maybe three, if you include the FPGA) "computers" at the same time.

 

However, to answer your question/dilemma, in a LabVIEW RT Project, it is not unusual to write the program that runs on the Remote Target (in your case, the CompactRIO) in such a way that it is "deployed" to the Target in such a way that it starts running automatically when the Target is turned on.

 

You have two computer programs running -- on your PC, you have the code that you refer to as the "VI on Windows", what I would call the "Host" routine.  You control this, you turn on the PC, boot up Windows, start LabVIEW (or, if you've build your LabVIEW code into an Executable routine, start your Executable routine), and depend on it to "know" that somewhere out there (on the Internet), there is a CompactRIO running the "missing piece" of your code.  You describe looking for "shared variables", but a somewhat more robust mechanism (but one that takes a little more programming) is to use a LabVIEW technology called "Network Streams", a method of an organized transfer of data from "LabVIEW on the Host (PC)" to "LabVIEW on the RT Remote (RIO)", or from RIO to Host.  

 

Needless to say, it is one thing to write a computer program that runs properly on one computer, to coordinate a program that runs simultaneously on two (or three) computers, simultaneously and concurrently, exchanging information and working together to accomplish a single programmatic "goal", is significantly more complicated.  You should "know what you are doing" when writing for one processor before worrying about writing a routine for two (or three) processors.

 

Bob Schor

0 Kudos
Message 2 of 7
(1,091 Views)

Alright, so what should I do to "know what I'm doing"? Would love a couple of advice since I'm totally new to LV and Crio. 

Is there anything I'm doing the wrong way?

 

Btw, this program (the LV project which runs on three computers, one on Windows, on crio RT and FPGA too) runs perfectly fine. I've tested in on my remote vehicle many times. 

 

And I still didn't get the answer to my question.

 

sarwatsarfaraz_1-1671522343567.png

The main VI that runs on Windows is by the name 'Host Program'

The Crio-RT program is 'send aruino data on labview(GUI recent)'

The FPGA program is 'learning9474'

0 Kudos
Message 3 of 7
(1,074 Views)

@sarwatsarfaraz wrote:

Alright, so what should I do to "know what I'm doing"? Would love a couple of advice since I'm totally new to LV and Crio. 

Is there anything I'm doing the wrong way?

 

Btw, this program (the LV project which runs on three computers, one on Windows, on crio RT and FPGA too) runs perfectly fine. I've tested in on my remote vehicle many times. 

 

And I still didn't get the answer to my question.

 

sarwatsarfaraz_1-1671522343567.png

The main VI that runs on Windows is by the name 'Host Program'

The Crio-RT program is 'send aruino data on labview(GUI recent)'

The FPGA program is 'learning9474'


I'm guessing that Bob is gently trying to say that, to give you any real help, you have to at least know some basic LabVIEW, and it would even be better if you understood some more advanced concepts.  For my two cents worth of advice, I think it is perfectly acceptable to start the intermediate program separately and have the FPGA code "load n go".

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 7
(1,048 Views)

First, thank you for attaching the Project view, showing that I was correct and you really are running a LabVIEW RT system with three processors, Host (PC), Remote (cRIO), and FPGA.

 

@billko pointed out something that I overlooked, so I apologize, and will try again.

 

As I understand it, what you want to do is the following steps:

  1. "Turn on" (or leave running) the cRIO.
  2. Turn on the PC.
  3. Start program on PC.  Have PC "automagically" connect to running program on cRIO which has automagically connected to code running on FPGA with you doing nothing more than possibly waiting for a few seconds, particularly if you need to actually "turn on" the PC and start Windows.

Here's what you need to do:

  • Configure your LabVIEW RT program on the Remote to start the FPGA code running shortly after the Remote starts running.
  • Have your Host and Remote start some form of "hand-shaking" protocol (not unlike establishing a TCP/IP connection) to "find each other", typically by IP address.  Generally I've done this making the assumption that the Host knows the Remote's IP (which is usually fixed), so can "ping" or something like that to find it.  I use Network Streams when dealing with LabVIEW Real-Time, so I configure the Remote to "Listen" for a connection and the Host to try to initiate it.  Since I "expect" the Remote to be on-line at a fixed IP, I set the Host to try to connect, with a 15 second timeout, and if it fails three times (45 seconds), it "gives up" and says "Remote not found" or words to that effect.

So by the time the Host is ready to run the program, the Remote and FPGA code are up and running, and all the Host needs to do is "reach out and connect".

 

Bob Schor

0 Kudos
Message 5 of 7
(1,039 Views)

@Bob_Schor wrote:

Here's what you need to do:

  • Configure your LabVIEW RT program on the Remote to start the FPGA code running shortly after the Remote starts running.
  • Have your Host and Remote start some form of "hand-shaking" protocol (not unlike establishing a TCP/IP connection) to "find each other", typically by IP address.  Generally I've done this making the assumption that the Host knows the Remote's IP (which is usually fixed), so can "ping" or something like that to find it.  I use Network Streams when dealing with LabVIEW Real-Time, so I configure the Remote to "Listen" for a connection and the Host to try to initiate it.  Since I "expect" the Remote to be on-line at a fixed IP, I set the Host to try to connect, with a 15 second timeout, and if it fails three times (45 seconds), it "gives up" and says "Remote not found" or words to that effect.

So by the time the Host is ready to run the program, the Remote and FPGA code are up and running, and all the Host needs to do is "reach out and connect".


I do the same except I use the low level TCP primitives.  I just never became a fan of the Network Streams.  I used to really like the STM library, but more recently found it too restrictive and have made my own library similar to it.

 

So to reiterate the solution:

1. You make a build for the cRIO RT.  If you have it loading the FPGA, that will be taken care of for you.

2. Load the cRIO build onto the cRIO and make it "Run at start".  Reboot the cRIO to complete the deployment.

At this point, the cRIO will always be ready for you and you will only need to start your Windows VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(1,028 Views)

@sarwatsarfaraz wrote:

Alright, so what should I do to "know what I'm doing"? Would love a couple of advice since I'm totally new to LV and Crio. 

Is there anything I'm doing the wrong way?

 

Btw, this program (the LV project which runs on three computers, one on Windows, on crio RT and FPGA too) runs perfectly fine. I've tested in on my remote vehicle many times. 

 

And I still didn't get the answer to my question.

 

sarwatsarfaraz_1-1671522343567.png

The main VI that runs on Windows is by the name 'Host Program'

The Crio-RT program is 'send aruino data on labview(GUI recent)'

The FPGA program is 'learning9474'


See https://www.ni.com/en-us/shop/compactrio/compactrio-developers-guide.html

 

Review examples for cRIO.


Certified LabVIEW Architect, Certified Professional Instructor
ALE Consultants

Introduction to LabVIEW FPGA for RF, Radar, and Electronic Warfare Applications
0 Kudos
Message 7 of 7
(1,025 Views)