09-05-2014 12:30 PM
Hello,
I am using a instrument control VI and within that I have used a subVI to start the power supply after a certain point. I have created a simple two way pattern in the SubVI which includes just error in as an Input and error out as an output and wired them to the respective terminals in main VI. The SubVI has 5 control inputs which I have made default values hence it will always execute with that values. Those values act as an input to the Power Supply I am controlling with that subVI.
Now when I run my VI it doesn't start the sub VI, It won't execute the values from control and gives 0 input to the PSU so it won't run. I want that SubVI to run when I run my Main VI. Am I missing something ? SubVI runs perfectly when I try to run it seperately.
What more things should be done when we link any SubVI to the Main VI.
Thank you.
Solved! Go to Solution.
09-05-2014 12:36 PM
Did you save the values as default?
You might want to post your subVI to see if one of us can find your problem.
09-05-2014 12:40 PM
Hello,
Thank you for the reply.
Yes, I have made the values default and they will appear as it is when I open the program again.
I have attached both of the VI's. The state machine example is the Main VI and PSU_OCP State communication is the SubVI.
Thank you.
09-05-2014 12:45 PM
LOCAL VARIABLES!!!
Your problem is that you have what we call race conditions. Learn to think in data flow. A function will execute when it has all of its inputs and will output its data when it is done running. So what are local variables waiting for in order to run? NOTHING. So they run immediately, returning the default data.
The solution is quite simple, use wires instead.
09-05-2014 12:56 PM
Hello,
Thank you for the reply.
But still the Local variables should execute the values written in control right? I mean, as you said that Local variables are not waiting for anything and executing the default values, but the default values is something I want. What I am missing is when I run it the output array still shows 0 which means the SubVI is not runnning.
How can I correct that?
Thank you.
09-05-2014 12:57 PM
@Mohit1991 wrote:
Hello,
Thank you for the reply.
But still the Local variables should execute the values written in control right? I mean, as you said that Local variables are not waiting for anything and executing the default values, but the default values is something I want. What I am missing is when I run it the output array still shows 0 which means the SubVI is not runnning.
How can I correct that?
Thank you.
But you are write to the power supply with the values BEFORE your array is created. DATAFLOW.
09-05-2014 01:09 PM
Hello,
I am not sure how to do that. I am using Local variables for using the indicators as input for next process and also to divide the binary into high and low bits and then supply individual bit.
Can you explain me more? I am a little confused here.
Thank you.