LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

passing data to a sub vi?

I'm reading the socket number from teststand runstate.testsockets.myindex into a control on my main vi. I want to use that value in the "prompt user" vi. I changed the express "prompt user" vi to a sub vi so I can edit the block diagram and add a terminal. Shouldn't I be able to wire the control from the main vi through a terminal to a numeric reference or control in the sub vi? When I use a control the wire will connect but the data does not get through.
0 Kudos
Message 1 of 7
(3,301 Views)
There should be no problem passing the data to a subVI. Why don't you post the modified VI so someone can take a look. You should also be able to set a break point in TestStand and then step into the VI. You can then probe the wire going to the subVI to see whether you have corrected passed the variable in from TestStand.
0 Kudos
Message 2 of 7
(3,285 Views)
I attached a screenshot of the main vi where I read the socket number variable with a control. I have it connected to another control in the sub vi which is the second picture. I've tried it in and out of the while loop and it still doesn't pass the value.
 
Download All
0 Kudos
Message 3 of 7
(3,254 Views)
Attached pics again.
Download All
0 Kudos
Message 4 of 7
(3,253 Views)

I have no problem passing the socket number to a VI that in turn passes it to a subVI. I created a VI and subVI that is essentially identical to yours. I'm not sure why you didn't just post the actual code and sequence you wrote. It would be pretty simple to see what mistake you have made with the code. I can't run a picture.

Did you do what I suggested and set a break point to step into the VI? If you do that, then you can see if the socket number is actually getting passed to that. Also, maybe you're not aware that indexing starts at 0? Have you tried testing it with socket 2,3, or 4 (index values 1,2,3)?

0 Kudos
Message 5 of 7
(3,228 Views)
Thanks I appreciate the help here. I'm new to all of this so I'm still getting used to the protocol on this board. Ok I attached the code. I stepped into the program and put a probe on the wire too. I tried all test sockets and the input is correct on the main vi. The value coming to the control on the sub vi is 0.00E+ and never changes to the main vi's value. I converted the "prompt user" express vi to a sub vi and added the socket #. All I really want to do is display the socket number to the user at the prompt. Example "Scan serial number in slot 2".
Download All
0 Kudos
Message 6 of 7
(3,218 Views)
I found the problem, it was right in front of my face. They added an invoke node to reset all controls to default vaule. I removed that and now it works.
0 Kudos
Message 7 of 7
(3,200 Views)