From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass reference to shared variable

Solved!
Go to solution

I use two shared variables within a loop where I write to one and read from another.  I need to repeat this loop 5 times but each loop uses a different pair of shared variables.  These variables are shared between a vi on the computer and a cRio.

 

It would be ideal to incorporate this loop into a subvi where I can pass a reference to the two shared variables into and then read and write to threw those references.  Then I could just call that subvi 5 times, instead of copy and paste the loop 5 times.

 

Is there a way that I can accomplish this?  I can't seem to find an example that would accomplish this.

 

Thanks

0 Kudos
Message 1 of 3
(3,102 Views)
Solution
Accepted by topic author GreenRiver

If I understand correctly, you could use the programmatic access mode to Shared Variables and it would work.

 

http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/sv_usingdynvarapi/

http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/usingdynvarapi/

 

Message 2 of 3
(3,085 Views)

Yes, this is what I was looking for, thank you.

0 Kudos
Message 3 of 3
(3,064 Views)