LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shared variables crio RT not working after compile

Solved!
Go to solution

I have a cRIO project which uses shared variables. There are variables located on the host PC and a duplicate set of variables on the RT.  As long as the project is open, everything works fine. I can DL the FPGA VI to the flash, deploy and set the RT VI to auto run, then run my desktop application VI as an EXE.

Once I close the project window and close down labview, the desktop program (host VI) will run but no longer gets any values from the shared variables. I've been reading all the FAQs and have contacted tech support (who pointed me to the FAQs).

Apparently I'm supposed to add some code to the RT VI to deploy the shared variables in the RT when the RT VI runs. When I try to do this, the method for deploying variables asks for a path. I have no idea what path to put in.

 

Any ideas?

0 Kudos
Message 1 of 22
(4,803 Views)

Don't know how to edit but I want to add a few more comments.
I've looked on these forums and seen several similar issues.

 

I've tried deploying the shared variables in the top level VI on the host and it worked the first time. After quitting the program and re-running , it no longer worked.

 

I'm confused as to whether or not I should programmatically deploy the variables in the RT or the HOST.

 

This is all rather confusing lol.

 

Is there a GOOD tutorial or FAQ on getting an application to run on a host PC which reads shared variables that are on the cRIO?

 

 

0 Kudos
Message 2 of 22
(4,793 Views)

Dear Jeff,

 

I have faced similar issues with RT, FPGA and shared variables. Try this and see whether this solves ur problem.

 

When you build your host vi application which includes shared variables, make it as the first vi in the start up vi section of the build dialog box. You can add any sub-vi's in the dynamic vi's and support files section. After building the same, right click the build and set it as start up. Deploy the build to the RT target and recycle power supply. The start up vi's will work only on reboot or recycling of power.

 

Regards

 

KRISHNA KUMAR

0 Kudos
Message 3 of 22
(4,782 Views)

Jeff,

 

I can very well understand the way you feel...as numerous times I have gone through similar emotions while using shared variables. Smiley Sad But they help save lot of programming time, so can't stop using them either Smiley Wink

 

I am not sure about the problem that you are having, but I had faced somewhat similar issue some time back. In my case I was having shared variable in cRIO RT and was binding them directly to FP controls or was accessing them using Datasocket. Everything used to run fine (in host source code as well as host exe) till I was running RT VI directly through project. Once I created EXE and deployed it and restarted RT, some shared variables were not updating while some were running perfectly. I was able to solve the problem by opening the project, undeploying all shared variables and then deploying it again. What change this made, I am not sure. After that the system started working in standalone mode (without project) and we are using RT and Host exe.

 

One more thing, why are you using seperate RT and PC libraries? Are you doing this to enable datalogging in host? Will it be possible to use RT shared variables directly in host (by either binding it or by using datasocket)? In our experience this method makes it relatively easy to get the whole thing up and running. 

 

Also I was not able to programmatically deploy variable in RT Target. While using the deploy VI in the RT code, some VIs don't get downloaded.

Message Edited by kikiduu on 01-17-2009 12:36 AM
------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
0 Kudos
Message 4 of 22
(4,774 Views)

Thanks Krishna for your response.

 

There is no option to set the host vi as the startup. The only option for this is the RT vi, which I've already done. My suspicion is that the RT vi and FPGA vi are working fine, but the host vi is not reading the shared variables once compiled.

 

It seems like everything on the cRIO is fine, and that I am missing something on the host PC vi.

 

Jeff

0 Kudos
Message 5 of 22
(4,749 Views)

Thanks kiki for your response.

I have done something similar but I did not undeploy. Rather, I simply re-deployed the variables. After quitting labview and running the host vi, it seemed to work ok. After exiting the program it no longer worked.

 

The separate libraries . This is called out in an FAQ somewhere. They tell you to create the same shared variables on the RT as the host, then to bind the host shared variables to the RT (it's a setting under aliasing of the host shared variables). We were simply following the protocol. I say 'we' because I've outsourced the code to get everything running. We can run our test by opening labview, running the fpga vi, the rt vi, then the host vi. Everything works fine as long as labview is open. Of course we don't want to keep it this way. I just want an executable for the operator to click.

 

Yes we are datalogging on the host but more importantly we're running most of the code on the host (can't go in to details of why but that's the way we need to do it).  The cRIO simply serves as an accurate data logger. FPGA vi reads/writes I/O, RT vi passes data through and provides some timing, but the host vi contains most of the code, which includes saving files to csv etc..

 

The last FAQ I read (given to me by NI tech support) was to somehow deploy the shared variables in the vi programmitcally. THe problem is that it's not clear whether or not this is on the RT vi or the host vi. So far I had no luck doing it on the RT vi so I was going to try the host next.

 

Sorry for the book 🙂

0 Kudos
Message 6 of 22
(4,748 Views)

Dear Jeff

 

To see whether the shared variables are getting deployed and published on the network by the Real time contoller, you can view them using Variable Manager. Then you can verify whether the problem is at the host PC end or at the RT controller end

 

Rgds

 

KRISHNA KUMAR

0 Kudos
Message 7 of 22
(4,730 Views)

jeff_scharpf wrote:

Thanks kiki for your response.

I have done something similar but I did not undeploy. Rather, I simply re-deployed the variables.


Re-deploying the variable didn't work in our case. So we undeployed the libraries and then deployed it again. 

 


jeff_scharpf wrote:

 Yes we are datalogging on the host but more importantly we're running most of the code on the host (can't go in to details of why but that's the way we need to do it).  The cRIO simply serves as an accurate data logger. FPGA vi reads/writes I/O, RT vi passes data through and provides some timing, but the host vi contains most of the code, which includes saving files to csv etc..


I am not sure about the protocol that you are referring to. But looks like you are not using the 'Log' option available in the shared variable. Also it appears that you are not doing any scaling in the shared variable. So I am not able to appreciate why you need to have host variables that are bound to RT variables. 

 


jeff_scharpf wrote: 

The last FAQ I read (given to me by NI tech support) was to somehow deploy the shared variables in the vi programmitcally. THe problem is that it's not clear whether or not this is on the RT vi or the host vi. So far I had no luck doing it on the RT vi so I was going to try the host next.

 


 

 

 OK this what the LabVIEW help says....

 

Shared Variables and Stand-Alone Applications or Shared Libraries

If you plan to distribute a stand-alone application that uses shared variables, do not include the .lvlib file in an LLB or in the executable. Use the Source File Settings page of the Application Properties dialog box to change the Destination of the .lvlib file to a destination outside the executable or LLB. You can deploy the shared variables in two ways:

  • Write the application so that it programmatically deploys shared variables at start time. Call the Deploy Library method in the top-level VI of the application. In the Library Path input of the method, use the relative path to the .lvlib file that contains the shared variable.
  • Manually deploy the shared variables to the computer or target Shared Variable Engine before running the built application.

------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
0 Kudos
Message 8 of 22
(4,724 Views)

Thanks again 🙂

We had the program written for us by an outside source so I am going off of what they told me. They created the shared variables.

 

Are you saying that we really only need one set of variables either on the RT or on the HOST? (I was of the understanding that you needed a "copy" of the variables on both the HOST and the RT.


It seems like this shouldn't be so complicated. We're not scaling anything. This is all done in the HOST vi. All I want to do is read and write variables from the HOST vi to the RT vi. Nothing more.

 

The RT updates some variables such as "Position". The HOST vi needs to see that variable. That's it!!

 

Also, the HOST vi needs to set variables that the RT will read such as "Lift-Cyl-Dump".

 

I'm not sure why it has to be so complicated 😞

 

Maybe we're not using the shared variables correctly?

 

I have read the help file that you are referring to and it is really confusing lol..

 

 

 

 

 

0 Kudos
Message 9 of 22
(4,710 Views)
Thanks Krishna I will try that!
0 Kudos
Message 10 of 22
(4,709 Views)